/Users/deen/code/yugabyte-db/src/yb/tablet/tablet-test.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | // |
18 | | // The following only applies to changes made to this file as part of YugaByte development. |
19 | | // |
20 | | // Portions Copyright (c) YugaByte, Inc. |
21 | | // |
22 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
23 | | // in compliance with the License. You may obtain a copy of the License at |
24 | | // |
25 | | // http://www.apache.org/licenses/LICENSE-2.0 |
26 | | // |
27 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
28 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
29 | | // or implied. See the License for the specific language governing permissions and limitations |
30 | | // under the License. |
31 | | // |
32 | | |
33 | | |
34 | | |
35 | | |
36 | | |
37 | | |
38 | | // Include client header so we can access YBTableType. |
39 | | |
40 | | #include <time.h> |
41 | | |
42 | | #include <glog/logging.h> |
43 | | |
44 | | #include "yb/client/table.h" |
45 | | |
46 | | #include "yb/common/ql_expr.h" |
47 | | |
48 | | #include "yb/docdb/ql_rowwise_iterator_interface.h" |
49 | | |
50 | | #include "yb/gutil/stl_util.h" |
51 | | #include "yb/gutil/strings/join.h" |
52 | | |
53 | | #include "yb/tablet/local_tablet_writer.h" |
54 | | #include "yb/tablet/tablet-test-base.h" |
55 | | #include "yb/tablet/tablet.h" |
56 | | #include "yb/tablet/tablet_bootstrap_if.h" |
57 | | |
58 | | #include "yb/util/enums.h" |
59 | | #include "yb/util/slice.h" |
60 | | #include "yb/util/status_log.h" |
61 | | #include "yb/util/test_macros.h" |
62 | | |
63 | | using std::shared_ptr; |
64 | | using std::unordered_set; |
65 | | |
66 | | namespace yb { |
67 | | namespace tablet { |
68 | | |
69 | | DEFINE_int32(testiterator_num_inserts, 1000, |
70 | | "Number of rows inserted in TestRowIterator/TestInsert"); |
71 | | |
72 | | static_assert(static_cast<int>(to_underlying(TableType::YQL_TABLE_TYPE)) == |
73 | | to_underlying(client::YBTableType::YQL_TABLE_TYPE), |
74 | | "Numeric code for YQL_TABLE_TYPE table type must be consistent"); |
75 | | static_assert(static_cast<int>(to_underlying(TableType::REDIS_TABLE_TYPE)) == |
76 | | to_underlying(client::YBTableType::REDIS_TABLE_TYPE), |
77 | | "Numeric code for REDIS_TABLE_TYPE table type must be consistent"); |
78 | | |
79 | | template<class SETUP> |
80 | | class TestTablet : public TabletTestBase<SETUP> { |
81 | | typedef SETUP Type; |
82 | | }; |
83 | | TYPED_TEST_CASE(TestTablet, TabletTestHelperTypes); |
84 | | |
85 | | // Test that inserting a row which already exists causes an AlreadyPresent |
86 | | // error |
87 | 6 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { |
88 | 6 | LocalTabletWriter writer(this->tablet().get()); |
89 | | |
90 | 6 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); |
91 | | |
92 | | // Insert again, should not fail! |
93 | 6 | Status s = this->InsertTestRow(&writer, 12345, 0); |
94 | 6 | ASSERT_OK(s); |
95 | | |
96 | 6 | s = this->InsertTestRow(&writer, 12345, 0); |
97 | 6 | ASSERT_OK(s); |
98 | 6 | } _ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_18StringKeyTestSetupEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
_ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
_ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
_ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
_ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
_ZN2yb6tablet38TestTablet_TestInsertDuplicateKey_TestINS0_22NullableValueTestSetupEE8TestBodyEv Line | Count | Source | 87 | 1 | TYPED_TEST(TestTablet, TestInsertDuplicateKey) { | 88 | 1 | LocalTabletWriter writer(this->tablet().get()); | 89 | | | 90 | 1 | CHECK_OK(this->InsertTestRow(&writer, 12345, 0)); | 91 | | | 92 | | // Insert again, should not fail! | 93 | 1 | Status s = this->InsertTestRow(&writer, 12345, 0); | 94 | 1 | ASSERT_OK(s); | 95 | | | 96 | 1 | s = this->InsertTestRow(&writer, 12345, 0); | 97 | 1 | ASSERT_OK(s); | 98 | 1 | } |
|
99 | | |
100 | | |
101 | | template<class SETUP> |
102 | 2.06k | bool TestSetupExpectsNulls(int32_t key_idx) { |
103 | 2.06k | return false; |
104 | 2.06k | } _ZN2yb6tablet21TestSetupExpectsNullsINS0_18StringKeyTestSetupEEEbi Line | Count | Source | 102 | 500 | bool TestSetupExpectsNulls(int32_t key_idx) { | 103 | 500 | return false; | 104 | 500 | } |
_ZN2yb6tablet21TestSetupExpectsNullsINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEEEbi Line | Count | Source | 102 | 63 | bool TestSetupExpectsNulls(int32_t key_idx) { | 103 | 63 | return false; | 104 | 63 | } |
_ZN2yb6tablet21TestSetupExpectsNullsINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEEEbi Line | Count | Source | 102 | 500 | bool TestSetupExpectsNulls(int32_t key_idx) { | 103 | 500 | return false; | 104 | 500 | } |
_ZN2yb6tablet21TestSetupExpectsNullsINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEEEbi Line | Count | Source | 102 | 500 | bool TestSetupExpectsNulls(int32_t key_idx) { | 103 | 500 | return false; | 104 | 500 | } |
_ZN2yb6tablet21TestSetupExpectsNullsINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEEEbi Line | Count | Source | 102 | 500 | bool TestSetupExpectsNulls(int32_t key_idx) { | 103 | 500 | return false; | 104 | 500 | } |
|
105 | | |
106 | | template<> |
107 | 500 | bool TestSetupExpectsNulls<NullableValueTestSetup>(int32_t key_idx) { |
108 | | // If it's a row that the test updates, then we should expect null |
109 | | // based on whether it updated to NULL or away from NULL. |
110 | 500 | bool should_update = (key_idx % 2 == 1); |
111 | 500 | if (should_update) { |
112 | 500 | return (key_idx % 10 == 1); |
113 | 500 | } |
114 | | |
115 | | // Otherwise, expect whatever was inserted. |
116 | 0 | return NullableValueTestSetup::ShouldInsertAsNull(key_idx); |
117 | 0 | } |
118 | | |
119 | | // Test iterating over a tablet after updates to many of the existing rows. |
120 | 6 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { |
121 | 6 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); |
122 | | |
123 | | // Put a row in (insert and flush). |
124 | 6 | LocalTabletWriter writer(this->tablet().get()); |
125 | 5.13k | for (int32_t i = 0; i < max_rows; i++) { |
126 | 5.12k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); |
127 | 5.12k | } |
128 | 6 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; |
129 | | |
130 | | // Update a subset of the rows |
131 | 5.13k | for (int32_t i = 0; i < max_rows; i++) { |
132 | 5.12k | bool should_update = (i % 2 == 1); |
133 | 5.12k | if (!should_update) continue; |
134 | | |
135 | 2.56k | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); |
136 | 2.56k | if (set_to_null) { |
137 | 100 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); |
138 | 2.46k | } else { |
139 | 2.46k | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); |
140 | 2.46k | } |
141 | 2.56k | } |
142 | | |
143 | | // Collect the expected rows. |
144 | 6 | vector<string> rows; |
145 | 6 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); |
146 | 6 | ASSERT_EQ(max_rows, rows.size()); |
147 | 6 | } _ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_18StringKeyTestSetupEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 126 | 1.00k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 1.00k | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 132 | 1.00k | bool should_update = (i % 2 == 1); | 133 | 1.00k | if (!should_update) continue; | 134 | | | 135 | 500 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 500 | if (set_to_null) { | 137 | 0 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 500 | } else { | 139 | 500 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 500 | } | 141 | 500 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
_ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 127 | for (int32_t i = 0; i < max_rows; i++) { | 126 | 126 | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 126 | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 127 | for (int32_t i = 0; i < max_rows; i++) { | 132 | 126 | bool should_update = (i % 2 == 1); | 133 | 126 | if (!should_update) continue; | 134 | | | 135 | 63 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 63 | if (set_to_null) { | 137 | 0 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 63 | } else { | 139 | 63 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 63 | } | 141 | 63 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
_ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 126 | 1.00k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 1.00k | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 132 | 1.00k | bool should_update = (i % 2 == 1); | 133 | 1.00k | if (!should_update) continue; | 134 | | | 135 | 500 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 500 | if (set_to_null) { | 137 | 0 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 500 | } else { | 139 | 500 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 500 | } | 141 | 500 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
_ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 126 | 1.00k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 1.00k | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 132 | 1.00k | bool should_update = (i % 2 == 1); | 133 | 1.00k | if (!should_update) continue; | 134 | | | 135 | 500 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 500 | if (set_to_null) { | 137 | 0 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 500 | } else { | 139 | 500 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 500 | } | 141 | 500 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
_ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 126 | 1.00k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 1.00k | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 132 | 1.00k | bool should_update = (i % 2 == 1); | 133 | 1.00k | if (!should_update) continue; | 134 | | | 135 | 500 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 500 | if (set_to_null) { | 137 | 0 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 500 | } else { | 139 | 500 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 500 | } | 141 | 500 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
_ZN2yb6tablet38TestTablet_TestRowIteratorComplex_TestINS0_22NullableValueTestSetupEE8TestBodyEv Line | Count | Source | 120 | 1 | TYPED_TEST(TestTablet, TestRowIteratorComplex) { | 121 | 1 | int32_t max_rows = this->ClampRowCount(FLAGS_testiterator_num_inserts); | 122 | | | 123 | | // Put a row in (insert and flush). | 124 | 1 | LocalTabletWriter writer(this->tablet().get()); | 125 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 126 | 1.00k | ASSERT_OK_FAST(this->InsertTestRow(&writer, i, 0)); | 127 | 1.00k | } | 128 | 1 | LOG(INFO) << "Successfully inserted " << max_rows << " rows"; | 129 | | | 130 | | // Update a subset of the rows | 131 | 1.00k | for (int32_t i = 0; i < max_rows; i++) { | 132 | 1.00k | bool should_update = (i % 2 == 1); | 133 | 1.00k | if (!should_update) continue; | 134 | | | 135 | 500 | bool set_to_null = TestSetupExpectsNulls<TypeParam>(i); | 136 | 500 | if (set_to_null) { | 137 | 100 | ASSERT_OK_FAST(this->UpdateTestRowToNull(&writer, i)); | 138 | 400 | } else { | 139 | 400 | ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i)); | 140 | 400 | } | 141 | 500 | } | 142 | | | 143 | | // Collect the expected rows. | 144 | 1 | vector<string> rows; | 145 | 1 | ASSERT_OK(yb::tablet::DumpTablet(*this->tablet(), this->client_schema_, &rows)); | 146 | 1 | ASSERT_EQ(max_rows, rows.size()); | 147 | 1 | } |
|
148 | | |
149 | | // Test that when a row has been updated many times, it always yields |
150 | | // the most recent value. |
151 | 6 | TYPED_TEST(TestTablet, TestMultipleUpdates) { |
152 | | // Insert and update same row several times. |
153 | 6 | LocalTabletWriter writer(this->tablet().get()); |
154 | 6 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); |
155 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); |
156 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); |
157 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); |
158 | | |
159 | | // Should see most recent value. |
160 | 6 | vector<string> out_rows; |
161 | 6 | ASSERT_OK(this->IterateToStringList(&out_rows)); |
162 | 6 | ASSERT_EQ(1, out_rows.size()); |
163 | | |
164 | | // Update the row a few times. |
165 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); |
166 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); |
167 | 6 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); |
168 | | |
169 | | // Should still see most recent value. |
170 | 6 | ASSERT_OK(this->IterateToStringList(&out_rows)); |
171 | 6 | ASSERT_EQ(1, out_rows.size()); |
172 | | |
173 | 6 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); |
174 | | |
175 | | // Should still see most recent value. |
176 | 6 | ASSERT_OK(this->IterateToStringList(&out_rows)); |
177 | 6 | ASSERT_EQ(2, out_rows.size()); |
178 | 6 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); |
179 | 6 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); |
180 | 6 | } _ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_18StringKeyTestSetupEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
_ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
_ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
_ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
_ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
_ZN2yb6tablet35TestTablet_TestMultipleUpdates_TestINS0_22NullableValueTestSetupEE8TestBodyEv Line | Count | Source | 151 | 1 | TYPED_TEST(TestTablet, TestMultipleUpdates) { | 152 | | // Insert and update same row several times. | 153 | 1 | LocalTabletWriter writer(this->tablet().get()); | 154 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 0)); | 155 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 1)); | 156 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 2)); | 157 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 3)); | 158 | | | 159 | | // Should see most recent value. | 160 | 1 | vector<string> out_rows; | 161 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 162 | 1 | ASSERT_EQ(1, out_rows.size()); | 163 | | | 164 | | // Update the row a few times. | 165 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 4)); | 166 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 5)); | 167 | 1 | ASSERT_OK(this->UpdateTestRow(&writer, 0, 6)); | 168 | | | 169 | | // Should still see most recent value. | 170 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 171 | 1 | ASSERT_EQ(1, out_rows.size()); | 172 | | | 173 | 1 | CHECK_OK(this->InsertTestRow(&writer, 1, 0)); | 174 | | | 175 | | // Should still see most recent value. | 176 | 1 | ASSERT_OK(this->IterateToStringList(&out_rows)); | 177 | 1 | ASSERT_EQ(2, out_rows.size()); | 178 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(0, 6, false), out_rows[0]); | 179 | 1 | ASSERT_EQ(this->setup_.FormatDebugRow(1, 0, false), out_rows[1]); | 180 | 1 | } |
|
181 | | |
182 | | // Test that metrics behave properly during tablet initialization |
183 | 6 | TYPED_TEST(TestTablet, TestMetricsInit) { |
184 | | // Create a tablet, but do not open it |
185 | 6 | this->CreateTestTablet(); |
186 | 6 | MetricRegistry* registry = this->harness()->metrics_registry(); |
187 | 6 | std::stringstream out; |
188 | 6 | JsonWriter writer(&out, JsonWriter::PRETTY); |
189 | 6 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); |
190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already |
191 | | // existing root. |
192 | 6 | ASSERT_OK(this->harness()->Open()); |
193 | 6 | JsonWriter new_writer(&out, JsonWriter::PRETTY); |
194 | 6 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); |
195 | 6 | } _ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_18StringKeyTestSetupEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
_ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
_ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
_ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
_ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
_ZN2yb6tablet31TestTablet_TestMetricsInit_TestINS0_22NullableValueTestSetupEE8TestBodyEv Line | Count | Source | 183 | 1 | TYPED_TEST(TestTablet, TestMetricsInit) { | 184 | | // Create a tablet, but do not open it | 185 | 1 | this->CreateTestTablet(); | 186 | 1 | MetricRegistry* registry = this->harness()->metrics_registry(); | 187 | 1 | std::stringstream out; | 188 | 1 | JsonWriter writer(&out, JsonWriter::PRETTY); | 189 | 1 | ASSERT_OK(registry->WriteAsJson(&writer, { "*" }, MetricJsonOptions())); | 190 | | // Open tablet, should still work. Need a new writer though, as we should not overwrite an already | 191 | | // existing root. | 192 | 1 | ASSERT_OK(this->harness()->Open()); | 193 | 1 | JsonWriter new_writer(&out, JsonWriter::PRETTY); | 194 | 1 | ASSERT_OK(registry->WriteAsJson(&new_writer, { "*" }, MetricJsonOptions())); | 195 | 1 | } |
|
196 | | |
197 | 6 | TYPED_TEST(TestTablet, TestFlushedOpId) { |
198 | 6 | auto tablet = this->tablet().get(); |
199 | 6 | LocalTabletWriter writer(tablet); |
200 | 6 | const int64_t kCount = 1000; |
201 | | |
202 | | // Insert & flush one row to start index counting. |
203 | 6 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); |
204 | 6 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); |
205 | 6 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; |
206 | 6 | const int64_t start_index = id.index; |
207 | | |
208 | 6 | this->InsertTestRows(1, kCount, 555); |
209 | 6 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; |
210 | 6 | ASSERT_EQ(id.index, start_index); |
211 | | |
212 | 6 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); |
213 | 6 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; |
214 | 6 | ASSERT_EQ(id.index, start_index + kCount); |
215 | | |
216 | 6 | this->InsertTestRows(1, kCount, 777); |
217 | 6 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; |
218 | 6 | ASSERT_EQ(id.index, start_index + kCount); |
219 | | |
220 | 6 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); |
221 | 6 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; |
222 | 6 | ASSERT_EQ(id.index, start_index + 2*kCount); |
223 | 6 | } _ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_18StringKeyTestSetupEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
_ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_15IntKeyTestSetupILNS_8DataTypeE1EEEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
_ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_15IntKeyTestSetupILNS_8DataTypeE2EEEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
_ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_15IntKeyTestSetupILNS_8DataTypeE3EEEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
_ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_15IntKeyTestSetupILNS_8DataTypeE4EEEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
_ZN2yb6tablet31TestTablet_TestFlushedOpId_TestINS0_22NullableValueTestSetupEE8TestBodyEv Line | Count | Source | 197 | 1 | TYPED_TEST(TestTablet, TestFlushedOpId) { | 198 | 1 | auto tablet = this->tablet().get(); | 199 | 1 | LocalTabletWriter writer(tablet); | 200 | 1 | const int64_t kCount = 1000; | 201 | | | 202 | | // Insert & flush one row to start index counting. | 203 | 1 | ASSERT_OK(this->InsertTestRow(&writer, 0, 333)); | 204 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 205 | 1 | OpId id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 206 | 1 | const int64_t start_index = id.index; | 207 | | | 208 | 1 | this->InsertTestRows(1, kCount, 555); | 209 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 210 | 1 | ASSERT_EQ(id.index, start_index); | 211 | | | 212 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 213 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 214 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 215 | | | 216 | 1 | this->InsertTestRows(1, kCount, 777); | 217 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 218 | 1 | ASSERT_EQ(id.index, start_index + kCount); | 219 | | | 220 | 1 | ASSERT_OK(tablet->Flush(FlushMode::kSync)); | 221 | 1 | id = ASSERT_RESULT(tablet->MaxPersistentOpId()).regular; | 222 | 1 | ASSERT_EQ(id.index, start_index + 2*kCount); | 223 | 1 | } |
|
224 | | |
225 | | } // namespace tablet |
226 | | } // namespace yb |