主从同步性能优化,主从同步性能测试。

This commit is contained in:
1iaan
2026-02-01 16:49:50 +00:00
parent 003566b69a
commit 6d1a50cf88
31 changed files with 2119 additions and 400 deletions

View File

@@ -469,7 +469,7 @@ static int kvs_rbtree_save_node(iouring_ctx_t *uring, int fd, off_t *current_off
if (node == inst->nil) return 0;
int rc = 0;
rc = kvs_rbtree_save_node(uring, fd, current_off, inst, node->left);
if (rc < 0) return rc;
@@ -504,9 +504,12 @@ static int kvs_rbtree_save_node(iouring_ctx_t *uring, int fd, off_t *current_off
for (int i = 0; i < count; i++) total += lens[i];
task_t *t = submit_write(uring, fd, bufs, lens, count, *current_off);
cleanup_finished_iouring_tasks();
if (!t) { return -4; }
if(!t) {
perror("task init failed");
return -4;
}
*current_off += (off_t) total;
@@ -527,7 +530,11 @@ int kvs_rbtree_save(iouring_ctx_t *uring, kvs_rbtree_t *inst, const char* filena
int rc = kvs_rbtree_save_node(uring, fd, &current_off, inst, inst->root);
close(fd);
while (!uring_task_complete(uring)) {
usleep(1000);
cleanup_finished_iouring_tasks();
}
close(fd);
return rc;
}