Skip to content

Commit 50a3981

Browse files
pingchunzhang0AyanamiReiairborne12zzzxl1993bobhan1
authored
[fix](regression) make regression test more stability (apache#68449)
Problem Summary: Port the applicable regression fixes The changes primarily stabilize regression coverage around TLS/mTLS clients, Docker test isolation, multi-cluster cleanup, cloud cache and compaction workflows, and asynchronous metadata/schema visibility. They also add delete-bitmap debug barriers used by restart/concurrency regression cases and make Doris Compose container discovery exact and resilient to concurrent container removal. Source review result: 24 applicable PR commits are included. Three source PRs were intentionally skipped because two only touched enterprise-only files that do not exist in Apache Doris and one was an empty commit. --------- Co-authored-by: Refrain <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: zzzxl <[email protected]> Co-authored-by: bobhan1 <[email protected]> Co-authored-by: zhengyu <[email protected]>
1 parent 45e4162 commit 50a3981

351 files changed

Lines changed: 8687 additions & 5305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎be/src/cloud/cloud_engine_calc_delete_bitmap_task.cpp‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ Status CloudTabletCalcDeleteBitmapTask::handle(int64_t queue_time_us) const {
218218
}
219219

220220
int64_t t3 = MonotonicMicros();
221+
DBUG_EXECUTE_IF("CloudEngineCalcDeleteBitmapTask.handle.block_for_restart", {
222+
if (dp->param<int64_t>("tablet_id", -1) == _tablet_id) {
223+
// The restart regression pairs this marker with the persisted MS lock owner.
224+
LOG(INFO) << "delete bitmap restart barrier token="
225+
<< dp->param<std::string>("token", "") << " lock_id=" << _transaction_id
226+
<< " tablet_id=" << _tablet_id;
227+
DBUG_BLOCK;
228+
}
229+
});
221230
DBUG_EXECUTE_IF("CloudEngineCalcDeleteBitmapTask.handle.inject_sleep", {
222231
auto p = dp->param("percent", 0.01);
223232
// 100s > Config.calculate_delete_bitmap_task_timeout_seconds = 60s
@@ -280,6 +289,23 @@ Status CloudTabletCalcDeleteBitmapTask::handle(int64_t queue_time_us) const {
280289
DCHECK(invisible_rowsets.size() == i + 1 - empty_rowset_count);
281290
}
282291
}
292+
DBUG_EXECUTE_IF("CloudTabletCalcDeleteBitmapTask.handle.block_after_calc", {
293+
auto target_tablet_id = dp->param<int64_t>("tablet_id", 0);
294+
auto target_transaction_id = dp->param<int64_t>("transaction_id", 0);
295+
if (status.ok() && target_tablet_id == _tablet_id &&
296+
(target_transaction_id == 0 || target_transaction_id == _transaction_id)) {
297+
// Delay the response after calculation without preventing another transaction from
298+
// calculating the delete bitmap on the same tablet.
299+
wrlock.unlock();
300+
LOG(INFO) << "start debug block after calculating delete bitmap"
301+
<< ", tablet_id=" << _tablet_id << ", txn_id=" << _transaction_id;
302+
while (DebugPoints::instance()->is_enable(DP_NAME)) {
303+
std::this_thread::sleep_for(std::chrono::milliseconds(50));
304+
}
305+
LOG(INFO) << "finish debug block after calculating delete bitmap"
306+
<< ", tablet_id=" << _tablet_id << ", txn_id=" << _transaction_id;
307+
}
308+
});
283309
DBUG_EXECUTE_IF("CloudCalcDbmTask.handle.return.block",
284310
auto target_tablet_id = dp->param<int64_t>("tablet_id", 0);
285311
if (target_tablet_id == tablet->tablet_id()) {DBUG_BLOCK});

‎be/src/cloud/cloud_meta_mgr.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,6 +2382,16 @@ Status CloudMetaMgr::get_delete_bitmap_update_lock(const CloudTablet& tablet, in
23822382
"initiator {}",
23832383
tablet.table_id(), lock_id, initiator);
23842384
}
2385+
DBUG_EXECUTE_IF("CloudMetaMgr.get_delete_bitmap_update_lock.block_for_restart", {
2386+
if (st.ok() && res.status().code() == MetaServiceCode::OK &&
2387+
dp->param<int64_t>("table_id", -1) == tablet.table_id()) {
2388+
// Pause only a successful acquisition, never a conflict or failed RPC.
2389+
LOG(INFO) << "delete bitmap restart barrier token="
2390+
<< dp->param<std::string>("token", "") << " lock_id=" << lock_id
2391+
<< " tablet_id=" << tablet.tablet_id() << " initiator=" << initiator;
2392+
DBUG_BLOCK;
2393+
}
2394+
});
23852395
return st;
23862396
}
23872397

