This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new e818190e49 [core] Reject non-positive global index read thread counts
(#8853)
e818190e49 is described below
commit e818190e49deddabecb4316274b1d38cfef7821a
Author: QuakeWang <[email protected]>
AuthorDate: Mon Jul 27 16:04:58 2026 +0800
[core] Reject non-positive global index read thread counts (#8853)
---
docs/generated/core_configuration.html | 2 +-
.../main/java/org/apache/paimon/CoreOptions.java | 3 +-
.../globalindex/GlobalIndexReadThreadPool.java | 2 ++
.../globalindex/GlobalIndexReadThreadPoolTest.java | 36 ++++++++++++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/docs/generated/core_configuration.html
b/docs/generated/core_configuration.html
index 435fabede8..6b2523d6d0 100644
--- a/docs/generated/core_configuration.html
+++ b/docs/generated/core_configuration.html
@@ -810,7 +810,7 @@ under the License.
<td><h5>global-index.thread-num</h5></td>
<td style="word-wrap: break-word;">32</td>
<td>Integer</td>
- <td>The maximum number of concurrent threads for global index
I/O.</td>
+ <td>The maximum number of concurrent threads for global index I/O.
Must be greater than 0.</td>
</tr>
<tr>
<td><h5>ignore-delete</h5></td>
diff --git a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
index b395635acd..c8d711e253 100644
--- a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
+++ b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
@@ -2788,7 +2788,8 @@ public class CoreOptions implements Serializable {
.intType()
.defaultValue(32)
.withDescription(
- "The maximum number of concurrent threads for
global index I/O.");
+ "The maximum number of concurrent threads for
global index I/O. "
+ + "Must be greater than 0.");
public static final ConfigOption<Boolean> OVERWRITE_UPGRADE =
key("overwrite-upgrade")
diff --git
a/paimon-core/src/main/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPool.java
b/paimon-core/src/main/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPool.java
index d202003e66..40eed05e63 100644
---
a/paimon-core/src/main/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPool.java
+++
b/paimon-core/src/main/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPool.java
@@ -23,6 +23,7 @@ import org.apache.paimon.utils.SemaphoredDelegatingExecutor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
+import static org.apache.paimon.utils.Preconditions.checkArgument;
import static org.apache.paimon.utils.ThreadPoolUtils.createCachedThreadPool;
/** Shared thread pool for global index read operations. */
@@ -34,6 +35,7 @@ public class GlobalIndexReadThreadPool {
createCachedThreadPool(Runtime.getRuntime().availableProcessors(),
THREAD_NAME);
public static synchronized ExecutorService getExecutorService(int
threadNum) {
+ checkArgument(threadNum > 0, "Option 'global-index.thread-num' must be
greater than 0.");
if (threadNum == executorService.getMaximumPoolSize()) {
return executorService;
}
diff --git
a/paimon-core/src/test/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPoolTest.java
b/paimon-core/src/test/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPoolTest.java
new file mode 100644
index 0000000000..5bb66bda60
--- /dev/null
+++
b/paimon-core/src/test/java/org/apache/paimon/globalindex/GlobalIndexReadThreadPoolTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.globalindex;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link GlobalIndexReadThreadPool}. */
+class GlobalIndexReadThreadPoolTest {
+
+ @ParameterizedTest
+ @ValueSource(ints = {0, -1})
+ void testRejectNonPositiveThreadNum(int threadNum) {
+ assertThatThrownBy(() ->
GlobalIndexReadThreadPool.getExecutorService(threadNum))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Option 'global-index.thread-num' must be greater
than 0.");
+ }
+}