Project

General

Profile

Actions

Bug #20857

closed

Rocksdb::Env::GetChildren will get same output with ["db", "db.slow"]

Added by Chang Liu over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
OSD
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Thread 1 "ceph-kvstore-to" hit Breakpoint 1, rocksdb::(anonymous namespace)::Repairer::FindFiles (this=0x7fffffffbcd0) at /home/liuchang/WorkSpace/ceph/src/rocksdb/db/repair.cc:251
251               env_->GetChildren(db_options_.db_paths[path_id].path, &filenames);
(gdb) p path_id
$1 = 0
(gdb) n
252           if (!status.ok()) {
(gdb) p filenames
$2 = std::vector of length 10, capacity 10 = {"000004.sst", "000013.sst", "CURRENT", "IDENTITY", "LOCK", "MANIFEST-000017", "OPTIONS-000017", "OPTIONS-000020", ".", ".."}
(gdb) c
Continuing.

Thread 1 "ceph-kvstore-to" hit Breakpoint 1, rocksdb::(anonymous namespace)::Repairer::FindFiles (this=0x7fffffffbcd0) at /home/liuchang/WorkSpace/ceph/src/rocksdb/db/repair.cc:251
251               env_->GetChildren(db_options_.db_paths[path_id].path, &filenames);
(gdb) p path_id
$3 = 1
(gdb) n
252           if (!status.ok()) {
(gdb) p filenames
$4 = std::vector of length 12, capacity 20 = {"000004.sst", "000013.sst", "CURRENT", "IDENTITY", "LOCK", "MANIFEST-000017", "OPTIONS-000017", "OPTIONS-000020", ".", "..", ".", ".."}
(gdb) p db_options_.db_paths
$5 = std::vector of length 2, capacity 2 = {{path = "db", target_size = 63753420}, {path = "db.slow", target_size = 10200547328}}
(gdb) l 245,270
245
246       Status FindFiles() {
247         std::vector<std::string> filenames;
248         bool found_file = false;
249         for (size_t path_id = 0; path_id < db_options_.db_paths.size(); path_id++) {
250           Status status =
251               env_->GetChildren(db_options_.db_paths[path_id].path, &filenames);
252           if (!status.ok()) {
253             return status;
254           }
255           if (!filenames.empty()) {
256             found_file = true;
257           }
258
259           uint64_t number;
260           FileType type;
261           for (size_t i = 0; i < filenames.size(); i++) {
262             if (ParseFileName(filenames[i], &number, &type)) {
263               if (type == kDescriptorFile) {
264                 assert(path_id == 0);
265                 manifests_.push_back(filenames[i]);
266               } else {
267                 if (number + 1 > next_file_number_) {
268                   next_file_number_ = number + 1;
269                 }
270                 if (type == kLogFile) {
Actions #1

Updated by Chang Liu over 6 years ago

I removed all files under "dev" directory beforce this testing.

Actions #2

Updated by Chang Liu over 6 years ago

  virtual Status GetChildren(const std::string& dir,
                             std::vector<std::string>* result) override {
    result->clear();
    DIR* d = opendir(dir.c_str());
    if (d == nullptr) {
      switch (errno) {
        case EACCES:
        case ENOENT:
        case ENOTDIR:
          return Status::NotFound();
        default:
          return IOError(dir, errno);
      }
    }
    struct dirent* entry;
    while ((entry = readdir(d)) != nullptr) {
      result->push_back(entry->d_name);
    }
    closedir(d);
    return Status::OK();
  }

It's a bug of our RocksdbEnv, We should clear result at first like rocksdb::env_posix

Actions #4

Updated by Chang Liu over 6 years ago

  • Status changed from New to Fix Under Review
Actions #5

Updated by Kefu Chai over 6 years ago

  • Status changed from Fix Under Review to Resolved
Actions

Also available in: Atom PDF