Skip to content

Commit

Permalink
GS_RangeTsAndDelKeyInMutableCoveringImm passes
Browse files Browse the repository at this point in the history
  • Loading branch information
udi-speedb committed Feb 4, 2024
1 parent 5f60013 commit 90d67cc
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions db/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
#include "util/string_util.h"
#include "utilities/merge_operators.h"

#define RUN_ALL_GS_TESTS 0

#define CALL_WRAPPER(func) \
func; \
ASSERT_FALSE(HasFailure());
Expand Down Expand Up @@ -7624,7 +7626,7 @@ TEST_F(DBTest, StaticPinningLastLevelWithData) {
using DelElem = spdb_gs::DelElement;

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#if 0
#if RUN_ALL_GS_TESTS

// TODO: Write unit-tests for the gs-utils funtions
class GsUtilsTest : public ::testing::Test {};
Expand Down Expand Up @@ -7912,7 +7914,7 @@ class DBGsTest : public DBTest {
};

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#if 0
#if RUN_ALL_GS_TESTS

TEST_F(DBGsTest, GS_EmptyDB) {
ReopenNewDb();
Expand Down Expand Up @@ -7989,6 +7991,18 @@ TEST_F(DBGsTest, GS_SingleValueOlderThanDRWithOverlap) {
GetSmallestAndValidate("");
}

TEST_F(DBGsTest, GS_RangeTsOverlapsDelKey) {
ReopenNewDb();

auto dflt_cfh = dbfull()->DefaultColumnFamily();

ASSERT_OK(dbfull()->Put(WriteOptions(), "c", "Value"));
ASSERT_OK(dbfull()->Delete(WriteOptions(), "c"));
ASSERT_OK(dbfull()->DeleteRange(WriteOptions(), dflt_cfh, "a", "z"));

GetSmallestAndValidate("");
}

// K1
// | DR |
// K2
Expand Down Expand Up @@ -8115,7 +8129,6 @@ TEST_F(DBGsTest, GS_RangeTsInImmNotCoveringValueInMutable) {
CALL_WRAPPER(GetSmallestAndValidate("a"));
}


TEST_F(DBGsTest, GS_DelKeyInImmSameAsValueInMutable) {
ReopenNewDb();
auto dflt_cfh = dbfull()->DefaultColumnFamily();
Expand All @@ -8127,8 +8140,6 @@ TEST_F(DBGsTest, GS_DelKeyInImmSameAsValueInMutable) {

CALL_WRAPPER(GetSmallestAndValidate("c"));
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#endif

TEST_F(DBGsTest, GS_DelKeyInMutableSameAsValueInImm) {
ReopenNewDb();
Expand All @@ -8142,6 +8153,35 @@ TEST_F(DBGsTest, GS_DelKeyInMutableSameAsValueInImm) {
CALL_WRAPPER(GetSmallestAndValidate("x"));
}

TEST_F(DBGsTest, GS_RangeTsAndDelKeyInImmCoveringInMutable) {
ReopenNewDb();
auto dflt_cfh = dbfull()->DefaultColumnFamily();

ASSERT_OK(dbfull()->Delete(WriteOptions(), dflt_cfh, "c"));
ASSERT_OK(dbfull()->DeleteRange(WriteOptions(), dflt_cfh, "k", "z"));
ASSERT_OK(dbfull()->TEST_SwitchMemtable());
ASSERT_OK(dbfull()->Put(WriteOptions(), "x", "b1"));
ASSERT_OK(dbfull()->Put(WriteOptions(), "c", "a1"));

CALL_WRAPPER(GetSmallestAndValidate("c"));
}

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#endif

TEST_F(DBGsTest, GS_RangeTsAndDelKeyInMutableCoveringImm) {
ReopenNewDb();
auto dflt_cfh = dbfull()->DefaultColumnFamily();

ASSERT_OK(dbfull()->Put(WriteOptions(), "x", "b1"));
ASSERT_OK(dbfull()->Put(WriteOptions(), "c", "a1"));
ASSERT_OK(dbfull()->TEST_SwitchMemtable());
ASSERT_OK(dbfull()->Delete(WriteOptions(), dflt_cfh, "c"));
ASSERT_OK(dbfull()->DeleteRange(WriteOptions(), dflt_cfh, "k", "z"));

CALL_WRAPPER(GetSmallestAndValidate(""));
}

} // namespace ROCKSDB_NAMESPACE

int main(int argc, char** argv) {
Expand Down

0 comments on commit 90d67cc

Please sign in to comment.