From 02fad48870a0f0e7c861e6b4ad1bb929f51e659d Mon Sep 17 00:00:00 2001 From: abmdocrt Date: Sat, 22 Jun 2024 14:23:04 +0800 Subject: [PATCH] [Fix](upgrade) Fix fields not handled correctly during upgrade and downgrade (#36691) master version is #36690 --- be/src/exec/tablet_info.cpp | 10 ++++++++++ gensrc/proto/descriptors.proto | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/be/src/exec/tablet_info.cpp b/be/src/exec/tablet_info.cpp index e32e9c9efcf4cc..a8efbd338a32aa 100644 --- a/be/src/exec/tablet_info.cpp +++ b/be/src/exec/tablet_info.cpp @@ -121,6 +121,11 @@ Status OlapTableSchemaParam::init(const POlapTableSchemaParam& pschema) { _is_strict_mode = pschema.is_strict_mode(); if (_is_partial_update) { _auto_increment_column = pschema.auto_increment_column(); + if (!_auto_increment_column.empty() && pschema.auto_increment_column_unique_id() == -1) { + return Status::InternalError( + "Auto increment column id is not set in FE. Maybe FE is an older version " + "different from BE."); + } _auto_increment_column_unique_id = pschema.auto_increment_column_unique_id(); } _timestamp_ms = pschema.timestamp_ms(); @@ -187,6 +192,11 @@ Status OlapTableSchemaParam::init(const TOlapTableSchemaParam& tschema) { } if (_is_partial_update) { _auto_increment_column = tschema.auto_increment_column; + if (!_auto_increment_column.empty() && tschema.auto_increment_column_unique_id == -1) { + return Status::InternalError( + "Auto increment column id is not set in FE. Maybe FE is an older version " + "different from BE."); + } _auto_increment_column_unique_id = tschema.auto_increment_column_unique_id; } diff --git a/gensrc/proto/descriptors.proto b/gensrc/proto/descriptors.proto index 13c069f414fc2b..21fc646c92d12d 100644 --- a/gensrc/proto/descriptors.proto +++ b/gensrc/proto/descriptors.proto @@ -72,6 +72,6 @@ message POlapTableSchemaParam { optional string auto_increment_column = 10; optional int64 timestamp_ms = 11 [default = 0]; optional string timezone = 12; - optional int32 auto_increment_column_unique_id = 13; + optional int32 auto_increment_column_unique_id = 13 [default = -1]; };