You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by la...@apache.org on 2023/05/25 02:13:59 UTC
[kudu] 01/02: [server] KUDU-1945 Fix bug in RowOperationsPBDecoder
This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch branch-1.17.x
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 252da818c55c83c4852b1c3a3e18e45c64ed7d10
Author: Abhishek Chennaka <ac...@cloudera.com>
AuthorDate: Thu Apr 6 17:40:56 2023 -0700
[server] KUDU-1945 Fix bug in RowOperationsPBDecoder
This fixes the situation where we decode any operation containing
auto incrementing column with auto_incrementing_counter being nullptr.
Change-Id: I540698ba346f9c6bed36607b222521b65c46018f
Reviewed-on: http://gerrit.cloudera.org:8080/19710
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <al...@apache.org>
Reviewed-on: http://gerrit.cloudera.org:8080/19919
Tested-by: Alexey Serbin <al...@apache.org>
---
src/kudu/common/row_operations.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/kudu/common/row_operations.cc b/src/kudu/common/row_operations.cc
index 2c0991502..b3a359323 100644
--- a/src/kudu/common/row_operations.cc
+++ b/src/kudu/common/row_operations.cc
@@ -500,6 +500,12 @@ Status RowOperationsPBDecoder::DecodeInsertOrUpsert(const uint8_t* prototype_row
op->SetFailureStatusOnce(err_max_value);
return err_max_value;
}
+ if (*DCHECK_NOTNULL(auto_incrementing_counter) < 0) {
+ static const Status err_value = Status::IllegalState("invalid auto-incrementing "
+ "column value");
+ op->SetFailureStatusOnce(err_value);
+ return err_value;
+ }
// We increment the auto incrementing counter at this point regardless of future failures
// in the op for simplicity. The auto-incrementing column key space is large enough to
// not run of values for any realistic workloads.
@@ -731,6 +737,8 @@ Status RowOperationsPBDecoder::DecodeOperations(vector<DecodedRowOperation>* ops
uint8_t prototype_row_storage[tablet_row_size_];
ContiguousRow prototype_row(tablet_schema_, prototype_row_storage);
SetupPrototypeRow(*tablet_schema_, &prototype_row);
+ int64_t counter = -1;
+ auto_incrementing_counter = auto_incrementing_counter ? auto_incrementing_counter : &counter;
while (HasNext()) {
RowOperationsPB::Type type = RowOperationsPB::UNKNOWN;