Skip to content
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

[issue#1498] db.option.wal_dir set #1523

Merged
merged 1 commit into from
May 20, 2023

Conversation

Brokenice0415
Copy link
Contributor

@Brokenice0415 Brokenice0415 commented May 18, 2023

fix #1498

What is the purpose of the change

Set db wal_dir prefix to make wal path valid when creating checkpoint

@ghost
Copy link

ghost commented May 19, 2023

Status Storage::Open(const StorageOptions& storage_options, const std::string& db_path)

  1. 这个函数在传递的时候已经传递了strings/hashes/sets/lists/zsets
  2. 这个问题应该是函数传递path的时候最后缺少一个/

`
Status Storage::Open(const StorageOptions& storage_options, const std::string& db_path) {
mkpath(db_path.c_str(), 0755);

strings_db_ = new RedisStrings(this, kStrings);
Status s = strings_db_->Open(storage_options, AppendSubDirectory(db_path, "strings/"));
if (!s.ok()) {
LOG(FATAL) << "open kv db failed, " << s.ToString();
}

hashes_db_ = new RedisHashes(this, kHashes);
s = hashes_db_->Open(storage_options, AppendSubDirectory(db_path, "hashes/"));
if (!s.ok()) {
LOG(FATAL) << "open hashes db failed, " << s.ToString();
}

sets_db_ = new RedisSets(this, kSets);
s = sets_db_->Open(storage_options, AppendSubDirectory(db_path, "sets/"));
if (!s.ok()) {
LOG(FATAL) << "open set db failed, " << s.ToString();
}

lists_db_ = new RedisLists(this, kLists);
s = lists_db_->Open(storage_options, AppendSubDirectory(db_path, "lists/"));
if (!s.ok()) {
LOG(FATAL) << "open list db failed, " << s.ToString();
}

zsets_db_ = new RedisZSets(this, kZSets);
s = zsets_db_->Open(storage_options, AppendSubDirectory(db_path, "zsets/"));
if (!s.ok()) {
LOG(FATAL) << "open zset db failed, " << s.ToString();
}
is_opened_.store(true);
return Status::OK();
}`

@Brokenice0415
Copy link
Contributor Author

  1. 这个函数在传递的时候已经传递了strings/hashes/sets/lists/zsets

感谢提醒,没有注意到

  1. 这个问题应该是函数传递path的时候最后缺少一个/

不是的,还是因为wal_dir的漏设置和rocksdb的相关处理导致的丢失

New

取消在db打开时的wal_dir赋值
增加对wal_dir的判断逻辑:当wal_dir为空时,也就是实际等同db path时,使用db path的值替换它

@AlexStocks AlexStocks requested a review from a user May 20, 2023 02:37
@chejinge chejinge merged commit 1b19088 into OpenAtomFoundation:unstable May 20, 2023
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

执行 bgsave 命令时日志输出 file not exist
3 participants