Skip to content

Commit aed6bcf

Browse files
committed
MB-54553: Remove ::getSuperCheckpointType()
Never used in Prod. Used in a couple of tests where we can easily get rid of it. Simplifying the CheckpointType class in preparetion for changes to it. Change-Id: I8f84ff5a9499aff1858f53c5e58dc0049e2f3774 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/185149 Well-Formed: Restriction Checker Reviewed-by: Jim Walker <[email protected]> Tested-by: Paolo Cocchi <[email protected]>
1 parent 157d5c4 commit aed6bcf

File tree

4 files changed

+25
-38
lines changed

4 files changed

+25
-38
lines changed

engines/ep/src/ep_types.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ bool isDiskCheckpointType(CheckpointType type) {
1919
return type == CheckpointType::InitialDisk || type == CheckpointType::Disk;
2020
}
2121

22-
CheckpointType getSuperCheckpointType(CheckpointType type) {
23-
switch (type) {
24-
// Supertypes.
25-
case CheckpointType::Disk:
26-
case CheckpointType::Memory:
27-
return type;
28-
// Subtypes.
29-
case CheckpointType::InitialDisk:
30-
return CheckpointType::Disk;
31-
}
32-
folly::assume_unreachable();
33-
}
34-
3522
GenerateBySeqno getGenerateBySeqno(const OptionalSeqno& seqno) {
3623
return seqno ? GenerateBySeqno::No : GenerateBySeqno::Yes;
3724
}

