主从同步性能优化,主从同步性能测试。
This commit is contained in:
@@ -273,7 +273,9 @@ int kvs_hash_save(iouring_ctx_t *uring, kvs_hash_t *inst, const char* filename){
|
||||
for(int i = 0;i < inst->max_slots; ++ i){
|
||||
for (hashnode_t *n = inst->nodes[i]; n != NULL; n = n->next) {
|
||||
if (!n->key || n->key_len == 0) continue;
|
||||
if (n->value_len > 0 && !n->value) { close(fd); return -3; }
|
||||
if (n->value_len > 0 && !n->value) {
|
||||
goto clean;
|
||||
}
|
||||
|
||||
|
||||
uint32_t klen = htonl((uint32_t)n->key_len);
|
||||
@@ -308,14 +310,21 @@ int kvs_hash_save(iouring_ctx_t *uring, kvs_hash_t *inst, const char* filename){
|
||||
|
||||
|
||||
task_t *t = submit_write(uring, fd, bufs, lens, count, current_off);
|
||||
|
||||
if (!t) { close(fd); return -4; }
|
||||
|
||||
if(!t) {
|
||||
perror("task init failed");
|
||||
goto clean;
|
||||
}
|
||||
cleanup_finished_iouring_tasks();
|
||||
|
||||
current_off += (off_t) total;
|
||||
}
|
||||
}
|
||||
|
||||
clean:
|
||||
while (!uring_task_complete(uring)) {
|
||||
usleep(1000);
|
||||
cleanup_finished_iouring_tasks();
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user