-
Notifications
You must be signed in to change notification settings - Fork 714
Apply sst file manager in myrocks clone to add slow-rm during checkpoints removal #1386
base: fb-mysql-8.0.28
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -476,20 +476,6 @@ int rocksdb_create_checkpoint(const char *checkpoint_dir_raw) { | |||||
| return HA_EXIT_FAILURE; | ||||||
| } | ||||||
|
|
||||||
| int rocksdb_remove_checkpoint(const char *checkpoint_dir_raw) { | ||||||
| const auto checkpoint_dir = rdb_normalize_dir(checkpoint_dir_raw); | ||||||
| LogPluginErrMsg(INFORMATION_LEVEL, ER_LOG_PRINTF_MSG, | ||||||
| "deleting temporary checkpoint in directory : %s\n", | ||||||
| checkpoint_dir.c_str()); | ||||||
| const auto status = rocksdb::DestroyDB(checkpoint_dir, rocksdb::Options()); | ||||||
| if (status.ok()) { | ||||||
| return HA_EXIT_SUCCESS; | ||||||
| } | ||||||
| my_error(ER_GET_ERRMSG, MYF(0), status.code(), status.ToString().c_str(), | ||||||
| rocksdb_hton_name); | ||||||
| return HA_EXIT_FAILURE; | ||||||
| } | ||||||
|
|
||||||
| static int rocksdb_create_checkpoint_validate( | ||||||
| THD *const thd MY_ATTRIBUTE((__unused__)), | ||||||
| struct SYS_VAR *const var MY_ATTRIBUTE((__unused__)), | ||||||
|
|
@@ -1325,6 +1311,27 @@ static void rocksdb_set_io_write_timeout( | |||||
| RDB_MUTEX_UNLOCK_CHECK(rdb_sysvars_mutex); | ||||||
| } | ||||||
|
|
||||||
| int rocksdb_remove_checkpoint(const char *checkpoint_dir_raw) { | ||||||
| const auto checkpoint_dir = rdb_normalize_dir(checkpoint_dir_raw); | ||||||
| LogPluginErrMsg(INFORMATION_LEVEL, ER_LOG_PRINTF_MSG, | ||||||
| "deleting temporary checkpoint in directory : %s\n", | ||||||
| checkpoint_dir.c_str()); | ||||||
|
|
||||||
| std::string trash_dir = std::string(rocksdb_datadir) + "/trash"; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO this is important to deduplicate with the other trash dir occurence in
Suggested change
|
||||||
| rocksdb::Options op = rocksdb::Options(); | ||||||
|
sunshine-Chun marked this conversation as resolved.
Outdated
|
||||||
| op.sst_file_manager.reset(NewSstFileManager( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an expert in SST file manager so open questions:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked with Rocksdb team. The trash_dir has actually been deprecated. It's the old way of managing trash files. Nowadays Rocksdb team manage them by renaming the sst files. I will pass nullptr to trash dir and set the delete_existing_trash to false since we are not using them.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see, thank you. Should we convert the existing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we can convert the existing rocksdb_init_internal usage in a follow-up PR.
I am open for suggestion. My original thought is that we only have two places use sst_file_manager. Does it worth to maintain a static variable for the usage of these two places?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am not sure neither. Clone can run many times, and rotate the checkpoint many times too, so dynamically it could be much more than two places. Also the init options are repeated, and probably should be in sync after the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot one more thing, is reusing the same object even safe in the first place? |
||||||
| rocksdb_db_options->env, rocksdb_db_options->info_log, trash_dir, | ||||||
| rocksdb_sst_mgr_rate_bytes_per_sec, true /* delete_existing_trash */)); | ||||||
| const auto status = rocksdb::DestroyDB(checkpoint_dir, op); | ||||||
|
|
||||||
| if (status.ok()) { | ||||||
| return HA_EXIT_SUCCESS; | ||||||
| } | ||||||
| my_error(ER_GET_ERRMSG, MYF(0), status.code(), status.ToString().c_str(), | ||||||
| rocksdb_hton_name); | ||||||
| return HA_EXIT_FAILURE; | ||||||
| } | ||||||
|
|
||||||
|
sunshine-Chun marked this conversation as resolved.
Outdated
|
||||||
| #endif // !__APPLE__ | ||||||
|
|
||||||
| enum rocksdb_flush_log_at_trx_commit_type : unsigned int { | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.