uring落盘的无锁队列修改
This commit is contained in:
@@ -10,8 +10,8 @@ extern char global_rbtree_file[256];
|
||||
extern char global_hash_file[256];
|
||||
|
||||
int kvs_create_snapshot(iouring_ctx_t *uring, const char* array_file, const char* rbtree_file, const char* hash_file);
|
||||
int kvs_create_snapshot_async(const char *ip, int port);
|
||||
|
||||
int kvs_create_snapshot_async_1(iouring_ctx_t *uring, const char* array_file, const char* rbtree_file, const char* hash_file);
|
||||
int kvs_create_snapshot_async_2(const char *ip, int port);
|
||||
extern int global_oplog_fd;
|
||||
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user