From 2d8518f5ea3e313beb23e21c72bc54b633f6a2d6 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Tue, 6 Apr 2021 11:30:17 -0700 Subject: [PATCH] Reset pinnable slice before using it in Get() (#8154) Summary: Fixes https://github.com/facebook/rocksdb/issues/6548. If we do not reset the pinnable slice before calling get, we will see the following assertion failure while running the test with multiple column families. ``` db_bench: ./include/rocksdb/slice.h:168: void rocksdb::PinnableSlice::PinSlice(const rocksdb::Slice&, rocksdb::Cleanable*): Assertion `!pinned_' failed. ``` This happens in `BlockBasedTable::Get()`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8154 Test Plan: ./db_bench --benchmarks=fillseq -num_column_families=3 ./db_bench --benchmarks=readrandom -use_existing_db=1 -num_column_families=3 Reviewed By: ajkr Differential Revision: D27587589 Pulled By: riversand963 fbshipit-source-id: 7379e7649ba40f046d6a4014c9ad629cb3f9a786 --- tools/db_bench_tool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 789c83566..37cec5155 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -5287,11 +5287,11 @@ class Benchmark { ts_ptr = &ts_ret; } Status s; + pinnable_val.Reset(); if (FLAGS_num_column_families > 1) { s = db_with_cfh->db->Get(options, db_with_cfh->GetCfh(key_rand), key, &pinnable_val, ts_ptr); } else { - pinnable_val.Reset(); s = db_with_cfh->db->Get(options, db_with_cfh->db->DefaultColumnFamily(), key, &pinnable_val, ts_ptr);