Skip to content

Commit 42861e6

Browse files
authored
[fix](sc) fix schema change core dump when enable skip_writing_empty_rowset_metadata (#55604)
Related PR: #54395 Problem Summary: The _rs_metas and _rs_version_map information in tmp_tablet meta are inconsistent, causing the attempt to fetch rowset by version to fail (getting null pointer). The tmp_tablet meta was copied from new tablet, and its rowset information is actually useless since the real rowset data will be obtained later through sync rowset. The sync rowset operation failed to remove the old rowsets, resulting in this inconsistency. We need to first clean up the obsolete rowsets in tmp_tablet meta. *** SIGSEGV address not mapped to object (@0x38) received by PID 2824014 (TID 2824488 OR 0x7f59e8eff640) from PID 56; stack trace: *** 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) at /home/zcp/repo_center/doris_master/doris/be/src/common/signal_handler.h:420 1# PosixSignals::chained_handler(int, siginfo*, void*) [clone .part.0] in /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so 2# JVM_handle_linux_signal in /usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so 3# 0x00007F5B3AC5F520 in /lib/x86_64-linux-gnu/libc.so.6 4# doris::cloud::CloudMetaMgr::fill_version_holes(doris::CloudTablet*, long, std::unique_lock<std::shared_mutex>&) at /home/zcp/repo_center/doris_master/doris/be/src/cloud/cloud_meta_mgr.cpp:1650 5# doris::cloud::CloudMetaMgr::sync_tablet_rowsets_unlocked(doris::CloudTablet*, std::unique_lock<bthread::Mutex>&, doris::SyncOptions const&, doris::SyncRowsetStats*) in /mnt/hdd01/PERFORMANCE_ENV/be/lib/doris_be 6# doris::cloud::CloudMetaMgr::sync_tablet_rowsets(doris::CloudTablet*, doris::SyncOptions const&, doris::SyncRowsetStats*) at /home/zcp/repo_center/doris_master/doris/be/src/cloud/cloud_meta_mgr.cpp:477 7# doris::CloudSchemaChangeJob::_process_delete_bitmap(long, long, long) at /home/zcp/repo_center/doris_master/doris/be/src/cloud/cloud_schema_change_job.cpp:519 8# doris::CloudSchemaChangeJob::_convert_historical_rowsets(doris::SchemaChangeParams const&, doris::cloud::TabletJobInfoPB&) at /home/zcp/repo_center/doris_master/doris/be/src/cloud/cloud_schema_change_job.cpp:424 9# doris::CloudSchemaChangeJob::process_alter_tablet(doris::TAlterTabletReqV2 const&) in /mnt/hdd01/PERFORMANCE_ENV/be/lib/doris_be 10# doris::alter_cloud_tablet_callback(doris::CloudStorageEngine&, doris::TAgentTaskRequest const&) at /home/zcp/repo_center/doris_master/doris/be/src/agent/task_worker_pool.cpp:2176 11# std::_Function_handler<void (), doris::TaskWorkerPool::submit_task(doris::TAgentTaskRequest const&)::$_0::operator()<doris::TAgentTaskRequest const&>(doris::TAgentTaskRequest const&) const::{lambda()#1}>::_M_invoke(std::_Any_data const&) at /usr/local/ldb-toolchain-v0.26/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_function.h:292 12# doris::ThreadPool::dispatch_thread() at /home/zcp/repo_center/doris_master/doris/be/src/util/threadpool.cpp:621 13# doris::Thread::supervise_thread(void*) at /home/zcp/repo_center/doris_master/doris/be/src/util/thread.cpp:461
1 parent 77b5cb3 commit 42861e6

3 files changed

Lines changed: 185 additions & 0 deletions

File tree

‎be/src/cloud/cloud_schema_change_job.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ Status CloudSchemaChangeJob::_process_delete_bitmap(int64_t alter_version,
484484
RETURN_IF_ERROR(_cloud_storage_engine.register_compaction_stop_token(_new_tablet, initiator));
485485
TabletMetaSharedPtr tmp_meta = std::make_shared<TabletMeta>(*(_new_tablet->tablet_meta()));
486486
tmp_meta->delete_bitmap().delete_bitmap.clear();
487+
tmp_meta->clear_rowsets();
487488
std::shared_ptr<CloudTablet> tmp_tablet =
488489
std::make_shared<CloudTablet>(_cloud_storage_engine, tmp_meta);
489490
{
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
-- This file is automatically generated. You should know what you did if you want to edit this
2+
-- !sql --
3+
0 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
4+
1 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
5+
2 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
6+
3 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
7+
4 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
8+
5 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
9+
6 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
10+
7 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
11+
8 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
12+
9 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
13+
10 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
14+
11 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
15+
12 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
16+
13 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
17+
14 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
18+
15 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
19+
16 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
20+
17 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
21+
18 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
22+
19 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
23+
20 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
24+
21 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
25+
22 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
26+
23 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
27+
24 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
28+
25 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
29+
26 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
30+
27 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
31+
28 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
32+
29 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
33+
30 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
34+
31 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
35+
32 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
36+
33 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
37+
34 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
38+
35 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
39+
36 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
40+
37 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
41+
38 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
42+
39 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
43+
40 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
44+
41 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
45+
42 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
46+
43 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
47+
44 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
48+
45 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
49+
46 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
50+
47 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
51+
48 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
52+
49 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
53+
50 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
54+
51 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
55+
52 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
56+
53 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
57+
54 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
58+
55 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
59+
56 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
60+
57 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
61+
58 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
62+
59 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
63+
60 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
64+
61 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
65+
62 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
66+
63 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
67+
64 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
68+
65 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
69+
66 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
70+
67 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
71+
68 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
72+
69 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
73+
70 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
74+
71 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
75+
72 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
76+
73 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
77+
74 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
78+
75 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
79+
76 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
80+
77 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
81+
78 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
82+
79 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
83+
80 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
84+
81 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
85+
82 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
86+
83 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
87+
84 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
88+
85 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
89+
86 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
90+
87 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
91+
88 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
92+
89 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
93+
90 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
94+
91 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
95+
92 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
96+
93 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
97+
94 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
98+
95 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
99+
96 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
100+
97 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
101+
98 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
102+
99 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
103+
100 2 3 4 5 6.6 1.7 9 a b c 2021-10-30 2021-10-30T00:00
104+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
import java.util.concurrent.TimeUnit
19+
import org.awaitility.Awaitility
20+
21+
suite("test_schema_change_mow_with_empty_rowset", "p0") {
22+
def tableName = "test_sc_mow_with_empty_rowset"
23+
24+
def getJobState = { tbl ->
25+
def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tbl}' ORDER BY createtime DESC LIMIT 1 """
26+
return jobStateResult[0][9]
27+
}
28+
29+
sql """ DROP TABLE IF EXISTS ${tableName} """
30+
31+
sql """
32+
CREATE TABLE IF NOT EXISTS ${tableName} (
33+
`k1` int(11) NULL,
34+
`k2` tinyint(4) NULL,
35+
`k3` smallint(6) NULL,
36+
`k4` int(30) NULL,
37+
`k5` largeint(40) NULL,
38+
`k6` float NULL,
39+
`k7` double NULL,
40+
`k8` decimal(9, 0) NULL,
41+
`k9` char(10) NULL,
42+
`k10` varchar(1024) NULL,
43+
`k11` text NULL,
44+
`k12` date NULL,
45+
`k13` datetime NULL
46+
) ENGINE=OLAP
47+
unique KEY(k1, k2, k3)
48+
DISTRIBUTED BY HASH(`k1`) BUCKETS 2
49+
PROPERTIES (
50+
"replication_allocation" = "tag.location.default: 1",
51+
"enable_unique_key_merge_on_write" = "true"
52+
);
53+
"""
54+
55+
for (int i = 0; i < 100; i++) {
56+
sql """ insert into ${tableName} values ($i, 2, 3, 4, 5, 6.6, 1.7, 8.8,
57+
'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
58+
}
59+
60+
sql """ alter table ${tableName} modify column k4 string NULL"""
61+
62+
for (int i = 0; i < 20; i++) {
63+
sql """ insert into ${tableName} values (100, 2, 3, 4, 5, 6.6, 1.7, 8.8,
64+
'a', 'b', 'c', '2021-10-30', '2021-10-30 00:00:00') """
65+
}
66+
67+
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollDelay(10, TimeUnit.MILLISECONDS).pollInterval(10, TimeUnit.MILLISECONDS).until(
68+
{
69+
String res = getJobState(tableName)
70+
if (res == "FINISHED" || res == "CANCELLED") {
71+
assertEquals("FINISHED", res)
72+
return true
73+
}
74+
return false
75+
}
76+
)
77+
78+
qt_sql """ select * from ${tableName} order by k1, k2, k3 """
79+
}
80+

0 commit comments

Comments
 (0)