-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implent snapshots support #313
Conversation
… and min_data_changed
…torage db for the snapshots
…ng any action if they are expired
…criptors and implement it both for posix and io_uring
…s writable in the storage_db_snapshot unit, in config check only that the path is not longer than MAX_PATH
…ation the snapshot doesn't start
// The LZF compression is disabled for now, it causes a segfault | ||
// if (false && likely(!string_serialized || (entry_index->value.size > 32 && entry_index->value.size < 52 * 1024))) { | ||
// module_redis_snapshot_serialize_primitive_result_t serialize_result; | ||
// size_t allocated_buffer_size = LZF_MAX_COMPRESSED_SIZE(entry_index->value.size) * 1.2; | ||
// uint8_t *allocated_buffer = ffma_mem_alloc(allocated_buffer_size); | ||
// | ||
// serialize_result = module_redis_snapshot_serialize_primitive_encode_small_string_lzf( | ||
// string, | ||
// entry_index->value.size, | ||
// allocated_buffer, | ||
// allocated_buffer_size, | ||
// 0, | ||
// &buffer_offset); | ||
// | ||
// // If the compression fails or the ration is too low ignore the error, cachegrand will try to | ||
// // save the string as a regular string | ||
// if (likely(serialize_result == MODULE_REDIS_SNAPSHOT_SERIALIZE_PRIMITIVE_RESULT_OK)) { | ||
// if (unlikely(!storage_db_snapshot_rdb_write_buffer( | ||
// db, | ||
// allocated_buffer, | ||
// allocated_buffer_size))) { | ||
// ffma_mem_free(allocated_buffer); | ||
// result = false; | ||
// goto end; | ||
// } | ||
// | ||
// string_serialized = true; | ||
// } | ||
// | ||
// ffma_mem_free(allocated_buffer); | ||
// } |
Check notice
Code scanning / CodeQL
Commented-out code
hashtable_key_size_t key_size = 0; | ||
|
||
// Tries to fetch the next entry within the block being processed | ||
bucket_index++; |
Check notice
Code scanning / CodeQL
For loop variable changed in body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required by the implementation
This PR implements the necessary support to generate the RDB snapshots in the background.
A new fiber has been introduced which takes care of generating a snapshot, depending on the settings. A new set of parameters have been introduced, example below with explanation in line.
The example is from cachegrand.yaml.skel
The new mechanism takes care of reporting every 3 seconds a status update.
Closes #293
Notes: