Project

General

Profile

Bug #20857

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

Added by Chang Liu 4 months ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
OSD
Target version:
-
Start date:
07/31/2017
Due date:
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Release:
Needs Doc:
No

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) {

History

#1 Updated by Chang Liu 4 months ago

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

#2 Updated by Chang Liu 4 months 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

#4 Updated by Chang Liu 4 months ago

  • Status changed from New to Need Review

#5 Updated by Kefu Chai 4 months ago

  • Status changed from Need Review to Resolved

Also available in: Atom PDF