Rename sqllite-write thread, add index for read threads.

Additionally make note these are actually coroutines and not threads.
This commit is contained in:
Ray Jenkins 2022-01-25 13:56:35 -06:00
parent 0d34ec0880
commit fd6597cc7a
1 changed files with 7 additions and 3 deletions

View File

@ -2138,6 +2138,7 @@ KeyValueStoreSQLite::KeyValueStoreSQLite(std::string const& filename,
// the cache sizes for individual threads?
TaskPriority taskId = g_network->getCurrentTask();
g_network->setCurrentTask(TaskPriority::DiskWrite);
// Note: the below is actually a coroutine and not a thread.
writeThread->addThread(new Writer(this,
type == KeyValueStoreType::SSD_BTREE_V2,
checkChecksums,
@ -2148,7 +2149,7 @@ KeyValueStoreSQLite::KeyValueStoreSQLite(std::string const& filename,
freeListPages,
id,
&readCursors),
"fdb-sqlite-wr");
"fdb-sqllite-write");
g_network->setCurrentTask(taskId);
auto p = new Writer::InitAction();
auto f = p->result.getFuture();
@ -2175,10 +2176,13 @@ void KeyValueStoreSQLite::startReadThreads() {
int nReadThreads = readCursors.size();
TaskPriority taskId = g_network->getCurrentTask();
g_network->setCurrentTask(TaskPriority::DiskRead);
for (int i = 0; i < nReadThreads; i++)
for (int i = 0; i < nReadThreads; i++) {
std::string threadName = format("fdb-sqllite-reader-%d", i);
// Note: the below is actually a coroutine and not a thread.
readThreads->addThread(
new Reader(filename, type == KeyValueStoreType::SSD_BTREE_V2, readsComplete, logID, &readCursors[i]),
"fdb-sqlite-r");
threadName.c_str());
}
g_network->setCurrentTask(taskId);
}