‎docker/runtime/doris-compose/utils.py‎

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import logging
2222
import os
2323
import pwd
24+
import re
2425
import socket
2526
import subprocess
2627
import sys
@@ -145,24 +146,46 @@ def is_container_running(container):
145146

146147
# return all doris containers when cluster_names is empty
147148
def get_doris_containers(cluster_names):
148-
if cluster_names:
149-
if type(cluster_names) == type(""):
150-
filter_names = "{}{}-*".format(DORIS_PREFIX, cluster_names)
151-
else:
152-
filter_names = "|".join([
153-
"{}{}-*".format(DORIS_PREFIX, name) for name in cluster_names
154-
])
149+
import cluster
150+
if isinstance(cluster_names, str):
151+
requested_names = {cluster_names} if cluster_names else set()
155152
else:
156-
filter_names = "{}*".format(DORIS_PREFIX)
153+
requested_names = set(cluster_names or [])
154+
155+
# Docker's name filter matches substrings, so anchor the complete service
156+
# name before the SDK inspects each matching container. Otherwise a lookup
157+
# for "test_vcg" also inspects "test_vcg_warmup..." containers.
158+
name_pattern = ("|".join(re.escape(name) for name in sorted(requested_names))
159+
if requested_names else ".+")
160+
node_pattern = "|".join(re.escape(node_type)
161+
for node_type in cluster.Node.TYPE_ALL)
162+
filter_names = r"^/{}({})-({})-[0-9]+$".format(
163+
re.escape(DORIS_PREFIX), name_pattern, node_pattern)
157164

158165
clusters = {}
159166
client = docker.client.from_env()
160-
containers = client.containers.list(filters={"name": filter_names})
167+
max_list_attempts = 3
168+
for attempt in range(1, max_list_attempts + 1):
169+
try:
170+
# A container may be removed between Docker's list and inspect.
171+
containers = client.containers.list(filters={"name": filter_names},
172+
ignore_removed=True)
173+
break
174+
except docker.errors.NotFound as err:
175+
if attempt == max_list_attempts:
176+
raise
177+
LOG.warning(
178+
"Docker returned 404 while listing Doris containers; "
179+
"retrying enumeration (%d/%d): %s",
180+
attempt,
181+
max_list_attempts,
182+
err,
183+
)
161184
for container in containers:
162185
cluster_name, _, _ = parse_service_name(container.name)
163186
if not cluster_name:
164187
continue
165-
if cluster_names and cluster_name not in cluster_names:
188+
if requested_names and cluster_name not in requested_names:
166189
continue
167190
if cluster_name not in clusters:
168191
clusters[cluster_name] = []
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
-- This file is automatically generated. You should know what you did if you want to edit this
2-
-- !sql --
3-
400
2+
-- !before_alter --
3+
400 79800 3490
4+
5+
-- !after_alter --
6+
400 79800 3490
47

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- This file is automatically generated. You should know what you did if you want to edit this
22
-- !source_preheat --
3-
200
3+
19900 2690
44

55
-- !target_query --
6-
200
6+
19900 2690
77

‎regression-test/data/cloud_p0/cache/ttl/test_show_ttl.out‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎regression-test/data/variant_p0/schema_change/test_double_write_when_schema_change.out‎

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

‎regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy‎

