diff options
author | Sanjay Ghemawat <sanjay@google.com> | 2012-03-15 09:14:00 -0700 |
---|---|---|
committer | Sanjay Ghemawat <sanjay@google.com> | 2012-03-15 09:14:00 -0700 |
commit | 9013f13b1512f6ab8c04518e8f036e58be271eba (patch) | |
tree | e5c2bed9104f74183981e1ff254074b362f6a856 /table/table.cc | |
parent | 583f1499c00ff40f332149021f583cf6ee78dd7e (diff) | |
download | leveldb-9013f13b1512f6ab8c04518e8f036e58be271eba.tar.gz |
use mmap on 64-bit machines to speed-up reads; small build fixes
Diffstat (limited to 'table/table.cc')
-rw-r--r-- | table/table.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/table/table.cc b/table/table.cc index 5f9238e..07dcffd 100644 --- a/table/table.cc +++ b/table/table.cc @@ -49,7 +49,9 @@ Status Table::Open(const Options& options, // Read the index block Block* index_block = NULL; if (s.ok()) { - s = ReadBlock(file, ReadOptions(), footer.index_handle(), &index_block); + bool may_cache; // Ignored result + s = ReadBlock(file, ReadOptions(), footer.index_handle(), &index_block, + &may_cache); } if (s.ok()) { @@ -105,6 +107,7 @@ Iterator* Table::BlockReader(void* arg, // can add more features in the future. if (s.ok()) { + bool may_cache; if (block_cache != NULL) { char cache_key_buffer[16]; EncodeFixed64(cache_key_buffer, table->rep_->cache_id); @@ -114,14 +117,14 @@ Iterator* Table::BlockReader(void* arg, if (cache_handle != NULL) { block = reinterpret_cast<Block*>(block_cache->Value(cache_handle)); } else { - s = ReadBlock(table->rep_->file, options, handle, &block); - if (s.ok() && options.fill_cache) { + s = ReadBlock(table->rep_->file, options, handle, &block, &may_cache); + if (s.ok() && may_cache && options.fill_cache) { cache_handle = block_cache->Insert( key, block, block->size(), &DeleteCachedBlock); } } } else { - s = ReadBlock(table->rep_->file, options, handle, &block); + s = ReadBlock(table->rep_->file, options, handle, &block, &may_cache); } } |