You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2025/04/08 23:01:17 UTC
(kudu) 02/02: [tablet] fix result status handling
This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit d1feb0d69a0a2cd0ba2d6d5a5cc77ac5c148e797
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Thu Mar 27 22:41:59 2025 -0700
[tablet] fix result status handling
This patch addresses sloppy result handling of functions/methods
that return Status under the src/kudu/tablet directory.
Change-Id: Id5407906f2bf65e9a8798233f0280591e6e975cf
Reviewed-on: http://gerrit.cloudera.org:8080/22710
Tested-by: Kudu Jenkins
Reviewed-by: Marton Greber <gr...@gmail.com>
(cherry picked from commit d17ea9f836b650c96cfcc0b9d3c6306fb6843899)
Reviewed-on: http://gerrit.cloudera.org:8080/22758
Reviewed-by: Abhishek Chennaka <ac...@cloudera.com>
Tested-by: Abhishek Chennaka <ac...@cloudera.com>
---
src/kudu/integration-tests/fuzz-itest.cc | 2 +-
.../timestamp_advancement-itest.cc | 10 +++++++--
src/kudu/tablet/all_types-scan-correctness-test.cc | 9 ++++----
src/kudu/tablet/compaction-test.cc | 10 ++++-----
src/kudu/tablet/delta_compaction.cc | 4 ++--
src/kudu/tablet/deltamemstore-test.cc | 2 +-
src/kudu/tablet/deltamemstore.cc | 4 ++--
src/kudu/tablet/diskrowset-test-base.h | 2 +-
src/kudu/tablet/diskrowset.cc | 2 +-
src/kudu/tablet/memrowset.cc | 4 ++--
src/kudu/tablet/mvcc-test.cc | 4 ++--
src/kudu/tablet/ops/participant_op.cc | 8 +++----
src/kudu/tablet/rowset_info.cc | 2 +-
src/kudu/tablet/rowset_tree-test.cc | 2 +-
src/kudu/tablet/rowset_tree.cc | 26 +++++++++++-----------
src/kudu/tablet/tablet-test-base.h | 2 +-
src/kudu/tablet/tablet-test.cc | 21 ++++++++---------
src/kudu/tablet/tablet.cc | 24 ++++++++++----------
src/kudu/tablet/tablet.h | 8 +++----
src/kudu/tablet/tablet_auto_incrementing-test.cc | 8 +++----
src/kudu/tablet/tablet_bootstrap-test.cc | 8 ++++---
src/kudu/tablet/tablet_metadata-test.cc | 9 ++++----
src/kudu/tablet/tablet_metadata.cc | 2 +-
src/kudu/tablet/tablet_replica-test.cc | 12 +++++-----
src/kudu/tablet/tablet_replica.cc | 17 ++++++--------
src/kudu/tablet/tablet_replica.h | 2 +-
src/kudu/tablet/txn_participant-test.cc | 19 ++++++++--------
src/kudu/tablet/txn_participant.h | 8 +++----
28 files changed, 120 insertions(+), 111 deletions(-)
diff --git a/src/kudu/integration-tests/fuzz-itest.cc b/src/kudu/integration-tests/fuzz-itest.cc
index 4e60d6d85..e46e0f023 100644
--- a/src/kudu/integration-tests/fuzz-itest.cc
+++ b/src/kudu/integration-tests/fuzz-itest.cc
@@ -1502,7 +1502,7 @@ void FuzzTest::RunFuzzCase(const vector<TestOp>& test_ops,
break;
}
case TEST_GC_LOG:
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
break;
default:
LOG(FATAL) << test_op.type;
diff --git a/src/kudu/integration-tests/timestamp_advancement-itest.cc b/src/kudu/integration-tests/timestamp_advancement-itest.cc
index 98542f24f..23d391fe6 100644
--- a/src/kudu/integration-tests/timestamp_advancement-itest.cc
+++ b/src/kudu/integration-tests/timestamp_advancement-itest.cc
@@ -21,6 +21,7 @@
#include <memory>
#include <ostream>
#include <string>
+#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
@@ -60,7 +61,6 @@
#include "kudu/tserver/tablet_server.h"
#include "kudu/tserver/ts_tablet_manager.h"
#include "kudu/tserver/tserver.pb.h"
-#include "kudu/tserver/tserver_service.proxy.h"
#include "kudu/util/metrics.h"
#include "kudu/util/monotime.h"
#include "kudu/util/pb_util.h"
@@ -68,6 +68,12 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+namespace kudu {
+namespace tserver {
+class TabletServerServiceProxy;
+} // namespace tserver
+} // namespace kudu
+
DECLARE_bool(enable_maintenance_manager);
DECLARE_bool(compaction_force_small_rowset_tradeoff);
DECLARE_bool(prevent_kudu_2233_corruption);
@@ -251,7 +257,7 @@ class TimestampAdvancementITest : public MiniClusterITestBase {
int64_t gcable_size;
ASSERT_OK(replica->GetGCableDataSize(&gcable_size));
ASSERT_GT(gcable_size, 0);
- ASSERT_OK(replica->RunLogGC());
+ replica->RunLogGC();
// Ensure that we have no writes in our WALs.
bool has_write_replicates;
diff --git a/src/kudu/tablet/all_types-scan-correctness-test.cc b/src/kudu/tablet/all_types-scan-correctness-test.cc
index de3b57c3e..bc4d61526 100644
--- a/src/kudu/tablet/all_types-scan-correctness-test.cc
+++ b/src/kudu/tablet/all_types-scan-correctness-test.cc
@@ -35,6 +35,7 @@
#include "kudu/common/scan_spec.h"
#include "kudu/common/schema.h"
#include "kudu/common/types.h"
+#include "kudu/gutil/basictypes.h"
#include "kudu/gutil/stringprintf.h"
#include "kudu/gutil/strings/substitute.h"
#include "kudu/tablet/local_tablet_writer.h"
@@ -162,10 +163,10 @@ struct NumTypeRowOps : public RowOpsBase {
CHECK_OK(row->SetNull(kColC));
}
} else {
- row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColA, value);
- row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColB, value);
+ CHECK_OK(row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColA, value));
+ CHECK_OK(row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColB, value));
if (altered) {
- row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColC, value);
+ CHECK_OK(row->Set<TypeTraits<KeyTypeWrapper::kType>>(kColC, value));
}
}
}
@@ -364,7 +365,7 @@ public:
default_ptr = rowops_.GenerateElement(read_default);
}
SchemaBuilder builder(*tablet()->metadata()->schema());
- builder.RemoveColumn("val_c");
+ ignore_result(builder.RemoveColumn("val_c"));
ASSERT_OK(builder.AddColumn("val_c", rowops_.type_, true, default_ptr, nullptr));
AlterSchema(builder.Build());
altered_schema_ = Schema({ColumnSchema("key", INT32),
diff --git a/src/kudu/tablet/compaction-test.cc b/src/kudu/tablet/compaction-test.cc
index 1a7a92519..b78d01e94 100644
--- a/src/kudu/tablet/compaction-test.cc
+++ b/src/kudu/tablet/compaction-test.cc
@@ -380,7 +380,7 @@ class TestCompaction : public KuduRowSetTest {
const Schema& projection,
shared_ptr<DiskRowSet>* result_rs) {
vector<shared_ptr<DiskRowSet>> result_rowsets;
- CompactAndReopen(input_rowsets, projection, kLargeRollThreshold, &result_rowsets);
+ ASSERT_OK(CompactAndReopen(input_rowsets, projection, kLargeRollThreshold, &result_rowsets));
ASSERT_EQ(1, result_rowsets.size());
*result_rs = result_rowsets[0];
}
@@ -603,13 +603,13 @@ TEST_F(TestCompaction, TestFlushMRSWithRolling) {
vector<string> rows;
rows.reserve(30000 / 2);
- rowsets[0]->DebugDump(&rows);
+ ASSERT_OK(rowsets[0]->DebugDump(&rows));
EXPECT_EQ("RowIdxInBlock: 0; Base: (string key=\"hello 0000000000\", int64 val=0, "
"int32 nullable_val=0); Undo Mutations: [@1(DELETE)]; Redo Mutations: [];",
rows[0]);
rows.clear();
- rowsets[1]->DebugDump(&rows);
+ ASSERT_OK(rowsets[1]->DebugDump(&rows));
EXPECT_EQ("RowIdxInBlock: 0; Base: (string key=\"hello 0000017150\", int64 val=1715, "
"int32 nullable_val=NULL); Undo Mutations: [@1716(DELETE)]; Redo Mutations: [];",
rows[0]);
@@ -864,13 +864,13 @@ TEST_F(TestCompaction, TestDuplicatedRowsRandomCompaction) {
row->undo_head = reinsert->next();
row->row = block.row(i);
BuildRow(i, i);
- CopyRow(row_builder_.row(), &row->row, &mem.arena);
+ ASSERT_OK(CopyRow(row_builder_.row(), &row->row, &mem.arena));
RowChangeListDecoder redo_decoder(reinsert->changelist());
ASSERT_OK(redo_decoder.Init());
faststring buf;
RowChangeListEncoder dummy(&buf);
dummy.SetToUpdate();
- redo_decoder.MutateRowAndCaptureChanges(&row->row, &mem.arena, &dummy);
+ ASSERT_OK(redo_decoder.MutateRowAndCaptureChanges(&row->row, &mem.arena, &dummy));
AddExpectedDelete(&row->redo_head, reinsert->timestamp());
}
diff --git a/src/kudu/tablet/delta_compaction.cc b/src/kudu/tablet/delta_compaction.cc
index 94d7ae1cc..81b1b006b 100644
--- a/src/kudu/tablet/delta_compaction.cc
+++ b/src/kudu/tablet/delta_compaction.cc
@@ -247,7 +247,7 @@ Status MajorDeltaCompaction::FlushRowSetAndDeltas(const IOContext* io_context) {
for (const Mutation *mut = new_undos_head; mut != nullptr; mut = mut->next()) {
DeltaKey undo_key(nrows + dst_row.row_index(), mut->timestamp());
RETURN_NOT_OK(new_undo_delta_writer_->AppendDelta<UNDO>(undo_key, mut->changelist()));
- undo_stats->UpdateStats(mut->timestamp(), mut->changelist());
+ RETURN_NOT_OK(undo_stats->UpdateStats(mut->timestamp(), mut->changelist()));
undo_delta_mutations_written_++;
}
}
@@ -301,7 +301,7 @@ Status MajorDeltaCompaction::FlushRowSetAndDeltas(const IOContext* io_context) {
new_undo_delta_writer_->WriteDeltaStats(std::move(undo_stats));
RETURN_NOT_OK(new_undo_delta_writer_->FinishAndReleaseBlock(transaction.get()));
}
- transaction->CommitCreatedBlocks();
+ RETURN_NOT_OK(transaction->CommitCreatedBlocks());
DVLOG(1) << "Applied all outstanding deltas for columns "
<< partial_schema_.ToString()
diff --git a/src/kudu/tablet/deltamemstore-test.cc b/src/kudu/tablet/deltamemstore-test.cc
index 44a479a22..3c51c79c2 100644
--- a/src/kudu/tablet/deltamemstore-test.cc
+++ b/src/kudu/tablet/deltamemstore-test.cc
@@ -214,7 +214,7 @@ TEST_F(TestDeltaMemStore, TestUpdateCount) {
ASSERT_OK(fs.CreateNewBlock({}, &block));
DeltaFileWriter dfw(std::move(block));
ASSERT_OK(dfw.Start());
- dms_->FlushToFile(&dfw);
+ ASSERT_OK(dms_->FlushToFile(&dfw));
unique_ptr<DeltaStats> stats = dfw.release_delta_stats();
ASSERT_EQ(n_rows / 2, stats->update_count_for_col_id(schema_.column_id(kIntColumn)));
diff --git a/src/kudu/tablet/deltamemstore.cc b/src/kudu/tablet/deltamemstore.cc
index 2a3fb3e37..2aa7f8287 100644
--- a/src/kudu/tablet/deltamemstore.cc
+++ b/src/kudu/tablet/deltamemstore.cc
@@ -116,7 +116,7 @@ Status DeltaMemStore::Update(Timestamp timestamp,
return Status::IOError("Unable to insert into tree");
}
- anchorer_.AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchorer_.AnchorIfMinimum(op_id.index()));
if (update.is_delete()) {
deleted_row_count_.Increment();
@@ -140,7 +140,7 @@ Status DeltaMemStore::FlushToFile(DeltaFileWriter *dfw) {
RETURN_NOT_OK(key.DecodeFrom(&key_slice));
RowChangeList rcl(val);
RETURN_NOT_OK_PREPEND(dfw->AppendDelta<REDO>(key, rcl), "Failed to append delta");
- stats->UpdateStats(key.timestamp(), rcl);
+ RETURN_NOT_OK(stats->UpdateStats(key.timestamp(), rcl));
iter->Next();
}
dfw->WriteDeltaStats(std::move(stats));
diff --git a/src/kudu/tablet/diskrowset-test-base.h b/src/kudu/tablet/diskrowset-test-base.h
index c5ce471df..91026bbd1 100644
--- a/src/kudu/tablet/diskrowset-test-base.h
+++ b/src/kudu/tablet/diskrowset-test-base.h
@@ -293,7 +293,7 @@ class TestRowSet : public KuduRowSetTest {
CHECK_OK(rs.NewRowIterator(opts, &row_iter));
CHECK_OK(row_iter->Init(&spec));
std::vector<std::string> rows;
- IterateToStringList(row_iter.get(), &rows);
+ ASSERT_OK(IterateToStringList(row_iter.get(), &rows));
std::string result = JoinStrings(rows, "\n");
ASSERT_EQ(expected_val, result);
}
diff --git a/src/kudu/tablet/diskrowset.cc b/src/kudu/tablet/diskrowset.cc
index 049c1f8e9..7ce34c2a7 100644
--- a/src/kudu/tablet/diskrowset.cc
+++ b/src/kudu/tablet/diskrowset.cc
@@ -430,7 +430,7 @@ Status RollingDiskRowSetWriter::AppendDeltas(rowid_t row_idx_in_block,
for (const Mutation *mut = delta_head; mut != nullptr; mut = mut->next()) {
DeltaKey undo_key(*row_idx, mut->timestamp());
RETURN_NOT_OK(writer->AppendDelta<Type>(undo_key, mut->changelist()));
- delta_stats->UpdateStats(mut->timestamp(), mut->changelist());
+ RETURN_NOT_OK(delta_stats->UpdateStats(mut->timestamp(), mut->changelist()));
}
return Status::OK();
}
diff --git a/src/kudu/tablet/memrowset.cc b/src/kudu/tablet/memrowset.cc
index 2cc1d383d..ab798a1d8 100644
--- a/src/kudu/tablet/memrowset.cc
+++ b/src/kudu/tablet/memrowset.cc
@@ -217,7 +217,7 @@ Status MemRowSet::Insert(Timestamp timestamp,
<< "succeeded!";
}
- anchorer_.AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchorer_.AnchorIfMinimum(op_id.index()));
debug_insert_count_++;
live_row_count_.Increment();
@@ -286,7 +286,7 @@ Status MemRowSet::MutateRow(Timestamp timestamp,
stats->mrs_consulted++;
- anchorer_.AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchorer_.AnchorIfMinimum(op_id.index()));
debug_update_count_++;
if (delta.is_delete()) {
live_row_count_.IncrementBy(-1);
diff --git a/src/kudu/tablet/mvcc-test.cc b/src/kudu/tablet/mvcc-test.cc
index 9d5cc3fed..2019307c9 100644
--- a/src/kudu/tablet/mvcc-test.cc
+++ b/src/kudu/tablet/mvcc-test.cc
@@ -645,7 +645,7 @@ TEST_F(MvccTest, TestOpAbort) {
// coalesce to the latest timestamp.
TEST_F(MvccTest, TestAutomaticCleanTimeMoveToSafeTimeOnApply) {
MvccManager mgr;
- clock_.Update(Timestamp(20));
+ ASSERT_OK(clock_.Update(Timestamp(20)));
ScopedOp op1(&mgr, Timestamp(10));
ScopedOp op2(&mgr, Timestamp(15));
@@ -683,7 +683,7 @@ TEST_F(MvccTest, TestIllegalStateTransitionsCrash) {
"Trying to apply an op with a future timestamp|"
"Trying to remove timestamp which isn't in the in-flight set: 1");
- clock_.Update(Timestamp(20));
+ ASSERT_OK(clock_.Update(Timestamp(20)));
EXPECT_DEATH({
mgr.FinishApplyingOp(Timestamp(1));
diff --git a/src/kudu/tablet/ops/participant_op.cc b/src/kudu/tablet/ops/participant_op.cc
index 598b88043..4ec494fcb 100644
--- a/src/kudu/tablet/ops/participant_op.cc
+++ b/src/kudu/tablet/ops/participant_op.cc
@@ -222,18 +222,18 @@ Status ParticipantOpState::PerformOp(const consensus::OpId& op_id, Tablet* table
// metadata. When we begin validating write ops before committing, we'll
// need to populate the response with errors.
case ParticipantOpPB::BEGIN_TXN: {
- tablet->BeginTransaction(txn_.get(), op_id);
+ RETURN_NOT_OK(tablet->BeginTransaction(txn_.get(), op_id));
break;
}
case ParticipantOpPB::BEGIN_COMMIT: {
- tablet->BeginCommit(txn_.get(), begin_commit_mvcc_op_->timestamp(), op_id);
+ RETURN_NOT_OK(tablet->BeginCommit(txn_.get(), begin_commit_mvcc_op_->timestamp(), op_id));
ReleaseMvccOpToTxn();
break;
}
case ParticipantOpPB::FINALIZE_COMMIT: {
DCHECK(op.has_finalized_commit_timestamp());
const auto& commit_ts = op.finalized_commit_timestamp();
- tablet->CommitTransaction(txn_.get(), Timestamp(commit_ts), op_id);
+ RETURN_NOT_OK(tablet->CommitTransaction(txn_.get(), Timestamp(commit_ts), op_id));
// NOTE: we may not have a commit op if we are bootstrapping and we GCed
// the BEGIN_COMMIT op before flushing the finalized commit timestamp.
if (txn_->commit_op()) {
@@ -243,7 +243,7 @@ Status ParticipantOpState::PerformOp(const consensus::OpId& op_id, Tablet* table
break;
}
case ParticipantOpPB::ABORT_TXN: {
- tablet->AbortTransaction(txn_.get(), op_id);
+ RETURN_NOT_OK(tablet->AbortTransaction(txn_.get(), op_id));
// NOTE: we may not have a commit op if we are aborting before beginning
// to commit.
if (txn_->commit_op()) {
diff --git a/src/kudu/tablet/rowset_info.cc b/src/kudu/tablet/rowset_info.cc
index 770295401..ecba52be8 100644
--- a/src/kudu/tablet/rowset_info.cc
+++ b/src/kudu/tablet/rowset_info.cc
@@ -318,7 +318,7 @@ void RowSetInfo::ComputeCdfAndCollectOrdered(
RowSetTree available_rs_tree;
- available_rs_tree.Reset(available_rowsets);
+ CHECK_OK(available_rs_tree.Reset(available_rowsets));
for (const auto& rse : available_rs_tree.key_endpoints()) {
RowSet* rs = rse.rowset_;
const Slice& next_key = rse.slice_;
diff --git a/src/kudu/tablet/rowset_tree-test.cc b/src/kudu/tablet/rowset_tree-test.cc
index 2c24d8e4d..b64032665 100644
--- a/src/kudu/tablet/rowset_tree-test.cc
+++ b/src/kudu/tablet/rowset_tree-test.cc
@@ -263,7 +263,7 @@ TEST_F(TestRowSetTree, TestTreeRandomized) {
Slice(bound.first), Slice(bound.second), &out);
for (const auto& e : out) {
string min, max;
- e->GetBounds(&min, &max);
+ ASSERT_OK(e->GetBounds(&min, &max));
if (min < bound.first) {
ASSERT_GE(max, bound.first);
} else {
diff --git a/src/kudu/tablet/rowset_tree.cc b/src/kudu/tablet/rowset_tree.cc
index 171ad6c6e..42c0b109b 100644
--- a/src/kudu/tablet/rowset_tree.cc
+++ b/src/kudu/tablet/rowset_tree.cc
@@ -141,22 +141,22 @@ Status RowSetTree::Reset(const RowSetVector &rowsets) {
// Iterate over each of the provided RowSets, fetching their
// bounds and adding them to the local vectors.
for (const shared_ptr<RowSet> &rs : rowsets) {
- unique_ptr<RowSetWithBounds> rsit(new RowSetWithBounds());
+ unique_ptr<RowSetWithBounds> rsit(new RowSetWithBounds);
rsit->rowset = rs.get();
string min_key;
string max_key;
- Status s = rs->GetBounds(&min_key, &max_key);
- if (s.IsNotSupported()) {
- // This rowset is a MemRowSet, for which the bounds change as more
- // data gets inserted. Therefore we can't put it in the static
- // interval tree -- instead put it on the list which is consulted
- // on every access.
- unbounded.push_back(rs);
- continue;
- } else if (!s.ok()) {
- LOG(WARNING) << "Unable to construct RowSetTree: "
- << rs->ToString() << " unable to determine its bounds: "
- << s.ToString();
+ if (auto s = rs->GetBounds(&min_key, &max_key); !s.ok()) {
+ if (s.IsNotSupported()) {
+ // This rowset is a MemRowSet, for which the bounds change as more
+ // data gets inserted. Therefore we can't put it in the static
+ // interval tree -- instead put it on the list which is consulted
+ // on every access.
+ unbounded.push_back(rs);
+ continue;
+ }
+ LOG(ERROR) << "Unable to construct RowSetTree: "
+ << rs->ToString() << " unable to determine its bounds: "
+ << s.ToString();
return s;
}
DCHECK_LE(min_key.compare(max_key), 0)
diff --git a/src/kudu/tablet/tablet-test-base.h b/src/kudu/tablet/tablet-test-base.h
index f82692a4c..1f3d9c1c9 100644
--- a/src/kudu/tablet/tablet-test-base.h
+++ b/src/kudu/tablet/tablet-test-base.h
@@ -478,7 +478,7 @@ class TabletTestBase : public KuduTabletTest {
// select the col to update (the third if there is only one key
// or the fourth if there are two col keys).
int col_idx = schema_.num_key_columns() == 1 ? 2 : 3;
- CHECK_OK(row.SetNull(col_idx));
+ RETURN_NOT_OK(row.SetNull(col_idx));
return writer->Update(row);
}
diff --git a/src/kudu/tablet/tablet-test.cc b/src/kudu/tablet/tablet-test.cc
index 509b9bb09..c7f2b0345 100644
--- a/src/kudu/tablet/tablet-test.cc
+++ b/src/kudu/tablet/tablet-test.cc
@@ -48,6 +48,7 @@
#include "kudu/fs/block_manager.h"
#include "kudu/gutil/ref_counted.h"
#include "kudu/gutil/stl_util.h"
+#include "kudu/gutil/strings/substitute.h"
#include "kudu/gutil/strings/join.h"
#include "kudu/tablet/delta_key.h"
#include "kudu/tablet/delta_stats.h"
@@ -240,8 +241,9 @@ TYPED_TEST(TestTablet, TestGhostRowsOnDiskRowSets) {
LocalTabletWriter writer(this->tablet().get(), &this->client_schema_);
for (int i = 0; i < 3; i++) {
- CHECK_OK(this->InsertTestRow(&writer, 0, 0));
- this->DeleteTestRow(&writer, 0);
+ SCOPED_TRACE(strings::Substitute("iteration $0", i));
+ ASSERT_OK(this->InsertTestRow(&writer, 0, 0));
+ ASSERT_OK(this->DeleteTestRow(&writer, 0));
ASSERT_OK(this->tablet()->Flush());
}
@@ -454,16 +456,15 @@ TYPED_TEST(TestTablet, TestReinsertDuringFlush) {
Status PostWriteSnapshot() override {
LocalTabletWriter writer(test_->tablet().get(), &test_->client_schema());
- test_->InsertTestRow(&writer, 0, 1);
- CHECK_OK(test_->DeleteTestRow(&writer, 0));
+ RETURN_NOT_OK(test_->InsertTestRow(&writer, 0, 1));
+ RETURN_NOT_OK(test_->DeleteTestRow(&writer, 0));
CHECK_EQ(1, writer.last_op_result().mutated_stores_size());
CHECK_EQ(1L, writer.last_op_result().mutated_stores(0).mrs_id());
- test_->InsertTestRow(&writer, 0, 2);
- CHECK_OK(test_->DeleteTestRow(&writer, 0));
+ RETURN_NOT_OK(test_->InsertTestRow(&writer, 0, 2));
+ RETURN_NOT_OK(test_->DeleteTestRow(&writer, 0));
CHECK_EQ(1, writer.last_op_result().mutated_stores_size());
CHECK_EQ(1L, writer.last_op_result().mutated_stores(0).mrs_id());
- test_->InsertTestRow(&writer, 0, 3);
- return Status::OK();
+ return test_->InsertTestRow(&writer, 0, 3);
}
private:
@@ -671,7 +672,7 @@ TYPED_TEST(TestTablet, TestRowIteratorComplex) {
bool set_to_null = TestSetupExpectsNulls<TypeParam>(i);
if (set_to_null) {
- this->UpdateTestRowToNull(&writer, i);
+ ASSERT_OK(this->UpdateTestRowToNull(&writer, i));
} else {
ASSERT_OK_FAST(this->UpdateTestRow(&writer, i, i));
}
@@ -1346,7 +1347,7 @@ TYPED_TEST(TestTablet, TestMetricsInit) {
ASSERT_OK(registry->WriteAsJson(&writer, MetricJsonOptions()));
}
// Open tablet, should still work
- this->harness()->Open();
+ ASSERT_OK(this->harness()->Open());
{
std::ostringstream out;
JsonWriter writer(&out, JsonWriter::PRETTY);
diff --git a/src/kudu/tablet/tablet.cc b/src/kudu/tablet/tablet.cc
index b29807833..345bdb2a9 100644
--- a/src/kudu/tablet/tablet.cc
+++ b/src/kudu/tablet/tablet.cc
@@ -1006,8 +1006,6 @@ vector<RowSet*> Tablet::FindRowSetsToCheck(const RowOp* op,
vector<RowSet*> to_check;
for (const auto& txn_mrs : comps->txn_memrowsets) {
to_check.emplace_back(txn_mrs.get());
- uint64_t rows;
- txn_mrs->CountLiveRows(&rows);
}
if (PREDICT_TRUE(!op->orig_result_from_log)) {
// TODO(yingchun): could iterate the rowsets in a smart order
@@ -1303,34 +1301,36 @@ Status Tablet::CheckHasNotBeenStopped(State* cur_state) const {
return Status::OK();
}
-void Tablet::BeginTransaction(Txn* txn,
+Status Tablet::BeginTransaction(Txn* txn,
const OpId& op_id) {
unique_ptr<MinLogIndexAnchorer> anchor(new MinLogIndexAnchorer(log_anchor_registry_.get(),
Substitute("BEGIN_TXN-$0-$1", txn->txn_id(), txn)));
- anchor->AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchor->AnchorIfMinimum(op_id.index()));
metadata_->AddTxnMetadata(txn->txn_id(), std::move(anchor));
const auto& txn_id = txn->txn_id();
CreateTxnRowSets(txn_id, FindOrDie(metadata_->GetTxnMetadata(), txn_id));
txn->BeginTransaction();
+ return Status::OK();
}
-void Tablet::BeginCommit(Txn* txn, Timestamp mvcc_op_ts, const OpId& op_id) {
+Status Tablet::BeginCommit(Txn* txn, Timestamp mvcc_op_ts, const OpId& op_id) {
unique_ptr<MinLogIndexAnchorer> anchor(new MinLogIndexAnchorer(log_anchor_registry_.get(),
Substitute("BEGIN_COMMIT-$0-$1", txn->txn_id(), txn)));
- anchor->AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchor->AnchorIfMinimum(op_id.index()));
metadata_->BeginCommitTransaction(txn->txn_id(), mvcc_op_ts, std::move(anchor));
txn->BeginCommit(op_id);
+ return Status::OK();
}
-void Tablet::CommitTransaction(Txn* txn, Timestamp commit_ts, const OpId& op_id) {
+Status Tablet::CommitTransaction(Txn* txn, Timestamp commit_ts, const OpId& op_id) {
unique_ptr<MinLogIndexAnchorer> anchor(new MinLogIndexAnchorer(log_anchor_registry_.get(),
Substitute("FINALIZE_COMMIT-$0-$1", txn->txn_id(), txn)));
- anchor->AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchor->AnchorIfMinimum(op_id.index()));
const auto& txn_id = txn->txn_id();
metadata_->AddCommitTimestamp(txn_id, commit_ts, std::move(anchor));
CommitTxnRowSets(txn_id);
- txn->FinalizeCommit(commit_ts.value());
+ return txn->FinalizeCommit(commit_ts.value());
}
void Tablet::CommitTxnRowSets(int64_t txn_id) {
@@ -1344,17 +1344,17 @@ void Tablet::CommitTxnRowSets(int64_t txn_id) {
components_->rowsets);
}
-void Tablet::AbortTransaction(Txn* txn, const OpId& op_id) {
+Status Tablet::AbortTransaction(Txn* txn, const OpId& op_id) {
unique_ptr<MinLogIndexAnchorer> anchor(new MinLogIndexAnchorer(log_anchor_registry_.get(),
Substitute("ABORT_TXN-$0-$1", txn->txn_id(), txn)));
- anchor->AnchorIfMinimum(op_id.index());
+ RETURN_NOT_OK(anchor->AnchorIfMinimum(op_id.index()));
const auto& txn_id = txn->txn_id();
metadata_->AbortTransaction(txn_id, std::move(anchor));
{
std::lock_guard lock(component_lock_);
uncommitted_rowsets_by_txn_id_.erase(txn_id);
}
- txn->AbortTransaction();
+ return txn->AbortTransaction();
}
Status Tablet::ApplyRowOperations(WriteOpState* op_state) {
diff --git a/src/kudu/tablet/tablet.h b/src/kudu/tablet/tablet.h
index aa6a6f999..014fdbe27 100644
--- a/src/kudu/tablet/tablet.h
+++ b/src/kudu/tablet/tablet.h
@@ -225,18 +225,18 @@ class Tablet {
// Begins the transaction, recording its presence in the tablet metadata.
// Upon calling this, 'op_id' will be anchored until the metadata is flushed,
// using 'txn' as the anchor owner.
- void BeginTransaction(Txn* txn, const consensus::OpId& op_id);
+ Status BeginTransaction(Txn* txn, const consensus::OpId& op_id);
// Indicates that the transaction has started to commit, recording the
// timestamp used by the MVCC op to demarcate the end of the transaction in
// the tablet metadata. Upon calling this, 'op_id' will be anchored until
// the metadata is flushed, using 'txn' as the anchor owner.
- void BeginCommit(Txn* txn, Timestamp mvcc_op_ts, const consensus::OpId& op_id);
+ Status BeginCommit(Txn* txn, Timestamp mvcc_op_ts, const consensus::OpId& op_id);
// Commits the transaction, recording its commit timestamp in the tablet metadata.
// Upon calling this, 'op_id' will be anchored until the metadata is flushed,
// using 'txn' as the anchor owner.
- void CommitTransaction(Txn* txn, Timestamp commit_ts, const consensus::OpId& op_id);
+ Status CommitTransaction(Txn* txn, Timestamp commit_ts, const consensus::OpId& op_id);
// Merges the uncommitted transaction rowsets associated with the given
// 'txn_id' with the committed rowsets.
@@ -245,7 +245,7 @@ class Tablet {
// Aborts the transaction, recording the abort in the tablet metadata.
// Upon calling this, 'op_id' will be anchored until the metadata is flushed,
// using 'txn' as the anchor owner.
- void AbortTransaction(Txn* txn, const consensus::OpId& op_id);
+ Status AbortTransaction(Txn* txn, const consensus::OpId& op_id);
// Creates new rowsets for the given transaction.
void CreateTxnRowSets(int64_t txn_id, scoped_refptr<TxnMetadata> txn_meta);
diff --git a/src/kudu/tablet/tablet_auto_incrementing-test.cc b/src/kudu/tablet/tablet_auto_incrementing-test.cc
index 91ce282d1..e3ea6090c 100644
--- a/src/kudu/tablet/tablet_auto_incrementing-test.cc
+++ b/src/kudu/tablet/tablet_auto_incrementing-test.cc
@@ -77,7 +77,7 @@ TEST_F(AutoIncrementingTabletTest, TestInsertOp) {
ASSERT_OK(tablet()->NewRowIterator(schema_.CopyWithoutColumnIds(), &iter));
ASSERT_OK(iter->Init(nullptr));
vector<string> out;
- IterateToStringList(iter.get(), &out);
+ ASSERT_OK(IterateToStringList(iter.get(), &out));
for (int i = 0; i < 10; i++) {
ASSERT_STR_CONTAINS(out[i], Substitute("int64 key=$0", i + 1));
}
@@ -104,7 +104,7 @@ TEST_F(AutoIncrementingTabletTest, TestUpsertOp) {
ASSERT_OK(tablet()->NewRowIterator(schema_.CopyWithoutColumnIds(), &iter));
ASSERT_OK(iter->Init(nullptr));
vector<string> out;
- IterateToStringList(iter.get(), &out);
+ ASSERT_OK(IterateToStringList(iter.get(), &out));
for (int i = 1; i <= 20; i++) {
ASSERT_STR_MATCHES(out[i - 1], Substitute("(int64 key=$0, int32 val=1337)", i));
}
@@ -127,7 +127,7 @@ TEST_F(AutoIncrementingTabletTest, TestUpsertOp) {
ASSERT_OK(tablet()->NewRowIterator(schema_.CopyWithoutColumnIds(), &iter));
ASSERT_OK(iter->Init(nullptr));
vector<string> out;
- IterateToStringList(iter.get(), &out);
+ ASSERT_OK(IterateToStringList(iter.get(), &out));
for (int i = 1; i <= 20; i++) {
ASSERT_STR_MATCHES(out[i - 1], Substitute("(int64 key=$0, int32 val=1338)", i));
}
@@ -145,7 +145,7 @@ TEST_F(AutoIncrementingTabletTest, TestUpsertOp) {
ASSERT_OK(tablet()->NewRowIterator(schema_.CopyWithoutColumnIds(), &iter));
ASSERT_OK(iter->Init(nullptr));
vector<string> out;
- IterateToStringList(iter.get(), &out);
+ ASSERT_OK(IterateToStringList(iter.get(), &out));
for (int i = 21; i <= 30; i++) {
ASSERT_STR_MATCHES(out[i-1], Substitute("int64 key=$0, int32 val=1337", i));
}
diff --git a/src/kudu/tablet/tablet_bootstrap-test.cc b/src/kudu/tablet/tablet_bootstrap-test.cc
index 4c68d3fa5..776cfbc39 100644
--- a/src/kudu/tablet/tablet_bootstrap-test.cc
+++ b/src/kudu/tablet/tablet_bootstrap-test.cc
@@ -57,6 +57,7 @@
#include "kudu/fs/data_dirs.h"
#include "kudu/fs/fs_manager.h"
#include "kudu/gutil/ref_counted.h"
+#include "kudu/gutil/strings/substitute.h"
#include "kudu/rpc/result_tracker.h"
#include "kudu/tablet/metadata.pb.h"
#include "kudu/tablet/rowset.h"
@@ -249,7 +250,8 @@ TEST_F(BootstrapTest, TestBootstrapHighOpIdIndex) {
ASSERT_OK(BuildLog());
current_index_ = first_log_index;
for (int i = 0; i < kNumEntries; i++) {
- AppendReplicateBatchAndCommitEntryPairsToLog(1);
+ SCOPED_TRACE(Substitute("entry $0", i));
+ ASSERT_OK(AppendReplicateBatchAndCommitEntryPairsToLog(1));
}
// Kick off tablet bootstrap and ensure everything worked.
@@ -323,7 +325,7 @@ TEST_F(BootstrapTest, TestOrphanCommit) {
ASSERT_OK(AppendCommit(opid));
log::SegmentSequence segments;
log_->reader()->GetSegmentsSnapshot(&segments);
- fs_manager_->GetEnv()->DeleteFile(segments[0]->path());
+ ASSERT_OK(fs_manager_->GetEnv()->DeleteFile(segments[0]->path()));
// Untrack the tablet in the data dir manager so upon the next call to
// BootstrapTestTablet, the tablet metadata's data dir group can be loaded.
@@ -391,7 +393,7 @@ TEST_F(BootstrapTest, TestNonOrphansAfterOrphanCommit) {
log::SegmentSequence segments;
log_->reader()->GetSegmentsSnapshot(&segments);
- fs_manager_->GetEnv()->DeleteFile(segments[0]->path());
+ ASSERT_OK(fs_manager_->GetEnv()->DeleteFile(segments[0]->path()));
current_index_ += 2;
diff --git a/src/kudu/tablet/tablet_metadata-test.cc b/src/kudu/tablet/tablet_metadata-test.cc
index 953db17f0..72244da8e 100644
--- a/src/kudu/tablet/tablet_metadata-test.cc
+++ b/src/kudu/tablet/tablet_metadata-test.cc
@@ -178,7 +178,7 @@ TEST_F(TestTabletMetadata, TestOnDiskSize) {
// Write some data to the tablet and flush.
unique_ptr<KuduPartialRow> row;
BuildPartialRow(0, 0, "foo", &row);
- writer_->Insert(*row);
+ ASSERT_OK(writer_->Insert(*row));
ASSERT_OK(harness_->tablet()->Flush());
// The tablet metadata grows after flushing a new rowset.
@@ -188,7 +188,7 @@ TEST_F(TestTabletMetadata, TestOnDiskSize) {
// Create another rowset.
// The on-disk size shouldn't change until after flush.
BuildPartialRow(1, 1, "bar", &row);
- writer_->Insert(*row);
+ ASSERT_OK(writer_->Insert(*row));
ASSERT_EQ(middle_size, meta->on_disk_size());
ASSERT_OK(harness_->tablet()->Flush());
int64_t final_size = meta->on_disk_size();
@@ -218,8 +218,9 @@ TEST_F(TestTabletMetadata, BenchmarkCollectBlockIds) {
meta->SetColumnDataBlocks(block_by_column);
rs_metas.emplace_back(shared_ptr<RowSetMetadata>(meta.release()));
}
- tablet_meta->UpdateAndFlush(RowSetMetadataIds(), rs_metas, TabletMetadata::kNoMrsFlushed);
-
+ ASSERT_OK(tablet_meta->UpdateAndFlush(RowSetMetadataIds(),
+ rs_metas,
+ TabletMetadata::kNoMrsFlushed));
for (int i = 0; i < 10; ++i) {
BlockIdContainer block_ids;
LOG_TIMING(INFO, "collecting BlockIds") {
diff --git a/src/kudu/tablet/tablet_metadata.cc b/src/kudu/tablet/tablet_metadata.cc
index 2dfea8d6e..d78579a80 100644
--- a/src/kudu/tablet/tablet_metadata.cc
+++ b/src/kudu/tablet/tablet_metadata.cc
@@ -636,7 +636,7 @@ Status TabletMetadata::Flush() {
orphaned.assign(orphaned_blocks_.begin(), orphaned_blocks_.end());
anchors_needing_flush = std::move(anchors_needing_flush_);
}
- pre_flush_callback_();
+ RETURN_NOT_OK(pre_flush_callback_());
RETURN_NOT_OK(ReplaceSuperBlockUnlocked(pb));
TRACE("Metadata flushed");
l_flush.unlock();
diff --git a/src/kudu/tablet/tablet_replica-test.cc b/src/kudu/tablet/tablet_replica-test.cc
index be8a83a41..31aef9c1a 100644
--- a/src/kudu/tablet/tablet_replica-test.cc
+++ b/src/kudu/tablet/tablet_replica-test.cc
@@ -308,7 +308,7 @@ TEST_F(TabletReplicaTest, TestMRSAnchorPreventsLogGC) {
ASSERT_EQ(0, num_gced) << "earliest needed: " << retention.for_durability;
// Flush MRS as needed to ensure that we don't have OpId anchors in the MRS.
- tablet_replica_->tablet()->Flush();
+ ASSERT_OK(tablet_replica_->tablet()->Flush());
ASSERT_EVENTUALLY([&]{ AssertNoLogAnchors(); });
// The first two segments should be deleted.
@@ -421,7 +421,7 @@ TEST_F(TabletReplicaTest, TestActiveOpPreventsLogGC) {
// Flush MRS as needed to ensure that we don't have OpId anchors in the MRS.
ASSERT_EQ(1, tablet_replica_->log_anchor_registry()->GetAnchorCountForTests());
- tablet_replica_->tablet()->Flush();
+ ASSERT_OK(tablet_replica_->tablet()->Flush());
// Verify no anchors after Flush().
ASSERT_EVENTUALLY([&]{ AssertNoLogAnchors(); });
@@ -519,7 +519,7 @@ TEST_F(TabletReplicaTest, TestGCEmptyLog) {
ConsensusBootstrapInfo info;
ASSERT_OK(StartReplica(info));
// We don't wait on consensus on purpose.
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
}
TEST_F(TabletReplicaTest, TestFlushOpsPerfImprovements) {
@@ -593,8 +593,8 @@ TEST_F(TabletReplicaTest, TestRollLogSegmentSchemaOnAlter) {
NO_FATALS(write());
ASSERT_OK(RollLog(tablet_replica_.get()));
NO_FATALS(write());
- tablet_replica_->tablet()->Flush();
- ASSERT_OK(tablet_replica_->RunLogGC());
+ ASSERT_OK(tablet_replica_->tablet()->Flush());
+ tablet_replica_->RunLogGC();
// Now write some more and restart. If our segment header schema previously
// didn't have "new_col", bootstrapping would fail, complaining about a
@@ -634,7 +634,7 @@ TEST_F(TabletReplicaTest, Kudu2690Test) {
ASSERT_OK(GenerateSequentialInsertRequest(new_client_schema, req.get()));
ASSERT_OK(ExecuteWrite(tablet_replica_.get(), *req));
}
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
// Before KUDU-2960 was fixed, bootstrapping would fail, complaining that the
// write requests contained a column that was not in the log segment header's
diff --git a/src/kudu/tablet/tablet_replica.cc b/src/kudu/tablet/tablet_replica.cc
index bc90e1169..9d132b4cf 100644
--- a/src/kudu/tablet/tablet_replica.cc
+++ b/src/kudu/tablet/tablet_replica.cc
@@ -653,18 +653,15 @@ void TabletReplica::GetTabletStatusPB(TabletStatusPB* status_pb_out) const {
}
}
-Status TabletReplica::RunLogGC() {
- if (!CheckRunning().ok()) {
- return Status::OK();
+void TabletReplica::RunLogGC() {
+ if (PREDICT_FALSE(!CheckRunning().ok())) {
+ return;
}
int32_t num_gced;
- log::RetentionIndexes retention = GetRetentionIndexes();
- Status s = log_->GC(retention, &num_gced);
- if (!s.ok()) {
- s = s.CloneAndPrepend("Unexpected error while running Log GC from TabletReplica");
- LOG(ERROR) << s.ToString();
+ const auto s = log_->GC(GetRetentionIndexes(), &num_gced);
+ if (PREDICT_FALSE(!s.ok())) {
+ LOG(ERROR) << LogPrefix() << "unexpected error while running log GC: " << s.ToString();
}
- return Status::OK();
}
void TabletReplica::SetBootstrapping() {
@@ -1314,7 +1311,7 @@ void TabletReplica::TxnOpDispatcher::Cancel(const Status& status,
std::swap(ops, ops_queue_);
}
- RespondWithStatus(status, code, std::move(ops));
+ ignore_result(RespondWithStatus(status, code, std::move(ops)));
}
Status TabletReplica::TxnOpDispatcher::MarkUnregistered() {
diff --git a/src/kudu/tablet/tablet_replica.h b/src/kudu/tablet/tablet_replica.h
index 8b9c69012..dd1ffb02f 100644
--- a/src/kudu/tablet/tablet_replica.h
+++ b/src/kudu/tablet/tablet_replica.h
@@ -322,7 +322,7 @@ class TabletReplica : public RefCountedThreadSafe<TabletReplica>,
std::shared_ptr<OpDriver>* driver);
// Tells the tablet's log to garbage collect.
- Status RunLogGC();
+ void RunLogGC();
// Register the maintenance ops associated with this peer's tablet, also invokes
// Tablet::RegisterMaintenanceOps().
diff --git a/src/kudu/tablet/txn_participant-test.cc b/src/kudu/tablet/txn_participant-test.cc
index fea0a9b57..e85f6cc8c 100644
--- a/src/kudu/tablet/txn_participant-test.cc
+++ b/src/kudu/tablet/txn_participant-test.cc
@@ -515,7 +515,8 @@ TEST_F(TxnParticipantTest, TestAllOpsRegisterAnchors) {
if (op == ParticipantOpPB::BEGIN_COMMIT) {
ASSERT_EQ(1, tablet_replica_->log_anchor_registry()->GetAnchorCountForTests());
int64_t log_index = -1;
- tablet_replica_->log_anchor_registry()->GetEarliestRegisteredLogIndex(&log_index);
+ ASSERT_OK(tablet_replica_->log_anchor_registry()->GetEarliestRegisteredLogIndex(
+ &log_index));
ASSERT_EQ(expected_index, log_index);
} else {
ASSERT_EQ(0, tablet_replica_->log_anchor_registry()->GetAnchorCountForTests());
@@ -699,7 +700,7 @@ TEST_F(TxnParticipantTest, TestTxnMetadataSurvivesRestart) {
// We should be able to GC the WALs that have the BEGIN_TXN op.
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_GT(gcable_size, 0);
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_EQ(0, gcable_size);
@@ -718,7 +719,7 @@ TEST_F(TxnParticipantTest, TestTxnMetadataSurvivesRestart) {
ASSERT_EQ(1, tablet_replica_->log_anchor_registry()->GetAnchorCountForTests());
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_GT(gcable_size, 0);
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_EQ(0, gcable_size);
@@ -750,7 +751,7 @@ TEST_F(TxnParticipantTest, TestTxnMetadataSurvivesRestart) {
ASSERT_OK(WriteRolloverAndFlush(current_key++));
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_GT(gcable_size, 0);
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_EQ(0, gcable_size);
@@ -780,7 +781,7 @@ TEST_F(TxnParticipantTest, TestBeginCommitAnchorsOnFlush) {
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
const auto orig_mvcc_op_timestamp = *txn_meta->commit_mvcc_op_timestamp();
txn_meta.reset();
- RestartReplica(/*reset_tablet*/true);
+ ASSERT_OK(RestartReplica(/*reset_tablet*/true));
txn_meta = FindOrDie(tablet_replica_->tablet_metadata()->GetTxnMetadata(), kTxnId);
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
ASSERT_EQ(orig_mvcc_op_timestamp, *txn_meta->commit_mvcc_op_timestamp());
@@ -803,7 +804,7 @@ TEST_F(TxnParticipantTest, TestBeginCommitAnchorsOnFlush) {
// after restarting.
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
txn_meta.reset();
- RestartReplica(/*reset_tablet*/true);
+ ASSERT_OK(RestartReplica(/*reset_tablet*/true));
txn_meta = FindOrDie(tablet_replica_->tablet_metadata()->GetTxnMetadata(), kTxnId);
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
ASSERT_EQ(orig_mvcc_op_timestamp, *txn_meta->commit_mvcc_op_timestamp());
@@ -822,7 +823,7 @@ TEST_F(TxnParticipantTest, TestBeginCommitAnchorsOnFinalize) {
// Restarting shouldn't affect our metadata.
txn_meta.reset();
- RestartReplica(/*reset_tablet*/true);
+ ASSERT_OK(RestartReplica(/*reset_tablet*/true));
txn_meta = FindOrDie(tablet_replica_->tablet_metadata()->GetTxnMetadata(), kTxnId);
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
ASSERT_EQ(orig_mvcc_op_timestamp, *txn_meta->commit_mvcc_op_timestamp());
@@ -835,7 +836,7 @@ TEST_F(TxnParticipantTest, TestBeginCommitAnchorsOnFinalize) {
// Finalizing the commit shouldn't affect our metadata.
txn_meta.reset();
- RestartReplica(/*reset_tablet*/true);
+ ASSERT_OK(RestartReplica(/*reset_tablet*/true));
txn_meta = FindOrDie(tablet_replica_->tablet_metadata()->GetTxnMetadata(), kTxnId);
ASSERT_NE(nullopt, txn_meta->commit_mvcc_op_timestamp());
ASSERT_EQ(orig_mvcc_op_timestamp, *txn_meta->commit_mvcc_op_timestamp());
@@ -1040,7 +1041,7 @@ TEST_F(TxnParticipantTest, TestActiveParticipantOpsAnchorWALs) {
// Now that we've completed the op, we can get rid of the WAL segments that
// had the participant op.
- ASSERT_OK(tablet_replica_->RunLogGC());
+ tablet_replica_->RunLogGC();
ASSERT_OK(tablet_replica_->GetGCableDataSize(&gcable_size));
ASSERT_EQ(0, gcable_size);
diff --git a/src/kudu/tablet/txn_participant.h b/src/kudu/tablet/txn_participant.h
index 6329ec8e0..c79c8e4ae 100644
--- a/src/kudu/tablet/txn_participant.h
+++ b/src/kudu/tablet/txn_participant.h
@@ -235,14 +235,14 @@ class Txn : public RefCountedThreadSafe<Txn> {
&begin_commit_anchor_));
SetState(kCommitInProgress);
}
- void FinalizeCommit(int64_t finalized_commit_timestamp) {
+ Status FinalizeCommit(int64_t finalized_commit_timestamp) {
commit_timestamp_ = finalized_commit_timestamp;
SetState(kCommitted);
- log_anchor_registry_->UnregisterIfAnchored(&begin_commit_anchor_);
+ return log_anchor_registry_->UnregisterIfAnchored(&begin_commit_anchor_);
}
- void AbortTransaction() {
+ Status AbortTransaction() {
SetState(kAborted);
- log_anchor_registry_->UnregisterIfAnchored(&begin_commit_anchor_);
+ return log_anchor_registry_->UnregisterIfAnchored(&begin_commit_anchor_);
}
// Simple accessors for state. No locks are required to call these.