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 org.apache.doris.regression.suite.ClusterOptions
19+ import org.apache.http.NoHttpResponseException
20+ import org.apache.doris.regression.util.DebugPoint
21+ import org.apache.doris.regression.util.NodeType
22+
23+ suite(' test_mow_publish_full_clone_missing_rowset_fault_injection' , ' docker' ) {
24+
25+ def set_be_param = { paramName , paramValue , beIp , bePort ->
26+ def (code, out, err) = curl(" POST" , String . format(" http://%s:%s/api/update_config?%s=%s" , beIp, bePort, paramName, paramValue))
27+ assertTrue (out. contains(" OK" ))
28+ }
29+
30+ def options = new ClusterOptions ()
31+ options. cloudMode = false
32+ options. enableDebugPoints()
33+ options. feConfigs + = [ " disable_tablet_scheduler=true" ]
34+ options. beConfigs + = [ " enable_auto_clone_on_compaction_missing_version=true" ]
35+ options. beConfigs + = [ " tablet_rowset_stale_sweep_time_sec=0" ]
36+ options. beConfigs + = [ " tablet_rowset_stale_sweep_by_size=true" ]
37+ options. beConfigs + = [ " tablet_rowset_stale_sweep_threshold_size=0" ]
38+ options. beNum = 3
39+ docker(options) {
40+
41+ def injectBe = null
42+ def normalBe1 = null
43+ def normalBe2 = null
44+ def backends = sql_return_maparray(' show backends' )
45+
46+ injectBe = backends[0 ]
47+ assertNotNull (injectBe)
48+ normalBe1 = backends[1 ]
49+ assertNotNull (normalBe1)
50+ normalBe2 = backends[2 ]
51+ assertNotNull (normalBe2)
52+
53+ try {
54+ def tableName = " test_mow_publish_full_clone_missing_rowset_fault_injection"
55+ sql """ DROP TABLE IF EXISTS ${ tableName} force"""
56+ sql """
57+ CREATE TABLE IF NOT EXISTS ${ tableName} (
58+ `k` int ,
59+ `v` int ,
60+ ) engine=olap
61+ UNIQUE KEY(k)
62+ DISTRIBUTED BY HASH(k)
63+ BUCKETS 1
64+ properties(
65+ "replication_num" = "3",
66+ "disable_auto_compaction" = "true")
67+ """
68+ sql """ INSERT INTO ${ tableName} VALUES (1,0)"""
69+ DebugPoint . enableDebugPoint(injectBe.Host , injectBe.HttpPort . toInteger(), NodeType . BE , " EnginePublishVersionTask.finish.random" , [percent :" 1.0" ])
70+ sql """ INSERT INTO ${ tableName} VALUES (2,0)"""
71+ DebugPoint . disableDebugPoint(injectBe.Host , injectBe.HttpPort . toInteger(), NodeType . BE , " EnginePublishVersionTask.finish.random" )
72+ sql """ INSERT INTO ${ tableName} VALUES (3,0)"""
73+ sql """ INSERT INTO ${ tableName} VALUES (4,0)"""
74+ sql """ INSERT INTO ${ tableName} VALUES (5,0)"""
75+ sql """ INSERT INTO ${ tableName} VALUES (6,0)"""
76+ sql """ INSERT INTO ${ tableName} VALUES (7,0)"""
77+
78+ def array = sql_return_maparray(" SHOW TABLETS FROM ${ tableName} " )
79+ def tabletId = array[0 ]. TabletId
80+
81+ // normal BEs compaction
82+ logger. info(" normal BE run cumu compaction:" + tabletId)
83+ def (code, out, err) = be_run_cumulative_compaction(normalBe1.Host , normalBe1.HttpPort , tabletId)
84+ logger. info(" normal BE1 Run cumu compaction: code=" + code + " , out=" + out + " , err=" + err)
85+ (code, out, err) = be_run_cumulative_compaction(normalBe2.Host , normalBe2.HttpPort , tabletId)
86+ logger. info(" normal BE2 Run cumu compaction: code=" + code + " , out=" + out + " , err=" + err)
87+
88+ logger. info(" normal BE show:" + tabletId)
89+ (code, out, err) = be_show_tablet_status(normalBe1.Host , normalBe1.HttpPort , tabletId)
90+ logger. info(" normal BE1 show: code=" + code + " , out=" + out + " , err=" + err)
91+ (code, out, err) = be_show_tablet_status(normalBe2.Host , normalBe2.HttpPort , tabletId)
92+ logger. info(" normal BE2 show: code=" + code + " , out=" + out + " , err=" + err)
93+
94+ sleep(10000 )
95+
96+ // 1st inject be check rowsets
97+ logger. info(" 1st inject be show:" + tabletId)
98+ (code, out, err) = be_show_tablet_status(injectBe.Host , injectBe.HttpPort , tabletId)
99+ logger. info(" 1st inject be show: code=" + code + " , out=" + out + " , err=" + err)
100+ assertTrue (out. contains(" [0-1]" ))
101+ assertTrue (out. contains(" [2-2]" ))
102+ assertFalse (out. contains(" [3-3]" ))
103+ assertFalse (out. contains(" [4-4]" ))
104+ assertFalse (out. contains(" [5-5]" ))
105+ assertFalse (out. contains(" [6-6]" ))
106+ assertFalse (out. contains(" [7-7]" ))
107+
108+ set_be_param(" enable_auto_clone_on_mow_publish_missing_version" , " true" , injectBe.Host , injectBe.HttpPort );
109+ Thread . sleep(10000 )
110+ // submit clone task
111+ sql """ INSERT INTO ${ tableName} VALUES (8,0)"""
112+
113+ sleep(30000 )
114+
115+ // 2nd inject be check rowsets
116+ logger. info(" 2nd inject be show:" + tabletId)
117+ (code, out, err) = be_show_tablet_status(injectBe.Host , injectBe.HttpPort , tabletId)
118+ logger. info(" 2nd inject be show: code=" + code + " , out=" + out + " , err=" + err)
119+ assertTrue (out. contains(" [0-1]" ))
120+ assertTrue (out. contains(" [2-8]" ))
121+ assertTrue (out. contains(" [9-9]" ))
122+
123+ // inject be compaction
124+ logger. info(" run cumu compaction:" + tabletId)
125+ (code, out, err) = be_run_cumulative_compaction(injectBe.Host , injectBe.HttpPort , tabletId)
126+ logger. info(" Run cumu compaction: code=" + code + " , out=" + out + " , err=" + err)
127+
128+ logger. info(" 3rd inject be show:" + tabletId)
129+ (code, out, err) = be_show_tablet_status(injectBe.Host , injectBe.HttpPort , tabletId)
130+ logger. info(" 3rd inject be show: code=" + code + " , out=" + out + " , err=" + err)
131+ assertTrue (out. contains(" [0-1]" ))
132+ assertTrue (out. contains(" [2-8]" ))
133+ } finally {
134+ if (injectBe != null ) {
135+ DebugPoint . disableDebugPoint(injectBe.Host , injectBe.HttpPort . toInteger(), NodeType . BE , " EnginePublishVersionTask.finish.random" )
136+ }
137+ }
138+ }
139+ }
0 commit comments