Skip to content

Commit

Permalink
ENG-3152: (#141) DocDB filtering on minor compactions
Browse files Browse the repository at this point in the history
Summary:
Allow DocDB filtering on minor compactions, and add tests for minor compactions specifically.

Also, instead of treating expired values as tombstones at expiration hybrid time, with this change we'll be treating them as tombstones at the original hybrid time. This removes the need for special handling of collection init markers, because expiration of a collection init marker will no longer hide its sub-keys that have not expired or don't have a TTL.

Test Plan: Jenkins

Reviewers: sergei, pritam.damania, rahuldesirazu

Reviewed By: pritam.damania

Subscribers: kannan, ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D4550
  • Loading branch information
mbautin committed Apr 10, 2018
1 parent 08762c7 commit 1796740
Show file tree
Hide file tree
Showing 25 changed files with 729 additions and 280 deletions.
12 changes: 12 additions & 0 deletions src/yb/common/hybrid_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class HybridTime {
default:
return false;
}
LOG(FATAL) << "Should never happen";
return false; // Never reached.
}

bool operator <(const HybridTime& other) const {
Expand Down Expand Up @@ -242,6 +244,16 @@ inline std::ostream &operator <<(std::ostream &o, const HybridTime &hybridTime)
return o << hybridTime.ToString();
}

namespace hybrid_time_literals {

inline HybridTime operator "" _usec_ht(unsigned long long microseconds) { // NOLINT
return HybridTime::FromMicros(microseconds);
}

} // namespace hybrid_time_literals

using hybrid_time_literals::operator"" _usec_ht;

} // namespace yb

#endif // YB_COMMON_HYBRID_TIME_H_
8 changes: 4 additions & 4 deletions src/yb/docdb/doc_operation-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void DocOperationRangeFilterTest::TestWithSortingType(ColumnSchema::SortingType
{ row.k, row.r, row.v },
1000,
t);
ASSERT_OK(FlushRocksDB());
ASSERT_OK(FlushRocksDbAndWait());
}
std::vector<rocksdb::LiveFileMetaData> live_files;
rocksdb()->GetLiveFilesMetaData(&live_files);
Expand Down Expand Up @@ -651,7 +651,7 @@ SubDocKey(DocKey(0x0000, [1], []), [ColumnId(2); HT{ physical: 1000 w: 2 }]) ->
SubDocKey(DocKey(0x0000, [1], []), [ColumnId(3); HT{ physical: 1000 w: 3 }]) -> 3; ttl: 1.000s
)#");

CompactHistoryBefore(t1);
FullyCompactHistoryBefore(t1);

// Verify all entries are purged.
AssertDocDbDebugDumpStrEq(R"#(
Expand Down Expand Up @@ -697,7 +697,7 @@ SubDocKey(DocKey(0x0000, [1], []), [ColumnId(3); HT{ physical: 1000 logical: 1 w
SubDocKey(DocKey(0x0000, [1], []), [ColumnId(3); HT{ physical: 1000 w: 3 }]) -> 3; ttl: 1.000s
)#");

CompactHistoryBefore(t1);
FullyCompactHistoryBefore(t1);

// Verify the rest of the columns still live.
AssertDocDbDebugDumpStrEq(R"#(
Expand Down Expand Up @@ -746,7 +746,7 @@ size_t GenerateFiles(int total_batches, DocOperationTest* test) {
test->WriteQLRow(
QLWriteRequestPB_QLStmtType_QL_STMT_INSERT, schema, {j, j, j, j}, 1000000, t0);
}
EXPECT_OK(test->FlushRocksDB());
EXPECT_OK(test->FlushRocksDbAndWait());
}
return expected_files;
}
Expand Down
Loading

0 comments on commit 1796740

Please sign in to comment.