Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob DB: not using PinnableSlice move assignment #3164

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ if(WITH_TESTS)
util/hash_test.cc
util/heap_test.cc
util/rate_limiter_test.cc
util/slice_test.cc
util/slice_transform_test.cc
util/timer_queue_test.cc
util/thread_list_test.cc
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ TESTS = \
repair_test \
env_timed_test \
write_prepared_transaction_test \
slice_test \

PARALLEL_TEST = \
backupable_db_test \
Expand Down Expand Up @@ -1478,9 +1477,6 @@ range_del_aggregator_test: db/range_del_aggregator_test.o db/db_test_util.o $(LI
blob_db_test: utilities/blob_db/blob_db_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

slice_test: util/slice_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

#-------------------------------------------------
# make install related stuff
INSTALL_PATH ?= /usr/local
Expand Down
1 change: 0 additions & 1 deletion TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ ROCKS_TESTS = [['arena_test', 'util/arena_test.cc', 'serial'],
['repair_test', 'db/repair_test.cc', 'serial'],
['sim_cache_test', 'utilities/simulator_cache/sim_cache_test.cc', 'serial'],
['skiplist_test', 'memtable/skiplist_test.cc', 'serial'],
['slice_test', 'util/slice_test.cc', 'serial'],
['slice_transform_test', 'util/slice_transform_test.cc', 'serial'],
['spatial_db_test', 'utilities/spatialdb/spatial_db_test.cc', 'serial'],
['sst_dump_test', 'tools/sst_dump_test.cc', 'serial'],
Expand Down
25 changes: 0 additions & 25 deletions include/rocksdb/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,31 +133,6 @@ class PinnableSlice : public Slice, public Cleanable {
PinnableSlice(PinnableSlice&) = delete;
PinnableSlice& operator=(PinnableSlice&) = delete;

PinnableSlice(PinnableSlice&& other) { *this = std::move(other); }

PinnableSlice& operator=(PinnableSlice&& other) {
if (this != &other) {
// cleanup itself.
Reset();

Slice::operator=(other);
Cleanable::operator=(std::move(other));
pinned_ = other.pinned_;
if (!pinned_ && other.buf_ == &other.self_space_) {
self_space_ = std::move(other.self_space_);
buf_ = &self_space_;
data_ = buf_->data();
} else {
buf_ = other.buf_;
}
// Re-initialize the other PinnablaeSlice.
other.self_space_.clear();
other.buf_ = &other.self_space_;
other.pinned_ = false;
}
return *this;
}

inline void PinSlice(const Slice& s, CleanupFunction f, void* arg1,
void* arg2) {
assert(!pinned_);
Expand Down
1 change: 0 additions & 1 deletion src.mk
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ MAIN_SOURCES = \
util/filelock_test.cc \
util/log_write_bench.cc \
util/rate_limiter_test.cc \
util/slice_test.cc \
util/slice_transform_test.cc \
util/timer_queue_test.cc \
util/thread_list_test.cc \
Expand Down
71 changes: 0 additions & 71 deletions util/slice_test.cc

This file was deleted.

13 changes: 5 additions & 8 deletions utilities/blob_db/blob_db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1245,18 +1245,15 @@ Status BlobDBImpl::Get(const ReadOptions& read_options,

Status s;
bool is_blob_index = false;
PinnableSlice index_entry;
s = db_impl_->GetImpl(ro, column_family, key, &index_entry,
s = db_impl_->GetImpl(ro, column_family, key, value,
nullptr /*value_found*/, nullptr /*read_callback*/,
&is_blob_index);
TEST_SYNC_POINT("BlobDBImpl::Get:AfterIndexEntryGet:1");
TEST_SYNC_POINT("BlobDBImpl::Get:AfterIndexEntryGet:2");
if (s.ok()) {
if (!is_blob_index) {
*value = std::move(index_entry);
} else {
s = GetBlobValue(key, index_entry, value);
}
if (s.ok() && is_blob_index) {
std::string index_entry = value->ToString();
value->Reset();
s = GetBlobValue(key, index_entry, value);
}
if (snapshot_created) {
db_->ReleaseSnapshot(ro.snapshot);
Expand Down
12 changes: 12 additions & 0 deletions utilities/blob_db/blob_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ class BlobDBTest : public testing::Test {
}

void VerifyDB(DB *db, const std::map<std::string, std::string> &data) {
// Verify normal Get
auto* cfh = db->DefaultColumnFamily();
for (auto &p : data) {
PinnableSlice value_slice;
ASSERT_OK(db->Get(ReadOptions(), cfh, p.first, &value_slice));
ASSERT_EQ(p.second, value_slice.ToString());
std::string value;
ASSERT_OK(db->Get(ReadOptions(), cfh, p.first, &value));
ASSERT_EQ(p.second, value);
}

// Verify iterators
Iterator *iter = db->NewIterator(ReadOptions());
iter->SeekToFirst();
for (auto &p : data) {
Expand Down