Skip to content

Commit

Permalink
running make format
Browse files Browse the repository at this point in the history
  • Loading branch information
sushmaad committed Jul 17, 2017
1 parent 4d1bded commit 372568b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cache/lru_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void LRUCacheShard::TEST_GetLRUList(LRUHandle** lru, LRUHandle** lru_low_pri) {
}

size_t LRUCacheShard::TEST_GetLRUSize() {
LRUHandle *lru_handle = lru_.next;
LRUHandle* lru_handle = lru_.next;
size_t lru_size = 0;
while (lru_handle != &lru_) {
lru_size++;
Expand Down
15 changes: 9 additions & 6 deletions db/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5332,20 +5332,23 @@ TEST_F(DBTest, PinnableSliceAndRowCache) {
ASSERT_OK(Flush());

ASSERT_EQ(Get("foo"), "bar");
ASSERT_EQ(reinterpret_cast<LRUCache*>(options.row_cache.get())->
TEST_GetLRUSize(), 1);
ASSERT_EQ(
reinterpret_cast<LRUCache*>(options.row_cache.get())->TEST_GetLRUSize(),
1);

{
PinnableSlice pin_slice;
ASSERT_EQ(Get("foo", &pin_slice), Status::OK());
ASSERT_EQ(pin_slice.ToString(), "bar");
// Entry is already in cache, lookup will remove the element from lru
ASSERT_EQ(reinterpret_cast<LRUCache*>(options.row_cache.get())->
TEST_GetLRUSize(), 0);
ASSERT_EQ(
reinterpret_cast<LRUCache*>(options.row_cache.get())->TEST_GetLRUSize(),
0);
}
// After PinnableSlice destruction element is added back in LRU
ASSERT_EQ(reinterpret_cast<LRUCache*>(options.row_cache.get())->
TEST_GetLRUSize(), 1);
ASSERT_EQ(
reinterpret_cast<LRUCache*>(options.row_cache.get())->TEST_GetLRUSize(),
1);
}

#endif // ROCKSDB_LITE
Expand Down
8 changes: 4 additions & 4 deletions db/table_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ Status TableCache::Get(const ReadOptions& options,

if (auto row_handle =
ioptions_.row_cache->Lookup(row_cache_key.GetUserKey())) {

// Cleanable routine to release the cache entry
Cleanable value_pinner;
auto release_cache_entry_func = [] (void* cache_to_clean, void* cache_handle){
((Cache*)cache_to_clean)->Release((Cache::Handle*) cache_handle);
auto release_cache_entry_func = [](void* cache_to_clean,
void* cache_handle) {
((Cache*)cache_to_clean)->Release((Cache::Handle*)cache_handle);
};
auto found_row_cache_entry = static_cast<const std::string*>(
ioptions_.row_cache->Value(row_handle));
Expand All @@ -352,7 +352,7 @@ Status TableCache::Get(const ReadOptions& options,
// get_context.pinnable_slice_. Cache entry is released when
// get_context.pinnable_slice_ is reset.
value_pinner.RegisterCleanup(release_cache_entry_func,
ioptions_.row_cache.get(), row_handle);
ioptions_.row_cache.get(), row_handle);
replayGetContextLog(*found_row_cache_entry, user_key, get_context,
&value_pinner);
RecordTick(ioptions_.statistics, ROW_CACHE_HIT);
Expand Down
3 changes: 2 additions & 1 deletion table/get_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ void replayGetContextLog(const Slice& replay_log, const Slice& user_key,
// Since SequenceNumber is not stored and unknown, we will use
// kMaxSequenceNumber.
get_context->SaveValue(
ParsedInternalKey(user_key, kMaxSequenceNumber, type), value, value_pinner);
ParsedInternalKey(user_key, kMaxSequenceNumber, type), value,
value_pinner);
}
#else // ROCKSDB_LITE
assert(false);
Expand Down
2 changes: 1 addition & 1 deletion table/get_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ class GetContext {

void replayGetContextLog(const Slice& replay_log, const Slice& user_key,
GetContext* get_context,
Cleanable *value_pinner = nullptr);
Cleanable* value_pinner = nullptr);

} // namespace rocksdb

0 comments on commit 372568b

Please sign in to comment.