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

Adding missing features to RocksDB 7.9.fb #1

Open
wants to merge 21 commits into
base: 7.9.fb
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update from a7c6f5d
tanmeshnm@gmail.com committed Mar 17, 2023
commit ab1095aa6613763f3c2f007375febecb71a39e37
60 changes: 31 additions & 29 deletions utilities/cassandra/cassandra_format_test.cc
Original file line number Diff line number Diff line change
@@ -380,7 +380,7 @@ EST(ParitionDeletionTest, Supersedes) {

void AssertRoundTrip(PartitionDeletions& pds) {
std::string value;
PartitionDeletion::Serialize(pds, &value);
PartitionDeletion::Serialize(std::move(pds), &value);
PartitionDeletions deserialized =
PartitionDeletion::Deserialize(value.data(), value.size());
EXPECT_EQ(pds.size(), deserialized.size());
@@ -392,57 +392,59 @@ void AssertRoundTrip(PartitionDeletions& pds) {
TEST(ParitionDeletionTest, Serialization) {
PartitionDeletions pds;
AssertRoundTrip(pds);
pds.push_back(std::make_shared<PartitionDeletion>(Slice("a"), 100, 200));
pds.push_back(pd_make_unique(Slice("a"), 100, 200));
AssertRoundTrip(pds);
pds.push_back(std::make_shared<PartitionDeletion>(Slice("b"), 0, 0));
pds.push_back(pd_make_unique(Slice("b"), 0, 0));
AssertRoundTrip(pds);
pds.push_back(PartitionDeletion::kDefault);
pds.push_back(pd_make_unique(Slice("abc"),
std::numeric_limits<int32_t>::max(),
std::numeric_limits<int64_t>::min()));
AssertRoundTrip(pds);
}

TEST(ParitionDeletionTest, MergeEmpty) {
PartitionDeletions pds;
EXPECT_EQ(PartitionDeletions(), PartitionDeletion::Merge(pds));
EXPECT_EQ(PartitionDeletions(),
PartitionDeletion::Merge(PartitionDeletions()));
}

TEST(ParitionDeletionTest, MergeSingle) {
auto pd0 = std::make_shared<PartitionDeletion>(Slice("a"), 100, 200);
PartitionDeletion pd0(Slice("a"), 100, 200);
PartitionDeletions pds;
pds.push_back(pd0);
PartitionDeletions merged = PartitionDeletion::Merge(pds);
pds.push_back(pd_make_unique(pd0));
PartitionDeletions merged = PartitionDeletion::Merge(std::move(pds));
EXPECT_EQ(1, merged.size());
EXPECT_EQ(merged[0], pd0);
EXPECT_EQ(pd0, *merged[0]);
}

TEST(ParitionDeletionTest, MergeSinglePKKeepLast) {
auto pd0 = std::make_shared<PartitionDeletion>(Slice("a"), 100, 200);
auto pd1 = std::make_shared<PartitionDeletion>(Slice("a"), 101, 300);
auto pd2 = std::make_shared<PartitionDeletion>(Slice("a"), 100, 300);
PartitionDeletion pd0(Slice("a"), 100, 200);
PartitionDeletion pd1(Slice("a"), 101, 300);
PartitionDeletion pd2(Slice("a"), 100, 300);

PartitionDeletions pds;
pds.push_back(pd0);
pds.push_back(pd1);
pds.push_back(pd2);
pds.push_back(pd_make_unique(pd0));
pds.push_back(pd_make_unique(pd1));
pds.push_back(pd_make_unique(pd2));

PartitionDeletions merged = PartitionDeletion::Merge(pds);
PartitionDeletions merged = PartitionDeletion::Merge(std::move(pds));
EXPECT_EQ(1, merged.size());
EXPECT_EQ(merged[0], pd1);
EXPECT_EQ(pd1, *merged[0]);
}

TEST(ParitionDeletionTest, MergeKeepLastestDeletionPerPK) {
auto pd0 = std::make_shared<PartitionDeletion>(Slice("a"), 100, 200);
auto pd1 = std::make_shared<PartitionDeletion>(Slice("b"), 100, 200);
auto pd2 = std::make_shared<PartitionDeletion>(Slice("a"), 101, 300);
auto pd3 = std::make_shared<PartitionDeletion>(Slice("a"), 100, 300);
PartitionDeletion pd0(Slice("a"), 100, 200);
PartitionDeletion pd1(Slice("b"), 100, 200);
PartitionDeletion pd2(Slice("a"), 101, 300);
PartitionDeletion pd3(Slice("a"), 100, 300);
PartitionDeletions pds;
pds.push_back(pd0);
pds.push_back(pd1);
pds.push_back(pd2);
pds.push_back(pd3);
PartitionDeletions merged = PartitionDeletion::Merge(pds);
pds.push_back(pd_make_unique(pd0));
pds.push_back(pd_make_unique(pd1));
pds.push_back(pd_make_unique(pd2));
pds.push_back(pd_make_unique(pd3));
PartitionDeletions merged = PartitionDeletion::Merge(std::move(pds));
EXPECT_EQ(2, merged.size());
EXPECT_EQ(merged[0], pd2);
EXPECT_EQ(merged[1], pd1);
EXPECT_EQ(pd2, *merged[0]);
EXPECT_EQ(pd1, *merged[1]);
}
} // namespace cassandra
} // namespace ROCKSDB_NAMESPACE
6 changes: 3 additions & 3 deletions utilities/cassandra/cassandra_functional_test.cc
Original file line number Diff line number Diff line change
@@ -52,10 +52,10 @@ class CassandraStore {
Slice partition_key(partition_key_with_token.data() + token_length_,
partition_key_with_token.size() - token_length_);
PartitionDeletions pds;
pds.push_back(std::make_shared<PartitionDeletion>(
partition_key, local_deletion_time, marked_for_delete_at));
pds.push_back(std::unique_ptr<PartitionDeletion>(new PartitionDeletion(
partition_key, local_deletion_time, marked_for_delete_at)));
std::string val;
PartitionDeletion::Serialize(pds, &val);
PartitionDeletion::Serialize(std::move(pds), &val);
Slice valslice(val.data(), val.size());

auto s = db_->Merge(write_option_, meta_cf_handle_, token, valslice);