This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new eca747413d3 [Fix](partial update) Fix core when doing partial update
on tables with row column after schema change (#26632)
eca747413d3 is described below
commit eca747413d3f185e5227358f541fecc26a284bb0
Author: bobhan1 <[email protected]>
AuthorDate: Thu Nov 9 18:00:05 2023 +0800
[Fix](partial update) Fix core when doing partial update on tables with row
column after schema change (#26632)
---
be/src/olap/rowset/segment_v2/segment_writer.cpp | 4 +-
be/src/olap/tablet.cpp | 14 ++--
be/src/olap/tablet.h | 6 +-
...test_partial_update_schema_change_row_store.out | 76 ++++++++++++++++++++++
.../test_partial_update_schema_change.groovy | 7 +-
..._partial_update_schema_change_row_store.groovy} | 45 +++++++++----
6 files changed, 127 insertions(+), 25 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/segment_writer.cpp
b/be/src/olap/rowset/segment_v2/segment_writer.cpp
index 6490b49f8b6..8903902692f 100644
--- a/be/src/olap/rowset/segment_v2/segment_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_writer.cpp
@@ -554,8 +554,8 @@ Status
SegmentWriter::fill_missing_columns(vectorized::MutableColumns& mutable_f
read_index[id_and_pos.pos] = read_idx++;
}
if (has_row_column) {
- auto st = tablet->fetch_value_through_row_column(rowset,
seg_it.first, rids,
- cids_missing,
old_value_block);
+ auto st = tablet->fetch_value_through_row_column(
+ rowset, *_tablet_schema, seg_it.first, rids,
cids_missing, old_value_block);
if (!st.ok()) {
LOG(WARNING) << "failed to fetch value through row column";
return st;
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index db1c2eb4ea2..d58183a006d 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2742,7 +2742,8 @@ Status Tablet::_get_segment_column_iterator(
}
// fetch value by row column
-Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset,
uint32_t segid,
+Status Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset,
+ const TabletSchema&
tablet_schema, uint32_t segid,
const std::vector<uint32_t>&
rowids,
const std::vector<uint32_t>&
cids,
vectorized::Block& block) {
@@ -2755,13 +2756,12 @@ Status
Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint
BetaRowsetSharedPtr rowset =
std::static_pointer_cast<BetaRowset>(input_rowset);
CHECK(rowset);
- const TabletSchemaSPtr tablet_schema = rowset->tablet_schema();
- CHECK(tablet_schema->store_row_column());
+ CHECK(tablet_schema.store_row_column());
SegmentCacheHandle segment_cache_handle;
std::unique_ptr<segment_v2::ColumnIterator> column_iterator;
OlapReaderStatistics stats;
RETURN_IF_ERROR(_get_segment_column_iterator(rowset, segid,
-
tablet_schema->column(BeConsts::ROW_STORE_COL),
+
tablet_schema.column(BeConsts::ROW_STORE_COL),
&segment_cache_handle,
&column_iterator, &stats));
// get and parse tuple row
vectorized::MutableColumnPtr column_ptr =
vectorized::ColumnString::create();
@@ -2774,7 +2774,7 @@ Status
Tablet::fetch_value_through_row_column(RowsetSharedPtr input_rowset, uint
std::vector<std::string> default_values;
default_values.resize(cids.size());
for (int i = 0; i < cids.size(); ++i) {
- const TabletColumn& column = tablet_schema->column(cids[i]);
+ const TabletColumn& column = tablet_schema.column(cids[i]);
vectorized::DataTypePtr type =
vectorized::DataTypeFactory::instance().create_data_type(column);
col_uid_to_idx[column.unique_id()] = i;
@@ -3255,8 +3255,8 @@ Status Tablet::read_columns_by_plan(TabletSchemaSPtr
tablet_schema,
(*read_index)[id_and_pos.pos] = read_idx++;
}
if (has_row_column) {
- auto st = fetch_value_through_row_column(rowset_iter->second,
seg_it.first, rids,
- cids_to_read, block);
+ auto st = fetch_value_through_row_column(rowset_iter->second,
*tablet_schema,
+ seg_it.first, rids,
cids_to_read, block);
if (!st.ok()) {
LOG(WARNING) << "failed to fetch value through row column";
return st;
diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h
index 3c30b3805fa..7a2aff4edf2 100644
--- a/be/src/olap/tablet.h
+++ b/be/src/olap/tablet.h
@@ -438,7 +438,11 @@ public:
const TabletColumn& tablet_column,
vectorized::MutableColumnPtr& dst);
- Status fetch_value_through_row_column(RowsetSharedPtr input_rowset,
uint32_t segid,
+ // We use the TabletSchema from the caller because the TabletSchema in the
rowset'meta
+ // may be outdated due to schema change. Also note that the the cids
should indicate the indexes
+ // of the columns in the TabletSchema passed in.
+ Status fetch_value_through_row_column(RowsetSharedPtr input_rowset,
+ const TabletSchema& tablet_schema,
uint32_t segid,
const std::vector<uint32_t>& rowids,
const std::vector<uint32_t>& cids,
vectorized::Block& block);
diff --git
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.out
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.out
new file mode 100644
index 00000000000..86df3374712
--- /dev/null
+++
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.out
@@ -0,0 +1,76 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !sql1 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql2 --
+1 1 1 0 0 0 0 0 0 0 0
+
+-- !sql3 --
+1 1 1 0 0 0 0 0 0 0
10
+
+-- !sql4 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql5 --
+1 1 1 0 0 0 0 0 0
+
+-- !sql6 --
+1 2 1 0 0 0 0 1 0
+
+-- !sql7 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql8 --
+1 1 1.0 0 0 0 0 0 0 0
+
+-- !sql9 --
+1
+
+-- !sql10 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql11 --
+1 1 1 0 0 0 0 0 0 0
+
+-- !sql12 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql13 --
+1 1 1 0 0 0 0 0 0 0
+
+-- !sql14 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql15 --
+1 1 1 0 0 0 0 0 0 0 0
+
+-- !sql16 --
+1 1 1 0 0 0 0 0 0 0
10
+
+-- !sql17 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql18 --
+1 1 1 0 0 0 0 0 0
+
+-- !sql19 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql20 --
+1 1 1.0 0 0 0 0 0 0 0
+
+-- !sql21 --
+1
+
+-- !sql23 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql24 --
+1 1 1 0 0 0 0 0 0 0
+
+-- !sql25 --
+1 0 0 0 0 0 0 0 0 0
+
+-- !sql26 --
+1 1 1 0 0 0 0 0 0 0
+
diff --git
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
index b4bb054a9a8..eee92b2b39e 100644
---
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
+++
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
@@ -17,7 +17,10 @@
// under the License.
suite("test_partial_update_schema_change", "p0") {
- // test add value column
+
+ /* ============================================== light schema change
cases: ============================================== */
+
+ // test add value column
def tableName = "test_partial_update_light_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
@@ -618,6 +621,8 @@ suite("test_partial_update_schema_change", "p0") {
sql """ DROP TABLE IF EXISTS ${tableName} """
+ /* ============================================== schema change cases:
============================================== */
+
// test add value column
tableName = "test_partial_update_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
diff --git
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.groovy
similarity index 95%
copy from
regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
copy to
regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.groovy
index b4bb054a9a8..1fa4ec39d36 100644
---
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change.groovy
+++
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_schema_change_row_store.groovy
@@ -16,9 +16,12 @@
// specific language governing permissions and limitations
// under the License.
-suite("test_partial_update_schema_change", "p0") {
- // test add value column
- def tableName = "test_partial_update_light_schema_change_add_column"
+suite("test_partial_update_row_store_schema_change", "p0") {
+
+ /* ============================================== light schema change
cases: ============================================== */
+
+ // test add value column
+ def tableName =
"test_partial_update_row_store_light_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -36,6 +39,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -140,7 +144,7 @@ suite("test_partial_update_schema_change", "p0") {
// test delete value column
- tableName = "test_partial_update_light_schema_change_delete_column"
+ tableName =
"test_partial_update_row_store_light_schema_change_delete_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -158,6 +162,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -262,7 +267,7 @@ suite("test_partial_update_schema_change", "p0") {
// test update value column
- tableName = "test_partial_update_light_schema_change_update_column"
+ tableName =
"test_partial_update_row_store_light_schema_change_update_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -280,6 +285,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -354,7 +360,7 @@ suite("test_partial_update_schema_change", "p0") {
// test add key column
- tableName = "test_partial_update_light_schema_change_add_key_column"
+ tableName =
"test_partial_update_row_store_light_schema_change_add_key_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
@@ -364,6 +370,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -449,7 +456,7 @@ suite("test_partial_update_schema_change", "p0") {
// test create index
- tableName = "test_partial_update_light_schema_change_create_index"
+ tableName =
"test_partial_update_row_store_light_schema_change_create_index"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -467,6 +474,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -540,7 +548,7 @@ suite("test_partial_update_schema_change", "p0") {
sql """ DROP TABLE IF EXISTS ${tableName} """
// test change properties
- tableName = "test_partial_update_light_schema_change_properties"
+ tableName = "test_partial_update_row_store_light_schema_change_properties"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -558,6 +566,7 @@ suite("test_partial_update_schema_change", "p0") {
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -618,8 +627,10 @@ suite("test_partial_update_schema_change", "p0") {
sql """ DROP TABLE IF EXISTS ${tableName} """
+ /* ============================================== schema change cases:
============================================== */
+
// test add value column
- tableName = "test_partial_update_schema_change_add_column"
+ tableName = "test_partial_update_row_store_schema_change_add_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -636,6 +647,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -740,7 +752,7 @@ suite("test_partial_update_schema_change", "p0") {
// test delete value column
- tableName = "test_partial_update_schema_change_delete_column"
+ tableName = "test_partial_update_row_store_schema_change_delete_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -757,6 +769,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -857,7 +870,7 @@ suite("test_partial_update_schema_change", "p0") {
// test update value column
- tableName = "test_partial_update_schema_change_update_column"
+ tableName = "test_partial_update_row_store_schema_change_update_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -874,6 +887,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -948,7 +962,7 @@ suite("test_partial_update_schema_change", "p0") {
// test add key column
- tableName = "test_partial_update_schema_change_add_key_column"
+ tableName = "test_partial_update_row_store_schema_change_add_key_column"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
@@ -957,6 +971,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -1038,7 +1053,7 @@ suite("test_partial_update_schema_change", "p0") {
// test create index
- tableName = "test_partial_update_schema_change_create_index"
+ tableName = "test_partial_update_row_store_schema_change_create_index"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -1055,6 +1070,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
@@ -1127,7 +1143,7 @@ suite("test_partial_update_schema_change", "p0") {
sql """ DROP TABLE IF EXISTS ${tableName} """
// test change properties
- tableName = "test_partial_update_schema_change_properties"
+ tableName = "test_partial_update_row_store_schema_change_properties"
sql """ DROP TABLE IF EXISTS ${tableName} """
sql """
CREATE TABLE ${tableName} (
@@ -1144,6 +1160,7 @@ suite("test_partial_update_schema_change", "p0") {
UNIQUE KEY(`c0`) DISTRIBUTED BY HASH(`c0`) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
+ "store_row_column" = "true",
"enable_unique_key_merge_on_write" = "true")
"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]