@@ -52,7 +52,7 @@ void CheckpointTest::SetUp() {
5252 // EagerCheckpointDisposalTest covers eager tests.
5353 config.parseConfiguration (" checkpoint_removal_mode=lazy" ,
5454 get_mock_server_api ());
55- recreateCheckpointConfig ( );
55+ checkpoint_config = CheckpointConfig (config );
5656 VBucketTest::SetUp ();
5757 createManager ();
5858}
@@ -61,20 +61,6 @@ void CheckpointTest::TearDown() {
6161 VBucketTest::TearDown ();
6262}
6363
64- void CheckpointTest::recreateCheckpointConfig () {
65- checkpoint_config = CheckpointConfig (
66- DEFAULT_CHECKPOINT_PERIOD,
67- DEFAULT_CHECKPOINT_ITEMS,
68- config.getMaxCheckpoints (),
69- true /* itemNumBasedNewCheckpoint*/ ,
70- (getVbType () == VBType::Persistent ? true
71- : false ) /* persistenceEnabled*/ ,
72- config.getCheckpointRemovalMode () ==
73- ::to_string (CheckpointRemoval::Eager)
74- ? CheckpointRemoval::Eager
75- : CheckpointRemoval::Lazy);
76- }
77-
7864void CheckpointTest::createManager (int64_t lastSeqno) {
7965 ASSERT_TRUE (vbucket);
8066 range = {0 , 0 };
@@ -412,13 +398,8 @@ TEST_P(CheckpointTest, getItems_MemoryDiskSnapshots) {
412398TEST_P (CheckpointTest, ItemBasedCheckpointCreation) {
413399 // Size down the default number of items to create a new checkpoint and
414400 // recreate the manager
415- this ->checkpoint_config =
416- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
417- MIN_CHECKPOINT_ITEMS,
418- /* numCheckpoints*/ 2 ,
419- /* itemBased*/ true ,
420- persistent () /* persistenceEnabled*/ ,
421- CheckpointRemoval::Lazy);
401+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
402+ checkpoint_config = CheckpointConfig (config);
422403 createManager ();
423404
424405 // Create one less than the number required to create a new checkpoint.
@@ -570,15 +551,12 @@ TEST_P(CheckpointTest, CursorOffsetOnCheckpointClose) {
570551
571552// Test the getNextItemsForCursor()
572553TEST_P (CheckpointTest, ItemsForCheckpointCursor) {
573- // We want to have items across 2 checkpoints. Size down the default number
574- // of items to create a new checkpoint and recreate the manager.
575- this ->checkpoint_config =
576- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
577- MIN_CHECKPOINT_ITEMS,
578- /* numCheckpoints*/ 2 ,
579- /* itemBased*/ true ,
580- persistent () /* persistenceEnabled*/ ,
581- CheckpointRemoval::Lazy);
554+ // Size down the default number of items to create a new checkpoint and
555+ // recreate the manager.
556+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
557+ checkpoint_config = CheckpointConfig (config);
558+ // Also, we want to have items across 2 checkpoints.
559+ ASSERT_EQ (2 , checkpoint_config.getMaxCheckpoints ());
582560 createManager ();
583561
584562 /* Add items such that we have 2 checkpoints */
@@ -629,15 +607,12 @@ TEST_P(CheckpointTest, ItemsForCheckpointCursor) {
629607// Test getNextItemsForCursor() when it is limited to fewer items than exist
630608// in total. Cursor should only advanced to the start of the 2nd checkpoint.
631609TEST_P (CheckpointTest, ItemsForCheckpointCursorLimited) {
632- /* We want to have items across 2 checkpoints. Size down the default number
633- of items to create a new checkpoint and recreate the manager */
634- this ->checkpoint_config =
635- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
636- MIN_CHECKPOINT_ITEMS,
637- /* numCheckpoints*/ 2 ,
638- /* itemBased*/ true ,
639- persistent () /* persistenceEnabled*/ ,
640- CheckpointRemoval::Lazy);
610+ // Size down the default number of items to create a new checkpoint and
611+ // recreate the manager.
612+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
613+ checkpoint_config = CheckpointConfig (config);
614+ // Also, we want to have items across 2 checkpoints.
615+ ASSERT_EQ (2 , checkpoint_config.getMaxCheckpoints ());
641616 createManager ();
642617
643618 /* Add items such that we have 2 checkpoints */
@@ -672,15 +647,12 @@ TEST_P(CheckpointTest, DiskCheckpointStrictItemLimit) {
672647 if (!persistent ()) {
673648 return ;
674649 }
675- /* We want to have items across 2 checkpoints. Size down the default number
676- of items to create a new checkpoint and recreate the manager */
677- this ->checkpoint_config =
678- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
679- MIN_CHECKPOINT_ITEMS,
680- /* numCheckpoints*/ 2 ,
681- /* itemBased*/ true ,
682- persistent () /* persistenceEnabled*/ ,
683- CheckpointRemoval::Lazy);
650+ // Size down the default number of items to create a new checkpoint and
651+ // recreate the manager.
652+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
653+ checkpoint_config = CheckpointConfig (config);
654+ // Also, we want to have items across 2 checkpoints.
655+ ASSERT_EQ (2 , checkpoint_config.getMaxCheckpoints ());
684656 createManager ();
685657
686658 // Force the first checkpoint to be a disk one
@@ -716,15 +688,12 @@ TEST_P(CheckpointTest, DiskCheckpointStrictItemLimit) {
716688
717689// Test the checkpoint cursor movement
718690TEST_P (CheckpointTest, CursorMovement) {
719- /* We want to have items across 2 checkpoints. Size down the default number
720- of items to create a new checkpoint and recreate the manager */
721- this ->checkpoint_config =
722- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
723- MIN_CHECKPOINT_ITEMS,
724- /* numCheckpoints*/ 2 ,
725- /* itemBased*/ true ,
726- persistent () /* persistenceEnabled*/ ,
727- CheckpointRemoval::Lazy);
691+ // Size down the default number of items to create a new checkpoint and
692+ // recreate the manager.
693+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
694+ checkpoint_config = CheckpointConfig (config);
695+ // Also, we want to have items across 2 checkpoints.
696+ ASSERT_EQ (2 , checkpoint_config.getMaxCheckpoints ());
728697 createManager ();
729698
730699 /* Add items such that we have 1 full (max items as per config) checkpoint.
@@ -833,13 +802,11 @@ TEST_P(CheckpointTest, SeqnoAndHLCOrdering) {
833802 // configure with 1 checkpoint to ensure the time-based closing
834803 // does not split the items over many checkpoints and muddy the final
835804 // data checks.
836- this ->checkpoint_config =
837- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
838- n_threads * n_items,
839- /* numCheckpoints*/ 2 ,
840- /* itemBased*/ true ,
841- persistent () /* persistenceEnabled*/ ,
842- CheckpointRemoval::Lazy);
805+ config.setChkMaxItems (n_threads * n_items);
806+ checkpoint_config = CheckpointConfig (config);
807+ // Also, we want to have items across 2 checkpoints.
808+ ASSERT_EQ (2 , checkpoint_config.getMaxCheckpoints ());
809+
843810 createManager ();
844811
845812 std::vector<std::thread> threads;
@@ -1618,13 +1585,8 @@ TEST_P(CheckpointTest, DuplicateCheckpointCursor) {
16181585TEST_P (CheckpointTest, DuplicateCheckpointCursorDifferentCheckpoints) {
16191586 // Size down the default number of items to create a new checkpoint and
16201587 // recreate the manager
1621- this ->checkpoint_config =
1622- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
1623- MIN_CHECKPOINT_ITEMS,
1624- /* numCheckpoints*/ 2 ,
1625- /* itemBased*/ true ,
1626- persistent () /* persistenceEnabled*/ ,
1627- CheckpointRemoval::Lazy);
1588+ config.setChkMaxItems (MIN_CHECKPOINT_ITEMS);
1589+ checkpoint_config = CheckpointConfig (config);
16281590 createManager ();
16291591
16301592 const auto & ckptList =
@@ -2259,13 +2221,8 @@ TEST_P(CheckpointTest, testDontExpelIfCursorAtMetadataItemWithSameSeqnoDisk) {
22592221// then we will move the expel point backwards to the mutation
22602222// (and possibly further).
22612223void CheckpointTest::testDoNotExpelIfHaveSameSeqnoAfterMutation () {
2262- this ->checkpoint_config =
2263- CheckpointConfig (DEFAULT_CHECKPOINT_PERIOD,
2264- /* maxItemsInCheckpoint*/ 1 ,
2265- /* numCheckpoints*/ 2 ,
2266- /* itemBased*/ true ,
2267- persistent () /* persistenceEnabled*/ ,
2268- CheckpointRemoval::Lazy);
2224+ config.setChkMaxItems (1 );
2225+ checkpoint_config = CheckpointConfig (config);
22692226 createManager ();
22702227
22712228 // Add a meta data operation
@@ -2948,7 +2905,7 @@ class EagerCheckpointDisposalTest : public CheckpointTest {
29482905 // Ensure the checkpoint config is set to that.
29492906 config.parseConfiguration (" checkpoint_removal_mode=eager" ,
29502907 get_mock_server_api ());
2951- recreateCheckpointConfig ( );
2908+ checkpoint_config = CheckpointConfig (config );
29522909 }
29532910};
29542911
0 commit comments