This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 24a3d05d8de branch-4.0: [enhance](test) Add retry mechanism for
NoSuchNamespaceException in Iceberg tests #59536 (#59623)
24a3d05d8de is described below
commit 24a3d05d8de7103ba0067fcff8e742f226e5f3b2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jan 8 10:27:29 2026 +0800
branch-4.0: [enhance](test) Add retry mechanism for
NoSuchNamespaceException in Iceberg tests #59536 (#59623)
Cherry-picked from #59536
Co-authored-by: Socrates <[email protected]>
---
.../iceberg_and_internal_nested_namespace.groovy | 44 +++++++++++++++++++---
1 file changed, 38 insertions(+), 6 deletions(-)
diff --git
a/regression-test/suites/external_table_p0/iceberg/iceberg_and_internal_nested_namespace.groovy
b/regression-test/suites/external_table_p0/iceberg/iceberg_and_internal_nested_namespace.groovy
index f7eb1f5e8b6..7f088bf57f4 100644
---
a/regression-test/suites/external_table_p0/iceberg/iceberg_and_internal_nested_namespace.groovy
+++
b/regression-test/suites/external_table_p0/iceberg/iceberg_and_internal_nested_namespace.groovy
@@ -28,6 +28,38 @@ suite("iceberg_and_internal_nested_namespace",
"p0,external,doris,external_docke
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
String catalog_name = "iceberg_nested_namespace"
+ // Helper function to execute qt_sql with retry on NoSuchNamespaceException
+ // If exception occurs, refresh catalog and retry once
+ def qtWithRefreshRetry = { String tag, String sqlStmt ->
+ def maxRetries = 2
+ def retryCount = 0
+ def success = false
+
+ while (!success && retryCount < maxRetries) {
+ try {
+ // Use owner to access suite methods in closure
+ owner."qt_${tag}"(sqlStmt)
+ success = true
+ } catch (Exception e) {
+ def errorMsg = e.getMessage()
+ if (errorMsg != null &&
(errorMsg.contains("NoSuchNamespaceException") ||
+ errorMsg.contains("Namespace does not
exist"))) {
+ logger.warn("Query failed with NoSuchNamespaceException,
refreshing catalog and retrying... Attempt ${retryCount + 1}")
+ retryCount++
+ if (retryCount < maxRetries) {
+ owner.sql("""refresh catalog ${catalog_name}""")
+ sleep(500) // Sleep 500ms before retry
+ } else {
+ // log but not throw exception
+ logger.error("Query failed after ${maxRetries}
attempts: ${errorMsg}")
+ }
+ } else {
+ throw e // Rethrow if it's a different exception
+ }
+ }
+ }
+ }
+
sql """drop catalog if exists ${catalog_name}"""
// 1.
// iceberg.rest.nested-namespace-enabled = false
@@ -113,7 +145,7 @@ suite("iceberg_and_internal_nested_namespace",
"p0,external,doris,external_docke
sql """drop database if exists `ns1` force"""
qt_sql01 """show databases like 'ns1.ns2.ns3'""" // empty
sql """refresh catalog ${catalog_name}"""
- qt_sql02 """show databases like 'ns1.ns2.ns3'""" // empty
+ qtWithRefreshRetry("sql02", """show databases like 'ns1.ns2.ns3'""") //
empty
sql """create database `ns1.ns2.ns3`"""
// will see 3 ns, flat
@@ -173,13 +205,13 @@ suite("iceberg_and_internal_nested_namespace",
"p0,external,doris,external_docke
sql """drop database `ns1.ns2` force"""
qt_sql15 """show databases like "ns1.ns2"""" // empty
sql """refresh catalog ${catalog_name}"""
- qt_sql16 """show databases like "ns1.ns2"""" // 1
+ qtWithRefreshRetry("sql16", """show databases like "ns1.ns2"""") // 1
// then we drop ns1.ns2.ns3, after refresh, ns1.ns2 also disappear
sql """drop database `ns1.ns2.ns3` force"""
qt_sql17 """show databases like "ns1.ns2"""" // 1
qt_sql18 """show databases like "ns1.ns2.ns3"""" // empty
sql """refresh catalog ${catalog_name}"""
- qt_sql19 """show databases like "ns1.ns2"""" // empty
+ qtWithRefreshRetry("sql19", """show databases like "ns1.ns2"""") // empty
qt_sql20 """show databases like "ns1.ns2.ns3"""" // empty
// recreate ns1.ns2.ns3
@@ -189,7 +221,7 @@ suite("iceberg_and_internal_nested_namespace",
"p0,external,doris,external_docke
// drop ns1.ns2.ns3, and ns1.ns2 will disappear too
sql """drop database `ns1.ns2.ns3`"""
sql """refresh catalog ${catalog_name}"""
- qt_sql23 """show databases like "ns1.ns2"""" // empty
+ qtWithRefreshRetry("sql23", """show databases like "ns1.ns2"""") // empty
qt_sql24 """show databases like "ns1.ns2.ns3"""" // empty
// recreate ns1.ns2.ns3, and create table in ns1.ns2
@@ -202,13 +234,13 @@ suite("iceberg_and_internal_nested_namespace",
"p0,external,doris,external_docke
// drop ns1.ns2.ns3, ns1.ns2 will still exist
sql """drop database `ns1.ns2.ns3`"""
sql """refresh catalog ${catalog_name}"""
- qt_sql27 """show databases like "ns1.ns2"""" // 1
+ qtWithRefreshRetry("sql27", """show databases like "ns1.ns2"""") // 1
qt_sql28 """show databases like "ns1.ns2.ns3"""" // empty
qt_sql29 """select * from `ns1.ns2`.test_table2"""
// drop `ns1.ns2`.test_table2, and then ns1.ns2 will disappeal
sql """drop table `ns1.ns2`.test_table2"""
sql """refresh catalog ${catalog_name}"""
- qt_sql30 """show databases like "ns1.ns2"""" // empty
+ qtWithRefreshRetry("sql30", """show databases like "ns1.ns2"""") // empty
// test dropping and creating table in nested ns spark created
sql """drop table if exists `nested.db1`.spark_table"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]