Skip to content

Commit

Permalink
fix a bug of the ticker NO_FILE_OPENS (facebook#9677)
Browse files Browse the repository at this point in the history
Summary:
In the original code, the value of `NO_FILE_OPENS` corresponding to the Ticker item will be increased regardless of whether the file is successfully opened or not. Even counts are repeated, which can lead to skewed counts.

Pull Request resolved: facebook#9677

Reviewed By: jay-zhuang

Differential Revision: D34725733

Pulled By: ajkr

fbshipit-source-id: 841234ed03802c0105fd2107d82a740265ead576
  • Loading branch information
gukaifeng authored and facebook-github-bot committed Mar 15, 2022
1 parent 3da8236 commit 89429a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions db/table_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,18 @@ Status TableCache::GetTableReader(
if (s.ok()) {
s = ioptions_.fs->NewRandomAccessFile(fname, fopts, &file, nullptr);
}
RecordTick(ioptions_.stats, NO_FILE_OPENS);
if (s.IsPathNotFound()) {
if (s.ok()) {
RecordTick(ioptions_.stats, NO_FILE_OPENS);
} else if (s.IsPathNotFound()) {
fname = Rocks2LevelTableFileName(fname);
s = PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options);
if (s.ok()) {
s = ioptions_.fs->NewRandomAccessFile(fname, file_options, &file,
nullptr);
}
RecordTick(ioptions_.stats, NO_FILE_OPENS);
if (s.ok()) {
RecordTick(ioptions_.stats, NO_FILE_OPENS);
}
}

if (s.ok()) {
Expand Down

0 comments on commit 89429a9

Please sign in to comment.