engines/ep/src/ep_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ enum class CheckpointType : uint8_t {
110110
// Returns true if given type is either a Disk checkpoint or its subtype.
111111
bool isDiskCheckpointType(CheckpointType type);
112112

113-
// A type could logically be a subtype of another. This method returns its
114-
// supertype.
115-
CheckpointType getSuperCheckpointType(CheckpointType type);
116-
117113
enum class ConflictResolutionMode {
118114
/// Resolve conflicts based on document revision id (revid).
119115
RevisionId,

engines/ep/tests/module_tests/dcp_durability_stream_test.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4594,8 +4594,7 @@ void DurabilityPromotionStreamTest::testDiskCheckpointStreamedAsDiskSnapshot() {
45944594
CheckpointType expectedCkptType,
45954595
uint64_t expectedSnapStart,
45964596
uint64_t expectedSnapEnd) -> void {
4597-
ASSERT_EQ(expectedCkptType,
4598-
getSuperCheckpointType(ckptMgr.getOpenCheckpointType()));
4597+
ASSERT_EQ(expectedCkptType, ckptMgr.getOpenCheckpointType());
45994598
auto currSnap = ckptMgr.getSnapshotInfo();
46004599
ASSERT_EQ(expectedSnapStart, currSnap.range.getStart());
46014600
ASSERT_EQ(expectedSnapEnd, currSnap.range.getEnd());
@@ -4605,7 +4604,7 @@ void DurabilityPromotionStreamTest::testDiskCheckpointStreamedAsDiskSnapshot() {
46054604
// test)
46064605
{
46074606
SCOPED_TRACE("");
4608-
checkOpenCheckpoint(CheckpointType::Disk, 2, 4);
4607+
checkOpenCheckpoint(CheckpointType::InitialDisk, 2, 4);
46094608
}
46104609

46114610
// 3) Set up the Producer and ActiveStream
@@ -5057,8 +5056,7 @@ void DurabilityPromotionStreamTest::
50575056
CheckpointType expectedCkptType,
50585057
uint64_t expectedSnapStart,
50595058
uint64_t expectedSnapEnd) -> void {
5060-
ASSERT_EQ(expectedCkptType,
5061-
getSuperCheckpointType(ckptMgr.getOpenCheckpointType()));
5059+
ASSERT_EQ(expectedCkptType, ckptMgr.getOpenCheckpointType());
50625060
auto currSnap = ckptMgr.getSnapshotInfo();
50635061
ASSERT_EQ(expectedSnapStart, currSnap.range.getStart());
50645062
ASSERT_EQ(expectedSnapEnd, currSnap.range.getEnd());
@@ -5074,7 +5072,7 @@ void DurabilityPromotionStreamTest::
50745072
DocumentState::Alive);
50755073

50765074
ASSERT_EQ(1, ckptMgr.getNumCheckpoints());
5077-
checkOpenCheckpoint(CheckpointType::Disk, 1, 2);
5075+
checkOpenCheckpoint(CheckpointType::InitialDisk, 1, 2);
50785076
}
50795077

50805078
// 2) Replica receives PRE:3 and M:4 (logic CMT:4) in a second disk

engines/ep/tests/module_tests/dcp_stream_test.cc

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4761,7 +4761,7 @@ TEST_P(STPassiveStreamPersistentTest, VBStateNotLostAfterFlushFailure) {
47614761
uint64_t maxDelRevSeqno) {
47624762
EXPECT_EQ(lastSnapStart, vbs.lastSnapStart);
47634763
EXPECT_EQ(lastSnapEnd, vbs.lastSnapEnd);
4764-
EXPECT_EQ(type, getSuperCheckpointType(vbs.checkpointType));
4764+
EXPECT_EQ(type, vbs.checkpointType);
47654765
EXPECT_EQ(hps, vbs.highPreparedSeqno);
47664766
EXPECT_EQ(hcs, vbs.persistedCompletedSeqno);
47674767
EXPECT_EQ(maxDelRevSeqno, vbs.maxDeletedSeqno);
@@ -4797,7 +4797,7 @@ TEST_P(STPassiveStreamPersistentTest, VBStateNotLostAfterFlushFailure) {
47974797
// 2) expected (HPS = snapEnd) for complete Disk snap flushed
47984798
checkVBState(3 /*lastSnapStart*/,
47994799
3 /*lastSnapEnd*/,
4800-
CheckpointType::Disk,
4800+
CheckpointType::InitialDisk,
48014801
3 /*HPS*/,
48024802
1 /*HCS*/,
48034803
2 /*maxDelRevSeqno*/);
@@ -4968,7 +4968,7 @@ void STPassiveStreamPersistentTest::checkVBState(uint64_t lastSnapStart,
49684968
auto& vbs = *kvStore.getCachedVBucketState(vbid);
49694969
EXPECT_EQ(lastSnapStart, vbs.lastSnapStart);
49704970
EXPECT_EQ(lastSnapEnd, vbs.lastSnapEnd);
4971-
EXPECT_EQ(type, getSuperCheckpointType(vbs.checkpointType));
4971+
EXPECT_EQ(type, vbs.checkpointType);
49724972
EXPECT_EQ(hps, vbs.highPreparedSeqno);
49734973
EXPECT_EQ(hcs, vbs.persistedCompletedSeqno);
49744974
EXPECT_EQ(maxDelRevSeqno, vbs.maxDeletedSeqno);
@@ -5020,12 +5020,15 @@ TEST_P(STPassiveStreamPersistentTest, DiskSnapWithoutPrepareSetsDiskHPS) {
50205020
// send it from the active. We instead move the HPS to the snapshot end
50215021
// (both on disk and in memory) which is 4 in this case due to changes made
50225022
// as part of MB-34873.
5023-
checkVBState(4 /*lastSnapStart*/,
5024-
4 /*lastSnapEnd*/,
5025-
CheckpointType::Disk,
5026-
4 /*HPS*/,
5027-
2 /*HCS*/,
5028-
0 /*maxDelRevSeqno*/);
5023+
{
5024+
SCOPED_TRACE("");
5025+
checkVBState(4 /*lastSnapStart*/,
5026+
4 /*lastSnapEnd*/,
5027+
CheckpointType::InitialDisk,
5028+
4 /*HPS*/,
5029+
2 /*HCS*/,
5030+
0 /*maxDelRevSeqno*/);
5031+
}
50295032

50305033
EXPECT_EQ(4, store->getVBucket(vbid)->getHighPreparedSeqno());
50315034

@@ -5092,12 +5095,15 @@ TEST_P(STPassiveStreamPersistentTest, DiskSnapWithPrepareSetsHPSToSnapEnd) {
50925095

50935096
flushVBucketToDiskIfPersistent(vbid, 4);
50945097

5095-
checkVBState(6 /*lastSnapStart*/,
5096-
6 /*lastSnapEnd*/,
5097-
CheckpointType::Disk,
5098-
6 /*HPS*/,
5099-
2 /*HCS*/,
5100-
0 /*maxDelRevSeqno*/);
5098+
{
5099+
SCOPED_TRACE("");
5100+
checkVBState(6 /*lastSnapStart*/,
5101+
6 /*lastSnapEnd*/,
5102+
CheckpointType::InitialDisk,
5103+
6 /*HPS*/,
5104+
2 /*HCS*/,
5105+
0 /*maxDelRevSeqno*/);
5106+
}
51015107
}
51025108

51035109
INSTANTIATE_TEST_SUITE_P(Persistent,

0 commit comments

Comments
 (0)