uring落盘的无锁队列修改

This commit is contained in:
1iaan
2026-02-11 11:59:40 +00:00
parent c1458a6693
commit 68bb4b3f9c
16 changed files with 293 additions and 1135 deletions

View File

@@ -40,6 +40,24 @@ int kvs_create_snapshot(iouring_ctx_t *uring, const char* array_file, const char
return ret;
}
int kvs_create_snapshot_async_1(iouring_ctx_t *uring, const char* array_file, const char* rbtree_file, const char* hash_file){
pid_t pid = fork();
if (pid == -1) { perror("fork"); return -1; }
if (pid == 0) {
int ret = kvs_create_snapshot(uring, array_file, rbtree_file, hash_file);
if (ret != 0) {
fprintf(stderr, "snapshot creation failed\n");
_exit(1);
}
_exit(0);
} else {
return 0;
}
}
static int send_file_to_ipport(const char *ip, int port, const char *filename) {
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) { perror("socket"); return -1; }
@@ -86,7 +104,7 @@ static int send_file_to_ipport(const char *ip, int port, const char *filename) {
return 0;
}
int kvs_create_snapshot_async(const char *ip, int port){
int kvs_create_snapshot_async_2(const char *ip, int port){
pid_t pid = fork();
if (pid == -1) { perror("fork"); return -1; }