Lines changed: 90 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,9 @@ class Config {
11661166
void fetchCloudMode() {
11671167
if (runMode == RunMode.UNKNOWN) {
11681168
try {
1169-
def result = JdbcUtils.executeToMapArray(getRootConnection(), "SHOW FRONTEND CONFIG LIKE 'cloud_unique_id'")
1169+
def result = getRootConnection().withCloseable { conn ->
1170+
JdbcUtils.executeToMapArray(conn, "SHOW FRONTEND CONFIG LIKE 'cloud_unique_id'")
1171+
}
11701172
runMode = result[0].Value.toString().isEmpty() ? RunMode.NOT_CLOUD : RunMode.CLOUD
11711173
} catch (Throwable t) {
11721174
throw new IllegalStateException("Fetch server config 'cloud_unique_id' failed, jdbcUrl: ${jdbcUrl}", t)
@@ -1176,7 +1178,9 @@ class Config {
11761178

11771179
boolean isClusterKeyEnabled() {
11781180
try {
1179-
def result = JdbcUtils.executeToMapArray(getRootConnection(), "SHOW FRONTEND CONFIG LIKE 'random_add_order_by_keys_for_mow'")
1181+
def result = getRootConnection().withCloseable { conn ->
1182+
JdbcUtils.executeToMapArray(conn, "SHOW FRONTEND CONFIG LIKE 'random_add_order_by_keys_for_mow'")
1183+
}
11801184
log.info("show random_add_order_by_keys_for_mow config: ${result}".toString())
11811185
return result[0].Value.toString().equalsIgnoreCase("true")
11821186
} catch (Throwable t) {
@@ -1220,8 +1224,12 @@ class Config {
12201224
return DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword)
12211225
}
12221226

1227+
String getRootPassword() {
1228+
return (jdbcUser == 'root' && jdbcPassword) ? jdbcPassword : ''
1229+
}
1230+
12231231
Connection getRootConnection() {
1224-
return DriverManager.getConnection(jdbcUrl, 'root', '')
1232+
return DriverManager.getConnection(jdbcUrl, 'root', getRootPassword())
12251233
}
12261234

12271235
Connection getConnectionByDbName(String dbName) {
@@ -1240,21 +1248,35 @@ class Config {
12401248
Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver")
12411249
String arrowFlightSqlHost = otherConfigs.get("extArrowFlightSqlHost")
12421250
String arrowFlightSqlPort = otherConfigs.get("extArrowFlightSqlPort")
1243-
String arrowFlightSqlUrl = "jdbc:arrow-flight-sql://${arrowFlightSqlHost}:${arrowFlightSqlPort}" +
1244-
"/?useServerPrepStmts=false&useSSL=false&useEncryption=false"
1245-
// Arrow 17.0.0-rc03 support jdbc:arrow-flight-sql connect db
1246-
// https://github.com/apache/arrow/issues/41947
1247-
if (dbName?.trim()) {
1248-
arrowFlightSqlUrl = "jdbc:arrow-flight-sql://${arrowFlightSqlHost}:${arrowFlightSqlPort}" +
1249-
"/catalog=" + dbName + "?useServerPrepStmts=false&useSSL=false&useEncryption=false"
1250-
}
1251+
String arrowFlightSqlUrl = getArrowFlightSqlJdbcUrl(arrowFlightSqlHost, arrowFlightSqlPort, dbName)
12511252
tryCreateDbIfNotExist(dbName)
12521253
log.info("connect to ${arrowFlightSqlUrl}".toString())
12531254
String arrowFlightSqlJdbcUser = otherConfigs.get("extArrowFlightSqlUser")
12541255
String arrowFlightSqlJdbcPassword = otherConfigs.get("extArrowFlightSqlPassword")
12551256
return DriverManager.getConnection(arrowFlightSqlUrl, arrowFlightSqlJdbcUser, arrowFlightSqlJdbcPassword)
12561257
}
12571258

1259+
String getArrowFlightSqlJdbcUrl(String host, String port, String dbName = null) {
1260+
// Arrow 17.0.0-rc03 supports selecting the database with /catalog=<dbName>.
1261+
// Flight JDBC uses useEncryption and PEM paths rather than MySQL's useSSL/key stores.
1262+
String catalog = dbName?.trim() ? "catalog=${dbName}" : ""
1263+
boolean enableTls = otherConfigs.get("enableTLS")?.toString()?.equalsIgnoreCase("true") ?: false
1264+
String url = "jdbc:arrow-flight-sql://${host}:${port}/${catalog}?useServerPrepStmts=false&useEncryption=${enableTls}"
1265+
if (enableTls) {
1266+
String verifyMode = otherConfigs.get("tlsVerifyMode")?.toString()?.toLowerCase() ?: "strict"
1267+
if (verifyMode == "none") {
1268+
url += "&disableCertificateVerification=true"
1269+
} else if (otherConfigs.get("trustCACert")) {
1270+
url += "&tlsRootCerts=${otherConfigs.get('trustCACert')}"
1271+
}
1272+
if (otherConfigs.get("trustCert") && otherConfigs.get("trustCAKey")) {
1273+
url += "&clientCertificate=${otherConfigs.get('trustCert')}" +
1274+
"&clientKey=${otherConfigs.get('trustCAKey')}"
1275+
}
1276+
}
1277+
return url
1278+
}
1279+
12581280
Connection getDownstreamConnection() {
12591281
return DriverManager.getConnection(ccrDownstreamUrl, ccrDownstreamUser, ccrDownstreamPassword)
12601282
}
@@ -1321,24 +1343,17 @@ class Config {
13211343
return jdbcUrl
13221344
}
13231345

1324-
String urlWithDb = jdbcUrl
1325-
String urlWithoutSchema = jdbcUrl.substring(jdbcUrl.indexOf("://") + 3)
1326-
if (urlWithoutSchema.indexOf("/") >= 0) {
1327-
if (jdbcUrl.contains("?")) {
1328-
// e.g: jdbc:mysql://locahost:8080/?a=b
1329-
urlWithDb = jdbcUrl.substring(0, jdbcUrl.lastIndexOf("?"))
1330-
urlWithDb = urlWithDb.substring(0, urlWithDb.lastIndexOf("/"))
1331-
urlWithDb += ("/" + dbName) + jdbcUrl.substring(jdbcUrl.lastIndexOf("?"))
1332-
} else {
1333-
// e.g: jdbc:mysql://locahost:8080/
1334-
urlWithDb += dbName
1335-
}
1336-
} else {
1337-
// e.g: jdbc:mysql://locahost:8080
1338-
urlWithDb += ("/" + dbName)
1346+
int authorityStart = jdbcUrl.indexOf("://") + 3
1347+
int queryStart = jdbcUrl.indexOf("?", authorityStart)
1348+
int pathStart = jdbcUrl.indexOf("/", authorityStart)
1349+
if (pathStart >= 0 && (queryStart < 0 || pathStart < queryStart)) {
1350+
return jdbcUrl.substring(0, pathStart + 1) + dbName +
1351+
(queryStart >= 0 ? jdbcUrl.substring(queryStart) : "")
13391352
}
1340-
1341-
return urlWithDb
1353+
if (queryStart >= 0) {
1354+
return jdbcUrl.substring(0, queryStart) + "/" + dbName + jdbcUrl.substring(queryStart)
1355+
}
1356+
return jdbcUrl + "/" + dbName
13421357
}
13431358

13441359
public static String buildUrlWithDb(String jdbcUrl, String dbName) {
@@ -1351,8 +1366,7 @@ class Config {
13511366

13521367
public static String buildUrlWithDb (String jdbcUrl, String dbName, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword) {
13531368
String urlWithDb = buildUrlWithDbImpl(jdbcUrl, dbName);
1354-
urlWithDb = addTlsUrl(urlWithDb, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword);
1355-
urlWithDb = addTimeoutUrl(urlWithDb);
1369+
urlWithDb = buildTlsJdbcUrl(urlWithDb, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword);
13561370
return urlWithDb
13571371
}
13581372

@@ -1364,8 +1378,27 @@ class Config {
13641378
return url
13651379
}
13661380

1381+
public static String buildUrlWithDb(String host, int queryPort, String dbName,
1382+
String keyStorePath, String keyStorePassword,
1383+
String trustStorePath, String trustStorePassword) {
1384+
def url = String.format(
1385+
"jdbc:mysql://%s:%s/?useLocalSessionState=true&allowLoadLocalInfile=false",
1386+
host, queryPort)
1387+
url = buildUrlWithDb(url, dbName, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword)
1388+
return url
1389+
}
1390+
1391+
public static String buildTlsJdbcUrl(String jdbcUrl, String keyStorePath, String keyStorePassword,
1392+
String trustStorePath, String trustStorePassword) {
1393+
String tlsUrl = addTlsUrl(jdbcUrl, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword)
1394+
return addTimeoutUrl(tlsUrl)
1395+
}
1396+
13671397
private static String addSslUrl(String url) {
1368-
if (url.contains("TLS")) {
1398+
// A configured TLS URL already has its own verification policy and key stores.
1399+
// Appending the optional-SSL defaults would override requireSSL and certificate verification.
1400+
if (url.contains("useSSL=") || url.contains("sslMode=") ||
1401+
url.contains("clientCertificateKeyStoreUrl=") || url.contains("trustCertificateKeyStoreUrl=")) {
13691402
return url
13701403
}
13711404
// ssl-mode = PREFERRED
@@ -1387,25 +1420,33 @@ class Config {
13871420
}
13881421

13891422
private static String addTlsUrl(String url, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword) {
1390-
// ssl-mode = PREFERRED
1391-
String useSsl = "true"
1392-
String requireSsl = "true"
1393-
String useSslconfig = "useSSL=" + useSsl + "&requireSSL=" + requireSsl + "&verifyServerCertificate=true"
1394-
String clientCAKey = "clientCertificateKeyStoreUrl=file:" + keyStorePath
1395-
String clientCAPwd = "clientCertificateKeyStorePassword=" + keyStorePassword
1396-
String trustCAKey = "trustCertificateKeyStoreUrl=file:" + trustStorePath
1397-
String trustCAPwd = "trustCertificateKeyStorePassword=" + trustStorePassword
1398-
String tlsUrl = useSslconfig + "&" + clientCAKey + "&" + clientCAPwd + "&" + trustCAKey + "&" + trustCAPwd
1399-
// e.g: jdbc:mysql://locahost:8080/dbname?
1400-
if (url.charAt(url.length() - 1) == '?') {
1401-
return url + tlsUrl
1402-
// e.g: jdbc:mysql://locahost:8080/dbname?a=b
1403-
} else if (url.contains('?')) {
1404-
return url + '&' + tlsUrl
1405-
// e.g: jdbc:mysql://locahost:8080/dbname
1406-
} else {
1407-
return url + '?' + tlsUrl
1423+
int queryStart = url.indexOf('?')
1424+
String baseUrl = queryStart >= 0 ? url.substring(0, queryStart) : url
1425+
List<String> options = new ArrayList<>()
1426+
Set<String> tlsOptions = new HashSet<>(Arrays.asList(
1427+
"sslMode", "useSSL", "requireSSL", "verifyServerCertificate",
1428+
"clientCertificateKeyStoreUrl", "clientCertificateKeyStorePassword",
1429+
"trustCertificateKeyStoreUrl", "trustCertificateKeyStorePassword"))
1430+
if (queryStart >= 0) {
1431+
for (String option : url.substring(queryStart + 1).split('&')) {
1432+
if (option.isEmpty()) {
1433+
continue
1434+
}
1435+
int equals = option.indexOf('=')
1436+
String name = equals >= 0 ? option.substring(0, equals) : option
1437+
if (!tlsOptions.contains(name)) {
1438+
options.add(option)
1439+
}
1440+
}
14081441
}
1442+
options.add("useSSL=true")
1443+
options.add("requireSSL=true")
1444+
options.add("verifyServerCertificate=true")
1445+
options.add("clientCertificateKeyStoreUrl=file:" + keyStorePath)
1446+
options.add("clientCertificateKeyStorePassword=" + keyStorePassword)
1447+
options.add("trustCertificateKeyStoreUrl=file:" + trustStorePath)
1448+
options.add("trustCertificateKeyStorePassword=" + trustStorePassword)
1449+
return baseUrl + "?" + String.join("&", options)
14091450
}
14101451

14111452
private static String addTimeoutUrl(String url) {

0 commit comments

Comments
 (0)