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 2023/04/13 06:05:17 UTC

[kudu] branch master updated: [server] KUDU-1945 Fix bug in RowOperationsPBDecoder

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 74ea7543e [server] KUDU-1945 Fix bug in RowOperationsPBDecoder
74ea7543e is described below

commit 74ea7543e3ad8abebea8844ac97b827d4fed9aea
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>
---
 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;