fix a bug of the ticker NO_FILE_OPENS (#9677)
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: https://github.com/facebook/rocksdb/pull/9677 Reviewed By: jay-zhuang Differential Revision: D34725733 Pulled By: ajkr fbshipit-source-id: 841234ed03802c0105fd2107d82a740265ead576
This commit is contained in:
parent
fddc1a79dd
commit
0e4c063c16
@ -114,16 +114,19 @@ Status TableCache::GetTableReader(
|
|||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
s = ioptions_.fs->NewRandomAccessFile(fname, fopts, &file, nullptr);
|
s = ioptions_.fs->NewRandomAccessFile(fname, fopts, &file, nullptr);
|
||||||
}
|
}
|
||||||
|
if (s.ok()) {
|
||||||
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
||||||
if (s.IsPathNotFound()) {
|
} else if (s.IsPathNotFound()) {
|
||||||
fname = Rocks2LevelTableFileName(fname);
|
fname = Rocks2LevelTableFileName(fname);
|
||||||
s = PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options);
|
s = PrepareIOFromReadOptions(ro, ioptions_.clock, fopts.io_options);
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
s = ioptions_.fs->NewRandomAccessFile(fname, file_options, &file,
|
s = ioptions_.fs->NewRandomAccessFile(fname, file_options, &file,
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
if (s.ok()) {
|
||||||
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
RecordTick(ioptions_.stats, NO_FILE_OPENS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
if (!sequential_mode && ioptions_.advise_random_on_open) {
|
if (!sequential_mode && ioptions_.advise_random_on_open) {
|
||||||
|
Loading…
Reference in New Issue
Block a user