|
29 | 29 | // Testcases ////////////////////////////////////////////////////////////////// |
30 | 30 |
|
31 | 31 | static enum test_result test_create_new_checkpoint(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) { |
32 | | - // Inserting more than 500 items will cause a new open checkpoint with id 2 |
33 | | - // to be created. |
| 32 | + // Inserting more than 5 items (see testcase config) will cause a new open |
| 33 | + // checkpoint with id 2 to be created. |
34 | 34 |
|
35 | | - for (int j = 0; j < 600; ++j) { |
36 | | - std::stringstream ss; |
37 | | - ss << "key" << j; |
38 | | - item *i; |
39 | | - checkeq(ENGINE_SUCCESS, |
40 | | - store(h, h1, NULL, OPERATION_SET, ss.str().c_str(), |
41 | | - ss.str().c_str(), &i, 0, 0), |
42 | | - "Failed to store a value"); |
43 | | - h1->release(h, i); |
44 | | - } |
| 35 | + write_items(h, h1, 5); |
| 36 | + wait_for_flusher_to_settle(h, h1); |
| 37 | + |
| 38 | + checkeq(1, |
| 39 | + get_int_stat( |
| 40 | + h, h1, "vb_0:last_closed_checkpoint_id", "checkpoint 0"), |
| 41 | + "Last closed checkpoint Id for VB 0 should still be 1 after " |
| 42 | + "storing 50 items"); |
| 43 | + |
| 44 | + // Store 1 more - should push it over to the next checkpoint. |
| 45 | + write_items(h, h1, 1, 5); |
| 46 | + wait_for_flusher_to_settle(h, h1); |
| 47 | + |
| 48 | + checkeq(2, |
| 49 | + get_int_stat( |
| 50 | + h, h1, "vb_0:last_closed_checkpoint_id", "checkpoint 0"), |
| 51 | + "Last closed checkpoint Id for VB 0 should increase to 2 after " |
| 52 | + "storing 51 items"); |
45 | 53 |
|
46 | 54 | createCheckpoint(h, h1); |
47 | 55 | checkeq(PROTOCOL_BINARY_RESPONSE_SUCCESS, last_status.load(), |
@@ -257,7 +265,7 @@ BaseTestCase testsuite_testcases[] = { |
257 | 265 | test_create_new_checkpoint, |
258 | 266 | test_setup, |
259 | 267 | teardown, |
260 | | - "chk_max_items=500;item_num_based_new_chk=true", |
| 268 | + "chk_max_items=5;item_num_based_new_chk=true", |
261 | 269 | prepare, |
262 | 270 | cleanup), |
263 | 271 | TestCase("checkpoint: validate checkpoint config params", |
|
0 commit comments