This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new ef9c7ee2586 [Feature][Connector-V2] Add bounded Couchbase batch source 
(#12829)
ef9c7ee2586 is described below

commit ef9c7ee2586c97115ecc0baf6d928cba4f46d6d9
Author: Goutam Adwant <[email protected]>
AuthorDate: Mon Nov 23 11:39:02 2026 +0000

    [Feature][Connector-V2] Add bounded Couchbase batch source (#12829)
    
    Signed-off-by: Goutam Adwant <[email protected]>
    Co-authored-by: zhiweiniu <[email protected]>
---
 docs/en/connectors/source/Couchbase.md             | 106 +++
 docs/zh/connectors/source/Couchbase.md             | 106 +++
 plugin-mapping.properties                          |   1 +
 .../connector-couchbase/pom.xml                    |   6 +
 .../couchbase/config/CouchbaseConfig.java          |   5 +-
 .../couchbase/config/CouchbaseSourceOptions.java   |  39 +
 .../couchbase/source/CouchbaseSource.java          |  61 ++
 .../couchbase/source/CouchbaseSourceFactory.java   |  91 +++
 .../couchbase/source/CouchbaseSourceReader.java    | 310 ++++++++
 .../couchbase/source/CouchbaseSourceTest.java      | 836 +++++++++++++++++++++
 .../connector-couchbase-e2e/pom.xml                |   6 +
 .../e2e/connector/couchbase/CouchbaseIT.java       | 465 +++++++++++-
 .../couchbase/CouchbaseSourceConfigTest.java       |  61 ++
 .../test/resources/couchbase_source_to_assert.conf |  98 +++
 14 files changed, 2180 insertions(+), 11 deletions(-)

diff --git a/docs/en/connectors/source/Couchbase.md 
b/docs/en/connectors/source/Couchbase.md
new file mode 100644
index 00000000000..cc4307f9fc4
--- /dev/null
+++ b/docs/en/connectors/source/Couchbase.md
@@ -0,0 +1,106 @@
+import ChangeLog from '../changelog/connector-couchbase.md';
+
+# Couchbase
+
+> Couchbase source connector
+
+## Description
+
+Read JSON documents from one Couchbase collection using a bounded SQL++ query. 
The existing Couchbase sink is unchanged.
+
+## Supported DataSource Info
+
+| DataSource | Supported versions |
+|------------|--------------------|
+| Couchbase Server | 7.x |
+
+## Key features
+
+- [x] batch
+- [ ] stream
+- [ ] exactly-once
+- [ ] parallelism
+- [ ] schema evolution
+
+The source requires `parallelism = 1`. It uses a single query and consumes 
rows with backpressure instead of loading the full result into memory. It does 
not partition the collection into splits or use `LIMIT`/`OFFSET` pagination.
+
+## Options
+
+| Name | Type | Required | Default | Description |
+|------|------|----------|---------|-------------|
+| connection.string | String | Yes | - | Couchbase SDK connection string, for 
example `couchbase://localhost`. Use `couchbases://` for TLS. |
+| username | String | Yes | - | Couchbase username. |
+| password | String | Yes | - | Couchbase password. |
+| bucket | String | Yes | - | Bucket to read. |
+| scope | String | No | _default | Scope within the bucket. |
+| collection | String | Yes | - | Collection to read. |
+| schema | Config | Yes | - | Explicit output schema; fields refer to document 
fields with matching names. |
+| ready.timeout | Int | No | 30 | Bucket readiness timeout, in seconds. Must 
be positive. |
+| query.timeout | Int | No | 300 | Timeout for the whole collection query, 
including server-side result streaming, in seconds. Not just time to the first 
row. Must be positive; increase for large collections or slow downstream 
consumers. |
+| common-options | Config | No | - | See [Source Common 
Options](../common-options/source-common-options.md). |
+
+## Prerequisites
+
+Enable the Couchbase Data, Query and Index services. A suitable index must 
exist on the collection; a primary index supports the full collection scan. 
Index creation and data administration are not performed by this connector.
+
+The configured account needs permission to query the selected collection. 
Grant only the required access; an administrator account is not required. For 
TLS, use `couchbases://`. The SDK trusts public CAs and the bundled Capella CA; 
for a private CA, set `security.trustCertificate=/path/to/ca.pem` as a 
connection-string parameter and make that file available on every worker. 
Certificate hostname verification remains enabled.
+
+## Data mapping
+
+The source selects each document body, without document IDs or metadata, and 
uses SeaTunnel's JSON format conversion with the configured schema. Field 
matching is case-sensitive. Fields not in the schema are ignored. Missing 
fields and explicit JSON null values become null. Invalid values fail the read 
rather than being silently skipped.
+
+JSON strings, booleans, numbers, arrays and nested objects are converted to 
their configured SeaTunnel types using the JSON format's rules. Declare nested 
objects as ROW and arrays as ARRAY; no schema inference is performed. 
Non-object JSON documents and binary documents are not supported.
+
+Numeric values are preserved from the SQL++ response without an additional 
floating-point conversion in the connector. Couchbase itself can round numeric 
values during query evaluation; declaring DECIMAL cannot recover precision 
already lost by the server. Store exact high-precision decimal values as JSON 
strings when necessary.
+
+## Consistency and recovery
+
+The query is read-only and uses `REQUEST_PLUS` so that indexes catch up with 
mutations preceding the query. This is not a transactionally consistent 
snapshot: concurrent updates may affect the results. Quiesce writes if the job 
requires a stable export.
+
+The source checkpoints no document offset. On failure or restoration, it 
starts a new collection query from the beginning. Rows already emitted may be 
replayed, and concurrent collection changes can alter the new result. Use an 
idempotent downstream write strategy when replay is possible. This source does 
not provide exactly-once delivery, CDC, or incremental reads.
+
+`query.timeout` applies to the whole server-side query, including streaming 
the results, not only starting the query or receiving the first row. Although 
the SDK cancels its client-side request timer once streaming begins, Couchbase 
Server still enforces the query timeout and can fail the stream with error 
1080. Downstream backpressure can therefore cause a long export to time out. 
This is not a separate deadline on processing rows already received from the 
server.
+
+The default remains 300 seconds (5 minutes). For large collections or slow 
downstream consumers, set `query.timeout` above the expected full export 
duration, allowing headroom for index catch-up, server load and downstream 
backpressure. For example, `query.timeout = 3600` provides a one-hour query 
budget; size it for your workload rather than treating this example as 
sufficient for every collection. A timeout fails the read without reporting 
successful completion. Recovery reruns the ful [...]
+
+Cancellation stops an in-flight query, and reader closure releases the SDK 
connection. If cancellation occurs during the synchronous initial 
bucket-readiness check, that check can still run until `ready.timeout` (30 
seconds by default). When the reader observes cancellation after readiness, 
opening fails and releases the connection. Query, authentication and conversion 
failures fail the job; they do not report a successfully completed collection.
+
+## Example
+
+Create a primary index for the collection before running the job:
+
+```sql
+CREATE PRIMARY INDEX ON `example`.`_default`.`users`;
+```
+
+```hocon
+env {
+  job.mode = "BATCH"
+  parallelism = 1
+}
+source {
+  Couchbase {
+    connection.string = "couchbase://localhost"
+    username = "reader"
+    password = ${COUCHBASE_PASSWORD}
+    bucket = "example"
+    scope = "_default"
+    collection = "users"
+    schema {
+      fields {
+        id = INT
+        name = STRING
+        active = BOOLEAN
+        score = DOUBLE
+      }
+    }
+  }
+}
+sink {
+  Console {}
+}
+```
+
+## Changelog
+
+<ChangeLog />
diff --git a/docs/zh/connectors/source/Couchbase.md 
b/docs/zh/connectors/source/Couchbase.md
new file mode 100644
index 00000000000..8909de4b828
--- /dev/null
+++ b/docs/zh/connectors/source/Couchbase.md
@@ -0,0 +1,106 @@
+import ChangeLog from '../changelog/connector-couchbase.md';
+
+# Couchbase
+
+> Couchbase 数据源连接器
+
+## 描述
+
+通过有界 SQL++ 查询读取一个 Couchbase 集合中的 JSON 文档。现有 Couchbase Sink 行为保持不变。
+
+## 支持的数据源信息
+
+| 数据源 | 支持版本 |
+|--------|----------|
+| Couchbase Server | 7.x |
+
+## 主要特性
+
+- [x] 批处理
+- [ ] 流处理
+- [ ] 精确一次
+- [ ] 并行读取
+- [ ] Schema 演变
+
+数据源要求 `parallelism = 1`。使用单个查询并以背压方式消费结果,不会一次性将全部结果加载到内存。不会将集合划分为多个 split,也不使用 
`LIMIT`/`OFFSET` 分页。
+
+## 配置项
+
+| 名称 | 类型 | 必填 | 默认值 | 描述 |
+|------|------|------|--------|------|
+| connection.string | String | 是 | - | Couchbase SDK 连接字符串,例如 
`couchbase://localhost`。TLS 连接使用 `couchbases://`。 |
+| username | String | 是 | - | Couchbase 用户名。 |
+| password | String | 是 | - | Couchbase 密码。 |
+| bucket | String | 是 | - | 要读取的桶。 |
+| scope | String | 否 | _default | 桶中的作用域。 |
+| collection | String | 是 | - | 要读取的集合。 |
+| schema | Config | 是 | - | 显式输出 Schema,字段名称与文档字段对应。 |
+| ready.timeout | Int | 否 | 30 | 等待桶就绪的超时时间,单位秒,必须为正数。 |
+| query.timeout | Int | 否 | 300 | 
整个集合查询的超时时间,包括服务端流式发送结果的时间,单位秒,而非仅等待首行的时间。必须为正数;大集合或下游消费较慢时应增大此值。 |
+| common-options | Config | 否 | - | 请参阅 [Source 
通用配置](../common-options/source-common-options.md)。 |
+
+## 前置条件
+
+启用 Couchbase Data、Query 和 Index 
服务。集合需要可支持查询的索引;主索引可以支持全量集合扫描。连接器不会创建索引或执行数据管理操作。
+
+账号需要查询目标集合的权限。只授予所需权限,无需管理员账号。TLS 连接使用 `couchbases://`。SDK 默认信任公共 CA 和内置的 
Capella CA;若使用私有 CA,可在连接字符串中设置 
`security.trustCertificate=/path/to/ca.pem`,并确保每个 worker 都能访问该文件。证书主机名校验保持启用。
+
+## 数据映射
+
+读取文档正文,不包含文档 ID 或元数据,并通过 SeaTunnel JSON 格式转换器按照显式 Schema 进行转换。字段名称区分大小写,Schema 
中未定义的字段会被忽略。缺失字段和显式 JSON null 均转换为 null。无效值会导致读取失败,不会被静默跳过。
+
+JSON 字符串、布尔值、数值、数组和嵌套对象按照 JSON 格式转换规则映射到配置的 SeaTunnel 类型。嵌套对象声明为 ROW,数组声明为 
ARRAY;不进行 Schema 推断。不支持非对象 JSON 文档和二进制文档。
+
+连接器保留 SQL++ 响应中的数值表示,不进行额外的浮点转换。Couchbase 在查询计算中可能已经对数值舍入;声明 DECIMAL 
不能恢复服务器已经丢失的精度。如需精确的高精度小数,可在 JSON 中将其存储为字符串。
+
+## 一致性与恢复
+
+查询为只读并使用 
`REQUEST_PLUS`,等待索引追上查询之前的写入。这不是事务一致性快照,并发更新可能影响结果。如需稳定导出,请在读取期间停止修改源集合。
+
+数据源不保存文档偏移量。失败或恢复时将重新执行整个集合查询,已经输出的行可能重放,并发修改也可能改变重新查询的结果。存在重放风险时,请采用幂等下游写入方式。不提供精确一次、CDC
 或增量读取。
+
+`query.timeout` 约束整个服务端查询,包括流式发送结果的时间,而非仅查询启动或接收首行的时间。虽然 SDK 
在开始流式接收后会取消客户端请求计时器,Couchbase Server 仍会执行查询超时限制,并可能以错误码 1080 
终止结果流。因此,下游背压可能导致长时间导出超时。此配置并不是针对客户端处理已接收行的独立截止时间。
+
+默认值保持为 300 秒(5 分钟)。对于大集合或下游消费较慢的场景,应将 `query.timeout` 
设置为大于预计完整导出耗时的值,并为索引追赶、服务端负载和下游背压预留余量。例如,`query.timeout = 3600` 
提供一小时的查询预算;请按实际工作负载调整,不应认为该示例值适用于所有集合。超时会导致读取失败,不会报告成功完成。恢复时将重新执行完整查询,而不是从最后输出的行继续;保持相同的超时配置可能导致反复失败而无法完成导出。即使集合内容不变,也不保证行的返回顺序。
+
+取消任务会终止正在执行的查询;读取器关闭时释放 SDK 连接。如果取消发生在同步的初始 bucket 就绪检查期间,该检查仍可能运行到 
`ready.timeout`(默认 30 
秒)。读取器在就绪检查后发现取消时,打开操作会失败并释放连接。查询、认证和转换错误会导致任务失败,不会将失败的读取报告为成功完成。
+
+## 示例
+
+运行任务前先为集合创建主索引:
+
+```sql
+CREATE PRIMARY INDEX ON `example`.`_default`.`users`;
+```
+
+```hocon
+env {
+  job.mode = "BATCH"
+  parallelism = 1
+}
+source {
+  Couchbase {
+    connection.string = "couchbase://localhost"
+    username = "reader"
+    password = ${COUCHBASE_PASSWORD}
+    bucket = "example"
+    scope = "_default"
+    collection = "users"
+    schema {
+      fields {
+        id = INT
+        name = STRING
+        active = BOOLEAN
+        score = DOUBLE
+      }
+    }
+  }
+}
+sink {
+  Console {}
+}
+```
+
+## 更新日志
+
+<ChangeLog />
diff --git a/plugin-mapping.properties b/plugin-mapping.properties
index a87d3a9c43a..aa5c3dcc7f3 100644
--- a/plugin-mapping.properties
+++ b/plugin-mapping.properties
@@ -83,6 +83,7 @@ seatunnel.sink.Sentry = connector-sentry
 seatunnel.source.Sentry = connector-sentry
 seatunnel.source.MongoDB = connector-mongodb
 seatunnel.sink.MongoDB = connector-mongodb
+seatunnel.source.Couchbase = connector-couchbase
 seatunnel.sink.Couchbase = connector-couchbase
 seatunnel.source.Iceberg = connector-iceberg
 seatunnel.sink.Iceberg = connector-iceberg
diff --git a/seatunnel-connectors-v2/connector-couchbase/pom.xml 
b/seatunnel-connectors-v2/connector-couchbase/pom.xml
index a1ed2afef00..93158bbc160 100644
--- a/seatunnel-connectors-v2/connector-couchbase/pom.xml
+++ b/seatunnel-connectors-v2/connector-couchbase/pom.xml
@@ -32,6 +32,12 @@
     </properties>
 
     <dependencies>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-format-json</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.seatunnel</groupId>
             <artifactId>connector-common</artifactId>
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseConfig.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseConfig.java
index f08c5751663..51bcdfa79bf 100644
--- 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseConfig.java
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseConfig.java
@@ -53,7 +53,7 @@ public class CouchbaseConfig extends ConnectorCommonOptions {
             Options.key("bucket")
                     .stringType()
                     .noDefaultValue()
-                    .withDescription("The name of the Couchbase bucket to 
write to.");
+                    .withDescription("The name of the Couchbase bucket to read 
from or write to.");
 
     /** Target scope name. Defaults to the default scope. */
     public static final Option<String> SCOPE =
@@ -68,5 +68,6 @@ public class CouchbaseConfig extends ConnectorCommonOptions {
             Options.key("collection")
                     .stringType()
                     .noDefaultValue()
-                    .withDescription("The name of the Couchbase collection to 
write to.");
+                    .withDescription(
+                            "The name of the Couchbase collection to read from 
or write to.");
 }
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseSourceOptions.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseSourceOptions.java
new file mode 100644
index 00000000000..34e2e5bc5f2
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/config/CouchbaseSourceOptions.java
@@ -0,0 +1,39 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.couchbase.config;
+
+import org.apache.seatunnel.api.configuration.Option;
+import org.apache.seatunnel.api.configuration.Options;
+
+public class CouchbaseSourceOptions extends CouchbaseConfig {
+    public static final Option<Integer> READY_TIMEOUT =
+            Options.key("ready.timeout")
+                    .intType()
+                    .defaultValue(30)
+                    .withDescription("Seconds to wait for the Couchbase bucket 
to become ready.");
+    public static final Option<Integer> QUERY_TIMEOUT =
+            Options.key("query.timeout")
+                    .intType()
+                    .defaultValue(300)
+                    .withDescription(
+                            "Timeout in seconds for the whole collection 
query, including server-side"
+                                    + " result streaming, not just the first 
row. Increase this budget"
+                                    + " for large collections or slow 
downstream consumers. A timeout"
+                                    + " fails the read; recovery restarts from 
the beginning, not a"
+                                    + " checkpointed offset.");
+}
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSource.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSource.java
new file mode 100644
index 00000000000..2588e080526
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSource.java
@@ -0,0 +1,61 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.couchbase.source;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.source.Boundedness;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitSource;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import 
org.apache.seatunnel.connectors.seatunnel.couchbase.config.CouchbaseSourceOptions;
+
+import java.util.Collections;
+import java.util.List;
+
+/** A bounded collection scan. An interrupted scan is restarted from its 
beginning. */
+public class CouchbaseSource extends AbstractSingleSplitSource<SeaTunnelRow> {
+    private final ReadonlyConfig config;
+    private final CatalogTable catalogTable;
+
+    public CouchbaseSource(ReadonlyConfig config, CatalogTable catalogTable) {
+        this.config = config;
+        this.catalogTable = catalogTable;
+    }
+
+    @Override
+    public String getPluginName() {
+        return CouchbaseSourceOptions.CONNECTOR_IDENTITY;
+    }
+
+    @Override
+    public Boundedness getBoundedness() {
+        return Boundedness.BOUNDED;
+    }
+
+    @Override
+    public List<CatalogTable> getProducedCatalogTables() {
+        return Collections.singletonList(catalogTable);
+    }
+
+    @Override
+    public AbstractSingleSplitReader<SeaTunnelRow> 
createReader(SingleSplitReaderContext context) {
+        return new CouchbaseSourceReader(config, catalogTable, context);
+    }
+}
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceFactory.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceFactory.java
new file mode 100644
index 00000000000..475bb720112
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceFactory.java
@@ -0,0 +1,91 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.couchbase.source;
+
+import org.apache.seatunnel.api.configuration.util.ConfigValidator;
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import org.apache.seatunnel.api.configuration.util.OptionValidationException;
+import org.apache.seatunnel.api.source.SeaTunnelSource;
+import org.apache.seatunnel.api.source.SourceSplit;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.CatalogTableUtil;
+import org.apache.seatunnel.api.table.connector.TableSource;
+import org.apache.seatunnel.api.table.factory.Factory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactory;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import 
org.apache.seatunnel.connectors.seatunnel.couchbase.config.CouchbaseSourceOptions;
+
+import com.google.auto.service.AutoService;
+
+import java.io.Serializable;
+
+import static 
org.apache.seatunnel.api.configuration.util.Conditions.greaterThan;
+import static org.apache.seatunnel.api.configuration.util.Conditions.notBlank;
+
+/** Creates a bounded, single-split source that requires parallelism 1 and an 
explicit schema. */
+@AutoService(Factory.class)
+public class CouchbaseSourceFactory implements TableSourceFactory {
+    @Override
+    public String factoryIdentifier() {
+        return CouchbaseSourceOptions.CONNECTOR_IDENTITY;
+    }
+
+    @Override
+    public Class<? extends SeaTunnelSource> getSourceClass() {
+        return CouchbaseSource.class;
+    }
+
+    @Override
+    public OptionRule optionRule() {
+        return OptionRule.builder()
+                .required(
+                        CouchbaseSourceOptions.CONNECTION_STRING,
+                        notBlank(CouchbaseSourceOptions.CONNECTION_STRING))
+                .required(
+                        CouchbaseSourceOptions.USERNAME, 
notBlank(CouchbaseSourceOptions.USERNAME))
+                .required(CouchbaseSourceOptions.PASSWORD)
+                .required(CouchbaseSourceOptions.BUCKET, 
notBlank(CouchbaseSourceOptions.BUCKET))
+                .required(
+                        CouchbaseSourceOptions.COLLECTION,
+                        notBlank(CouchbaseSourceOptions.COLLECTION))
+                .required(CouchbaseSourceOptions.SCHEMA)
+                .optional(CouchbaseSourceOptions.SCOPE, 
notBlank(CouchbaseSourceOptions.SCOPE))
+                .optional(
+                        CouchbaseSourceOptions.READY_TIMEOUT,
+                        greaterThan(CouchbaseSourceOptions.READY_TIMEOUT, 0))
+                .optional(
+                        CouchbaseSourceOptions.QUERY_TIMEOUT,
+                        greaterThan(CouchbaseSourceOptions.QUERY_TIMEOUT, 0))
+                .build();
+    }
+
+    @Override
+    public <T, SplitT extends SourceSplit, StateT extends Serializable>
+            TableSource<T, SplitT, StateT> 
createSource(TableSourceFactoryContext context) {
+        ConfigValidator.of(context.getOptions()).validate(optionRule());
+        CatalogTable table =
+                CatalogTableUtil.buildWithConfig(factoryIdentifier(), 
context.getOptions());
+        if (table.getSeaTunnelRowType().getTotalFields() == 0) {
+            throw new OptionValidationException(
+                    "Couchbase source requires non-empty schema.fields");
+        }
+        return () ->
+                (SeaTunnelSource<T, SplitT, StateT>)
+                        new CouchbaseSource(context.getOptions(), table);
+    }
+}
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceReader.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceReader.java
new file mode 100644
index 00000000000..c117a7f8b4c
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceReader.java
@@ -0,0 +1,310 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.couchbase.source;
+
+import org.apache.seatunnel.shade.com.fasterxml.jackson.databind.JsonNode;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import 
org.apache.seatunnel.connectors.seatunnel.couchbase.config.CouchbaseSourceOptions;
+import org.apache.seatunnel.format.json.JsonDeserializationSchema;
+
+import com.couchbase.client.java.Cluster;
+import com.couchbase.client.java.codec.DefaultJsonSerializer;
+import com.couchbase.client.java.codec.JsonSerializer;
+import com.couchbase.client.java.query.QueryOptions;
+import com.couchbase.client.java.query.QueryScanConsistency;
+import reactor.core.publisher.Sinks;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Iterator;
+import java.util.concurrent.CancellationException;
+import java.util.stream.Stream;
+
+public class CouchbaseSourceReader extends 
AbstractSingleSplitReader<SeaTunnelRow> {
+    // Preserve the query response's number representations for SeaTunnel's 
JSON converter.
+    static final JsonSerializer RAW_JSON_SERIALIZER =
+            new JsonSerializer() {
+                private final JsonSerializer delegate = 
DefaultJsonSerializer.create();
+
+                @Override
+                public byte[] serialize(Object value) {
+                    return delegate.serialize(value);
+                }
+
+                @Override
+                public <T> T deserialize(Class<T> target, byte[] bytes) {
+                    if (target == byte[].class) {
+                        return target.cast(bytes);
+                    }
+                    return delegate.deserialize(target, bytes);
+                }
+            };
+    private final ReadonlyConfig config;
+    private final CatalogTable catalogTable;
+    private final SingleSplitReaderContext context;
+    private final JsonDeserializationSchema deserializer;
+    private volatile boolean closed;
+    private final Object lifecycleLock = new Object();
+    private Cluster cluster;
+    private Stream<byte[]> rows;
+    private final Sinks.Empty<Void> cancellation = Sinks.empty();
+
+    CouchbaseSourceReader(
+            ReadonlyConfig config, CatalogTable table, 
SingleSplitReaderContext context) {
+        this.config = config;
+        this.catalogTable = table;
+        this.context = context;
+        this.deserializer = new JsonDeserializationSchema(table, false, false);
+    }
+
+    /** Connect on the worker and release the client if readiness fails. */
+    @Override
+    public void open() {
+        if (closed) {
+            throw new CancellationException("Couchbase source reader was 
cancelled before opening");
+        }
+        Cluster connected =
+                Cluster.connect(
+                        config.get(CouchbaseSourceOptions.CONNECTION_STRING),
+                        config.get(CouchbaseSourceOptions.USERNAME),
+                        config.get(CouchbaseSourceOptions.PASSWORD));
+        boolean rejected;
+        synchronized (lifecycleLock) {
+            rejected = closed;
+            if (!rejected) {
+                cluster = connected;
+            }
+        }
+        if (rejected) {
+            connected.disconnect();
+            throw new CancellationException("Couchbase source reader was 
cancelled while opening");
+        }
+        try {
+            connected
+                    .bucket(config.get(CouchbaseSourceOptions.BUCKET))
+                    .waitUntilReady(
+                            
Duration.ofSeconds(config.get(CouchbaseSourceOptions.READY_TIMEOUT)));
+            if (closed) {
+                throw new CancellationException(
+                        "Couchbase source reader was cancelled while opening");
+            }
+        } catch (RuntimeException failure) {
+            closeAfterFailure(failure);
+            throw failure;
+        }
+    }
+
+    /** Consume a backpressured query without buffering the entire collection. 
*/
+    @Override
+    public void pollNext(Collector<SeaTunnelRow> output) throws Exception {
+        Cluster connected;
+        synchronized (lifecycleLock) {
+            if (closed || noMoreSplits) {
+                return;
+            }
+            connected = cluster;
+        }
+        try {
+            Stream<byte[]> stream =
+                    connected
+                            .reactive()
+                            .query(
+                                    statement(config),
+                                    QueryOptions.queryOptions()
+                                            .serializer(RAW_JSON_SERIALIZER)
+                                            .readonly(true)
+                                            
.scanConsistency(QueryScanConsistency.REQUEST_PLUS)
+                                            .timeout(
+                                                    Duration.ofSeconds(
+                                                            config.get(
+                                                                    
CouchbaseSourceOptions
+                                                                            
.QUERY_TIMEOUT))))
+                            .flatMapMany(result -> result.rowsAs(byte[].class))
+                            .takeUntilOther(cancellation.asMono())
+                            .toStream(1);
+            boolean rejected;
+            synchronized (lifecycleLock) {
+                rejected = closed;
+                if (!rejected) {
+                    rows = stream;
+                }
+            }
+            if (rejected) {
+                stream.close();
+                return;
+            }
+            try (AutoCloseable ignored = () -> closeRows(stream)) {
+                Iterator<byte[]> iterator = stream.iterator();
+                while (!closed && iterator.hasNext()) {
+                    SeaTunnelRow row = convertDocument(iterator.next());
+                    row.setTableId(catalogTable.getTablePath().toString());
+                    synchronized (output.getCheckpointLock()) {
+                        if (closed) {
+                            return;
+                        }
+                        output.collect(row);
+                    }
+                }
+                if (!closed) {
+                    noMoreSplits = true;
+                    context.signalNoMoreElement();
+                }
+            }
+        } catch (Exception failure) {
+            if (closed) {
+                return;
+            }
+            closeAfterFailure(failure);
+            throw failure;
+        }
+    }
+
+    private SeaTunnelRow convertDocument(byte[] bytes) {
+        JsonNode document;
+        try {
+            document = deserializer.deserializeToJsonNode(bytes);
+        } catch (IOException | RuntimeException ignored) {
+            throw new IllegalArgumentException(
+                    "Cannot parse JSON document from Couchbase collection " + 
collectionPath());
+        }
+        if (document == null || !document.isObject()) {
+            throw new IllegalArgumentException(
+                    "Couchbase source requires JSON object documents in " + 
collectionPath());
+        }
+        try {
+            return deserializer.convertToRowData(document);
+        } catch (RuntimeException ignored) {
+            // The shared JSON converter includes the entire document in its 
exception chain.
+            throw new IllegalArgumentException(
+                    "Cannot map Couchbase document from "
+                            + collectionPath()
+                            + " to the configured schema");
+        }
+    }
+
+    private String collectionPath() {
+        return quote(config.get(CouchbaseSourceOptions.BUCKET))
+                + "."
+                + quote(config.get(CouchbaseSourceOptions.SCOPE))
+                + "."
+                + quote(config.get(CouchbaseSourceOptions.COLLECTION));
+    }
+
+    private void closeAfterFailure(Exception failure) {
+        try {
+            close();
+        } catch (RuntimeException | Error closeFailure) {
+            if (failure != closeFailure) {
+                failure.addSuppressed(closeFailure);
+            }
+        }
+    }
+
+    static String statement(ReadonlyConfig config) {
+        return "SELECT RAW d FROM "
+                + quote(config.get(CouchbaseSourceOptions.BUCKET))
+                + "."
+                + quote(config.get(CouchbaseSourceOptions.SCOPE))
+                + "."
+                + quote(config.get(CouchbaseSourceOptions.COLLECTION))
+                + " AS d";
+    }
+
+    private static String quote(String identifier) {
+        return "`" + identifier.replace("`", "``") + "`";
+    }
+
+    /** Detach the query only if this polling invocation still owns it. */
+    private void closeRows(Stream<byte[]> stream) {
+        boolean owned;
+        synchronized (lifecycleLock) {
+            owned = rows == stream;
+            if (owned) {
+                rows = null;
+            }
+        }
+        if (owned) {
+            stream.close();
+        }
+    }
+
+    /** Cancel any in-flight query before closing its owned SDK connection. */
+    @Override
+    public void cancel() {
+        synchronized (lifecycleLock) {
+            closed = true;
+        }
+        cancellation.tryEmitEmpty();
+    }
+
+    /** Detach owned resources before invoking SDK cleanup, which may block or 
call back. */
+    @Override
+    public void close() {
+        Stream<byte[]> current;
+        Cluster connected;
+        synchronized (lifecycleLock) {
+            closed = true;
+            current = rows;
+            rows = null;
+            connected = cluster;
+            cluster = null;
+        }
+        Throwable failure = null;
+        try {
+            cancellation.tryEmitEmpty();
+        } catch (RuntimeException | Error signalFailure) {
+            failure = signalFailure;
+        }
+        try {
+            if (current != null) {
+                current.close();
+            }
+        } catch (RuntimeException | Error streamFailure) {
+            failure = appendFailure(failure, streamFailure);
+        }
+        try {
+            if (connected != null) {
+                connected.disconnect();
+            }
+        } catch (RuntimeException | Error disconnectFailure) {
+            failure = appendFailure(failure, disconnectFailure);
+        }
+        if (failure instanceof Error) {
+            throw (Error) failure;
+        }
+        if (failure != null) {
+            throw (RuntimeException) failure;
+        }
+    }
+
+    private static Throwable appendFailure(Throwable first, Throwable next) {
+        if (first == null) {
+            return next;
+        }
+        if (first != next) {
+            first.addSuppressed(next);
+        }
+        return first;
+    }
+}
diff --git 
a/seatunnel-connectors-v2/connector-couchbase/src/test/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceTest.java
 
b/seatunnel-connectors-v2/connector-couchbase/src/test/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceTest.java
new file mode 100644
index 00000000000..6b77ea21944
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-couchbase/src/test/java/org/apache/seatunnel/connectors/seatunnel/couchbase/source/CouchbaseSourceTest.java
@@ -0,0 +1,836 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.couchbase.source;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.configuration.util.OptionValidationException;
+import org.apache.seatunnel.api.source.Boundedness;
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.source.SourceReader;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.api.table.type.DecimalType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplit;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitEnumeratorState;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
+import org.apache.seatunnel.format.json.JsonDeserializationSchema;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+
+import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.Cluster;
+import com.couchbase.client.java.ReactiveCluster;
+import com.couchbase.client.java.json.JsonObject;
+import com.couchbase.client.java.query.QueryOptions;
+import com.couchbase.client.java.query.ReactiveQueryResult;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.publisher.Sinks;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+class CouchbaseSourceTest {
+    @Test
+    void rejectsNonObjectDocuments() throws Exception {
+        for (String value : new String[] {"null", "[]", "123", "\"text\""}) {
+            withRawReader(
+                    Flux.just(value.getBytes(StandardCharsets.UTF_8)),
+                    (reader, context, cluster) -> {
+                        assertThrows(
+                                IllegalArgumentException.class,
+                                () -> reader.pollNext(collector(new 
ArrayList<>())));
+                        verify(context, never()).signalNoMoreElement();
+                    });
+        }
+    }
+
+    @Test
+    void mappingFailureDoesNotExposeUnmappedDocumentFields() throws Exception {
+        withRawReader(
+                
Flux.just("{\"id\":\"bad\",\"secret\":\"TOKEN\"}".getBytes(StandardCharsets.UTF_8)),
+                (reader, context, cluster) -> {
+                    IllegalArgumentException failure =
+                            assertThrows(
+                                    IllegalArgumentException.class,
+                                    () -> reader.pollNext(collector(new 
ArrayList<>())));
+                    assertTrue(failure.getMessage().contains("test_bucket"));
+                    assertFalse(failure.toString().contains("TOKEN"));
+                    assertNull(failure.getCause());
+                    assertEquals(0, failure.getSuppressed().length);
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void invalidJsonFailureDoesNotExposeDocumentBytes() throws Exception {
+        withRawReader(
+                
Flux.just("{\"secret\":\"TOKEN\",broken".getBytes(StandardCharsets.UTF_8)),
+                (reader, context, cluster) -> {
+                    IllegalArgumentException failure =
+                            assertThrows(
+                                    IllegalArgumentException.class,
+                                    () -> reader.pollNext(collector(new 
ArrayList<>())));
+                    assertTrue(failure.getMessage().contains("test_bucket"));
+                    assertFalse(failure.toString().contains("TOKEN"));
+                    assertNull(failure.getCause());
+                    assertEquals(0, failure.getSuppressed().length);
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void sourceAndSinkFactoriesAreBothDiscoverable() {
+        List<String> classes = new ArrayList<>();
+        
java.util.ServiceLoader.load(org.apache.seatunnel.api.table.factory.Factory.class)
+                .forEach(factory -> classes.add(factory.getClass().getName()));
+        assertTrue(classes.contains(CouchbaseSourceFactory.class.getName()));
+        assertTrue(
+                classes.contains(
+                        
"org.apache.seatunnel.connectors.seatunnel.couchbase.sink.CouchbaseSinkFactory"));
+    }
+
+    @Test
+    void restoredReaderReplaysCollectionFromBeginning() throws Exception {
+        List<SingleSplit> state = new ArrayList<>();
+        List<SeaTunnelRow> first = new ArrayList<>();
+        withReader(
+                Flux.just(JsonObject.create().put("id", 1)),
+                (reader, context, cluster) -> {
+                    state.addAll(reader.snapshotState(1));
+                    reader.pollNext(collector(first));
+                });
+        withReader(
+                Flux.just(JsonObject.create().put("id", 1)),
+                (restored, restoredContext, restoredCluster) -> {
+                    restored.addSplits(state);
+                    List<SeaTunnelRow> replay = new ArrayList<>();
+                    restored.pollNext(collector(replay));
+                    assertEquals(first.get(0).getField(0), 
replay.get(0).getField(0));
+                });
+    }
+
+    @Test
+    @EnabledIfSystemProperty(named = "couchbase.test.connection-string", 
matches = ".+")
+    void preservesRealServerNumericResponse() throws Exception {
+        Map<String, Object> config = options();
+        config.put("connection.string", 
System.getProperty("couchbase.test.connection-string"));
+        config.put("username", "Administrator");
+        config.put("password", "password");
+        config.put("collection", "decimal_fixture");
+        Map<String, Object> fields = new LinkedHashMap<>();
+        fields.put("amount", "decimal(38,9)");
+        fields.put("large_integer", "bigint");
+        config.put("schema", Collections.singletonMap("fields", fields));
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        CouchbaseSourceReader reader = (CouchbaseSourceReader) 
source(config).createReader(context);
+        try {
+            reader.open();
+            List<SeaTunnelRow> records = new ArrayList<>();
+            reader.pollNext(collector(records));
+            assertEquals(1, records.size());
+            // This is the server's raw SQL++ response, not the original 
inserted decimal.
+            assertEquals(new BigDecimal("12345678901234567000"), 
records.get(0).getField(0));
+            assertEquals(9007199254740993L, records.get(0).getField(1));
+        } finally {
+            reader.close();
+        }
+    }
+
+    @Test
+    @EnabledIfSystemProperty(named = "couchbase.test.connection-string", 
matches = ".+")
+    void readsRealLocalFixtureThroughFactoryAndReader() throws Exception {
+        Map<String, Object> config = options();
+        config.put("connection.string", 
System.getProperty("couchbase.test.connection-string"));
+        config.put("username", "Administrator");
+        config.put("password", "password");
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        CouchbaseSourceReader reader = (CouchbaseSourceReader) 
source(config).createReader(context);
+        List<SeaTunnelRow> records = new ArrayList<>();
+        reader.addSplits(Collections.singletonList(new SingleSplit(null)));
+        try {
+            reader.open();
+            reader.pollNext(collector(records));
+            records.sort(java.util.Comparator.comparingInt(row -> (Integer) 
row.getField(0)));
+            assertEquals(2, records.size());
+            assertArrayEquals(
+                    new Object[] {1, "first", true, 12.5, null}, 
records.get(0).getFields());
+            assertArrayEquals(
+                    new Object[] {2, "second", false, -3.25, null}, 
records.get(1).getFields());
+            verify(context).signalNoMoreElement();
+        } finally {
+            reader.close();
+        }
+    }
+
+    @Test
+    void concurrentCloseDoesNotWaitForSdkDisconnect() throws Exception {
+        withReader(
+                Flux.never(),
+                (reader, context, cluster) -> {
+                    CountDownLatch disconnecting = new CountDownLatch(1);
+                    CountDownLatch releaseDisconnect = new CountDownLatch(1);
+                    doAnswer(
+                                    call -> {
+                                        disconnecting.countDown();
+                                        assertTrue(releaseDisconnect.await(10, 
TimeUnit.SECONDS));
+                                        return null;
+                                    })
+                            .when(cluster)
+                            .disconnect();
+                    ExecutorService executor = Executors.newFixedThreadPool(2);
+                    Future<?> closing = executor.submit(reader::close);
+                    try {
+                        assertTrue(disconnecting.await(5, TimeUnit.SECONDS));
+                        // The first caller owns the detached SDK client. 
Another lifecycle caller
+                        // must not wait for that external cleanup while 
holding the lifecycle lock.
+                        executor.submit(reader::close).get(5, 
TimeUnit.SECONDS);
+                    } finally {
+                        releaseDisconnect.countDown();
+                        closing.get(5, TimeUnit.SECONDS);
+                        executor.shutdownNow();
+                    }
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void sdkDisconnectCanWaitForAnotherLifecycleCaller() throws Exception {
+        withReader(
+                Flux.never(),
+                (reader, context, cluster) -> {
+                    ExecutorService executor = 
Executors.newSingleThreadExecutor();
+                    try {
+                        doAnswer(
+                                        call -> {
+                                            
executor.submit(reader::close).get(5, TimeUnit.SECONDS);
+                                            return null;
+                                        })
+                                .when(cluster)
+                                .disconnect();
+                        reader.close();
+                    } finally {
+                        executor.shutdownNow();
+                    }
+                });
+    }
+
+    @Test
+    void rejectedConnectionIsClosedOutsideLifecycleLock() throws Exception {
+        CouchbaseSourceReader reader =
+                (CouchbaseSourceReader)
+                        
source(options()).createReader(mock(SourceReader.Context.class));
+        Cluster cluster = mock(Cluster.class);
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        try (MockedStatic<Cluster> connection = 
Mockito.mockStatic(Cluster.class)) {
+            connection
+                    .when(() -> Cluster.connect("couchbase://localhost", 
"user", "pass"))
+                    .thenAnswer(
+                            call -> {
+                                reader.cancel();
+                                return cluster;
+                            });
+            doAnswer(
+                            call -> {
+                                executor.submit(reader::close).get(5, 
TimeUnit.SECONDS);
+                                return null;
+                            })
+                    .when(cluster)
+                    .disconnect();
+            assertThrows(CancellationException.class, reader::open);
+            reader.close();
+            verify(cluster, times(1)).disconnect();
+        } finally {
+            executor.shutdownNow();
+        }
+    }
+
+    @Test
+    void streamCloseFailureStillDisconnectsClientAndKeepsBothFailures() throws 
Exception {
+        withReader(
+                Flux.never(),
+                (reader, context, cluster) -> {
+                    IllegalStateException streamFailure = new 
IllegalStateException("stream close");
+                    IllegalStateException disconnectFailure =
+                            new IllegalStateException("client disconnect");
+                    Stream<byte[]> stream =
+                            Stream.<byte[]>empty()
+                                    .onClose(
+                                            () -> {
+                                                throw streamFailure;
+                                            });
+                    // Inject a throwing query stream to cover the SDK 
resource boundary directly.
+                    Field field = 
CouchbaseSourceReader.class.getDeclaredField("rows");
+                    field.setAccessible(true);
+                    field.set(reader, stream);
+                    doThrow(disconnectFailure).when(cluster).disconnect();
+                    assertSame(
+                            streamFailure,
+                            assertThrows(IllegalStateException.class, 
reader::close));
+                    assertArrayEquals(
+                            new Throwable[] {disconnectFailure}, 
streamFailure.getSuppressed());
+                    reader.close();
+                });
+    }
+
+    @Test
+    void cancellationFailureDoesNotSkipEitherResourceCleanup() throws 
Exception {
+        withReader(
+                Flux.never(),
+                (reader, context, cluster) -> {
+                    IllegalStateException signalFailure =
+                            new IllegalStateException("cancel signal");
+                    IllegalStateException streamFailure = new 
IllegalStateException("stream close");
+                    LinkageError disconnectFailure = new LinkageError("client 
disconnect");
+                    Sinks.Empty<Void> cancellation = mock(Sinks.Empty.class);
+                    when(cancellation.tryEmitEmpty()).thenThrow(signalFailure);
+                    Field cancellationField =
+                            
CouchbaseSourceReader.class.getDeclaredField("cancellation");
+                    cancellationField.setAccessible(true);
+                    cancellationField.set(reader, cancellation);
+                    Stream<byte[]> stream =
+                            Stream.<byte[]>empty()
+                                    .onClose(
+                                            () -> {
+                                                throw streamFailure;
+                                            });
+                    Field rowsField = 
CouchbaseSourceReader.class.getDeclaredField("rows");
+                    rowsField.setAccessible(true);
+                    rowsField.set(reader, stream);
+                    doThrow(disconnectFailure).when(cluster).disconnect();
+                    assertSame(
+                            signalFailure,
+                            assertThrows(IllegalStateException.class, 
reader::close));
+                    assertArrayEquals(
+                            new Throwable[] {streamFailure, disconnectFailure},
+                            signalFailure.getSuppressed());
+                    // Make the helper's repeated close harmless after all 
resources were detached.
+                    Mockito.doReturn(Sinks.EmitResult.FAIL_TERMINATED)
+                            .when(cancellation)
+                            .tryEmitEmpty();
+                });
+    }
+
+    @Test
+    void queryFailureIsPreservedWhenClientCleanupFails() throws Exception {
+        IllegalStateException queryFailure = new IllegalStateException("query 
failed");
+        withReader(
+                Flux.error(queryFailure),
+                (reader, context, cluster) -> {
+                    LinkageError disconnectFailure = new LinkageError("client 
disconnect");
+                    doThrow(disconnectFailure).when(cluster).disconnect();
+                    assertSame(
+                            queryFailure,
+                            assertThrows(
+                                    IllegalStateException.class,
+                                    () -> reader.pollNext(collector(new 
ArrayList<>()))));
+                    assertArrayEquals(
+                            new Throwable[] {disconnectFailure}, 
queryFailure.getSuppressed());
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void closeWakesBlockedReader() throws Exception {
+        CountDownLatch subscribed = new CountDownLatch(1);
+        AtomicBoolean cancelled = new AtomicBoolean();
+        withReader(
+                Flux.<JsonObject>never()
+                        .doOnSubscribe(subscription -> subscribed.countDown())
+                        .doOnCancel(() -> cancelled.set(true)),
+                (reader, context, cluster) -> {
+                    ExecutorService executor = 
Executors.newSingleThreadExecutor();
+                    try {
+                        Future<?> polling =
+                                executor.submit(
+                                        () -> {
+                                            try {
+                                                reader.pollNext(collector(new 
ArrayList<>()));
+                                            } catch (Exception error) {
+                                                throw new 
RuntimeException(error);
+                                            }
+                                        });
+                        assertTrue(subscribed.await(5, TimeUnit.SECONDS));
+                        reader.close();
+                        polling.get(5, TimeUnit.SECONDS);
+                        assertTrue(cancelled.get());
+                        verify(context, never()).signalNoMoreElement();
+                    } finally {
+                        executor.shutdownNow();
+                    }
+                });
+    }
+
+    @Test
+    void cancelWakesBlockedReaderWithoutClosingClient() throws Exception {
+        CountDownLatch subscribed = new CountDownLatch(1);
+        AtomicBoolean cancelled = new AtomicBoolean();
+        withReader(
+                Flux.<JsonObject>never()
+                        .doOnSubscribe(subscription -> subscribed.countDown())
+                        .doOnCancel(() -> cancelled.set(true)),
+                (reader, context, cluster) -> {
+                    ExecutorService executor = 
Executors.newSingleThreadExecutor();
+                    try {
+                        Future<?> polling =
+                                executor.submit(
+                                        () -> {
+                                            try {
+                                                reader.pollNext(collector(new 
ArrayList<>()));
+                                            } catch (Exception error) {
+                                                throw new 
RuntimeException(error);
+                                            }
+                                        });
+                        assertTrue(subscribed.await(5, TimeUnit.SECONDS));
+                        reader.cancel();
+                        reader.cancel();
+                        polling.get(5, TimeUnit.SECONDS);
+                        assertTrue(cancelled.get());
+                        verify(context, never()).signalNoMoreElement();
+                        verify(cluster, never()).disconnect();
+                    } finally {
+                        executor.shutdownNow();
+                    }
+                });
+    }
+
+    @Test
+    void cancellationBeforeOpenIsSticky() throws Exception {
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        CouchbaseSourceReader reader =
+                (CouchbaseSourceReader) 
source(options()).createReader(context);
+        reader.cancel();
+        try (MockedStatic<Cluster> connection = 
Mockito.mockStatic(Cluster.class)) {
+            assertThrows(CancellationException.class, reader::open);
+            reader.pollNext(collector(new ArrayList<>()));
+            connection.verifyNoInteractions();
+            verify(context, never()).signalNoMoreElement();
+        } finally {
+            reader.close();
+        }
+    }
+
+    @Test
+    void cancellationDuringReadinessClosesClientAndFailsOpen() throws 
Exception {
+        Cluster cluster = mock(Cluster.class);
+        Bucket bucket = mock(Bucket.class);
+        when(cluster.bucket("test_bucket")).thenReturn(bucket);
+        CouchbaseSourceReader reader =
+                (CouchbaseSourceReader)
+                        
source(options()).createReader(mock(SourceReader.Context.class));
+        CountDownLatch checkingReadiness = new CountDownLatch(1);
+        CountDownLatch releaseReadiness = new CountDownLatch(1);
+        doAnswer(
+                        invocation -> {
+                            checkingReadiness.countDown();
+                            assertTrue(releaseReadiness.await(5, 
TimeUnit.SECONDS));
+                            return null;
+                        })
+                .when(bucket)
+                .waitUntilReady(any(Duration.class));
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        try {
+            Future<?> opening =
+                    executor.submit(
+                            () -> {
+                                try (MockedStatic<Cluster> connection =
+                                        Mockito.mockStatic(Cluster.class)) {
+                                    connection
+                                            .when(
+                                                    () ->
+                                                            Cluster.connect(
+                                                                    
"couchbase://localhost",
+                                                                    "user",
+                                                                    "pass"))
+                                            .thenReturn(cluster);
+                                    reader.open();
+                                }
+                            });
+            assertTrue(checkingReadiness.await(5, TimeUnit.SECONDS));
+            reader.cancel();
+            releaseReadiness.countDown();
+            ExecutionException failure =
+                    assertThrows(ExecutionException.class, () -> 
opening.get(5, TimeUnit.SECONDS));
+            assertTrue(failure.getCause() instanceof CancellationException);
+        } finally {
+            releaseReadiness.countDown();
+            executor.shutdownNow();
+            reader.close();
+        }
+        verify(cluster, times(1)).disconnect();
+    }
+
+    @Test
+    void partialReadFailureIsNotReportedAsCompleted() throws Exception {
+        Sinks.One<JsonObject> failure = Sinks.one();
+        withReader(
+                Flux.concat(Flux.just(JsonObject.create().put("id", 1)), 
failure.asMono()),
+                (reader, context, cluster) -> {
+                    List<SeaTunnelRow> records = new ArrayList<>();
+                    Collector<SeaTunnelRow> output =
+                            new Collector<SeaTunnelRow>() {
+                                private final Object lock = new Object();
+
+                                @Override
+                                public void collect(SeaTunnelRow row) {
+                                    records.add(row);
+                                    failure.tryEmitError(
+                                            new 
IllegalStateException("mid-query failure"));
+                                }
+
+                                @Override
+                                public Object getCheckpointLock() {
+                                    return lock;
+                                }
+                            };
+                    assertThrows(IllegalStateException.class, () -> 
reader.pollNext(output));
+                    assertEquals(1, records.size());
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void preservesRawQueryDecimalPrecision() throws Exception {
+        byte[] response =
+                
"{\"amount\":12345678901234567890.123456789}".getBytes(StandardCharsets.UTF_8);
+        byte[] rowBytes =
+                
CouchbaseSourceReader.RAW_JSON_SERIALIZER.deserialize(byte[].class, response);
+        JsonDeserializationSchema decoder =
+                new JsonDeserializationSchema(
+                        false,
+                        false,
+                        new SeaTunnelRowType(
+                                new String[] {"amount"},
+                                new DecimalType[] {new DecimalType(38, 9)}));
+        assertEquals(
+                new BigDecimal("12345678901234567890.123456789"),
+                decoder.deserialize(rowBytes).getField(0));
+    }
+
+    @Test
+    @EnabledIfSystemProperty(named = "couchbase.test.connection-string", 
matches = ".+")
+    void missingRealCollectionFailsInsteadOfReportingEmptyInput() throws 
Exception {
+        Map<String, Object> config = options();
+        config.put("connection.string", 
System.getProperty("couchbase.test.connection-string"));
+        config.put("username", "Administrator");
+        config.put("password", "password");
+        config.put("collection", "missing_collection");
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        CouchbaseSourceReader reader = (CouchbaseSourceReader) 
source(config).createReader(context);
+        try {
+            reader.open();
+            assertThrows(Exception.class, () -> reader.pollNext(collector(new 
ArrayList<>())));
+            verify(context, never()).signalNoMoreElement();
+        } finally {
+            reader.close();
+        }
+    }
+
+    @Test
+    void validatesRequiredSchemaAndTimeoutsWithoutConnecting() {
+        Map<String, Object> options = options();
+        options.remove("schema");
+        Map<String, Object> missingSchema = options;
+        assertThrows(OptionValidationException.class, () -> 
source(missingSchema));
+        options = options();
+        options.put("query.timeout", 0);
+        Map<String, Object> invalidTimeout = options;
+        assertThrows(OptionValidationException.class, () -> 
source(invalidTimeout));
+    }
+
+    @Test
+    void quotesEachIdentifierIndependently() {
+        Map<String, Object> options = options();
+        options.put("bucket", "bucket`with`ticks");
+        options.put("scope", "scope.with.dot");
+        options.put("collection", "collection` WHERE true; DELETE");
+        assertEquals(
+                "SELECT RAW d FROM `bucket``with``ticks`.`scope.with.dot`."
+                        + "`collection`` WHERE true; DELETE` AS d",
+                
CouchbaseSourceReader.statement(ReadonlyConfig.fromMap(options)));
+    }
+
+    @Test
+    void sourceIsBoundedAndRejectsParallelReaders() throws Exception {
+        CouchbaseSource source = source(options());
+        assertEquals(Boundedness.BOUNDED, source.getBoundedness());
+        assertEquals("Couchbase", source.getPluginName());
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        when(context.getIndexOfSubtask()).thenReturn(1);
+        assertThrows(IllegalArgumentException.class, () -> 
source.createReader(context));
+    }
+
+    @Test
+    void mapsTypedRowsAndNullsAndSignalsCompletionOnce() throws Exception {
+        JsonObject first =
+                JsonObject.create()
+                        .put("id", 1)
+                        .put("name", "first")
+                        .put("enabled", true)
+                        .put("amount", 12.5)
+                        .putNull("nullable");
+        JsonObject second =
+                JsonObject.create()
+                        .put("id", 2)
+                        .put("name", "second")
+                        .put("enabled", false)
+                        .put("amount", -3.25);
+        withReader(
+                Flux.just(first, second),
+                (reader, context, cluster) -> {
+                    List<SeaTunnelRow> rows = new ArrayList<>();
+                    Collector<SeaTunnelRow> collector = collector(rows);
+                    reader.pollNext(collector);
+                    reader.pollNext(collector);
+                    assertEquals(2, rows.size());
+                    assertArrayEquals(
+                            new Object[] {1, "first", true, 12.5, null}, 
rows.get(0).getFields());
+                    assertArrayEquals(
+                            new Object[] {2, "second", false, -3.25, null},
+                            rows.get(1).getFields());
+                    verify(context, times(1)).signalNoMoreElement();
+                    assertEquals(1, reader.snapshotState(1).size());
+                    assertNull(reader.snapshotState(1).get(0).getState());
+                });
+    }
+
+    @Test
+    void completesEmptyCollection() throws Exception {
+        withReader(
+                Flux.empty(),
+                (reader, context, cluster) -> {
+                    List<SeaTunnelRow> rows = new ArrayList<>();
+                    reader.pollNext(collector(rows));
+                    assertTrue(rows.isEmpty());
+                    verify(context).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void failureDoesNotSignalSuccessfulCompletionAndClosesClient() throws 
Exception {
+        withReader(
+                Flux.error(new IllegalStateException("query failed")),
+                (reader, context, cluster) -> {
+                    assertThrows(
+                            IllegalStateException.class,
+                            () -> reader.pollNext(collector(new 
ArrayList<>())));
+                    verify(context, never()).signalNoMoreElement();
+                    verify(cluster).disconnect();
+                });
+    }
+
+    @Test
+    void malformedFieldFailsWithoutSilentlySkippingRows() throws Exception {
+        withReader(
+                Flux.just(JsonObject.create().put("id", "invalid")),
+                (reader, context, cluster) -> {
+                    assertThrows(
+                            Exception.class, () -> 
reader.pollNext(collector(new ArrayList<>())));
+                    verify(context, never()).signalNoMoreElement();
+                    verify(cluster).disconnect();
+                });
+    }
+
+    @Test
+    void closeCancelsSubscriptionAndDoesNotSignalCompletion() throws Exception 
{
+        AtomicBoolean cancelled = new AtomicBoolean();
+        withReader(
+                Flux.range(1, 100)
+                        .map(id -> JsonObject.create().put("id", id))
+                        .doOnCancel(() -> cancelled.set(true)),
+                (reader, context, cluster) -> {
+                    Collector<SeaTunnelRow> collector = mock(Collector.class);
+                    when(collector.getCheckpointLock()).thenReturn(new 
Object());
+                    doAnswer(
+                                    call -> {
+                                        reader.close();
+                                        return null;
+                                    })
+                            .when(collector)
+                            .collect(any(SeaTunnelRow.class));
+                    reader.pollNext(collector);
+                    assertTrue(cancelled.get());
+                    verify(collector, 
times(1)).collect(any(SeaTunnelRow.class));
+                    verify(context, never()).signalNoMoreElement();
+                });
+    }
+
+    @Test
+    void readinessFailureReleasesConnection() {
+        Cluster cluster = mock(Cluster.class);
+        Bucket bucket = mock(Bucket.class);
+        when(cluster.bucket("test_bucket")).thenReturn(bucket);
+        doThrow(new IllegalStateException("not 
ready")).when(bucket).waitUntilReady(any());
+        try (MockedStatic<Cluster> connection = 
Mockito.mockStatic(Cluster.class)) {
+            connection
+                    .when(() -> Cluster.connect("couchbase://localhost", 
"user", "pass"))
+                    .thenReturn(cluster);
+            CouchbaseSourceReader reader =
+                    (CouchbaseSourceReader)
+                            source(options())
+                                    .createReader(
+                                            new SingleSplitReaderContext(
+                                                    
mock(SourceReader.Context.class)));
+            assertThrows(IllegalStateException.class, reader::open);
+            verify(cluster).disconnect();
+        }
+    }
+
+    @Test
+    void passesTlsConnectionAndCredentialsToSdk() throws Exception {
+        String connectionString =
+                
"couchbases://cb.example.test?security.trustCertificate=/worker/ca.pem";
+        Map<String, Object> options = options();
+        options.put("connection.string", connectionString);
+        Cluster cluster = mock(Cluster.class);
+        when(cluster.bucket("test_bucket")).thenReturn(mock(Bucket.class));
+        try (MockedStatic<Cluster> connection = 
Mockito.mockStatic(Cluster.class)) {
+            connection
+                    .when(() -> Cluster.connect(connectionString, "user", 
"pass"))
+                    .thenReturn(cluster);
+            CouchbaseSourceReader reader =
+                    (CouchbaseSourceReader)
+                            
source(options).createReader(mock(SourceReader.Context.class));
+            try {
+                reader.open();
+                connection.verify(() -> Cluster.connect(connectionString, 
"user", "pass"));
+            } finally {
+                reader.close();
+            }
+            verify(cluster).disconnect();
+        }
+    }
+
+    private void withReader(Flux<JsonObject> records, ReaderAssertion 
assertion) throws Exception {
+        withRawReader(
+                records.map(row -> 
row.toString().getBytes(StandardCharsets.UTF_8)), assertion);
+    }
+
+    private void withRawReader(Flux<byte[]> records, ReaderAssertion 
assertion) throws Exception {
+        Cluster cluster = mock(Cluster.class);
+        Bucket bucket = mock(Bucket.class);
+        ReactiveCluster reactive = mock(ReactiveCluster.class);
+        ReactiveQueryResult result = mock(ReactiveQueryResult.class);
+        when(cluster.bucket("test_bucket")).thenReturn(bucket);
+        when(cluster.reactive()).thenReturn(reactive);
+        when(reactive.query(anyString(), 
any(QueryOptions.class))).thenReturn(Mono.just(result));
+        when(result.rowsAs(byte[].class)).thenReturn(records);
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        try (MockedStatic<Cluster> connection = 
Mockito.mockStatic(Cluster.class)) {
+            connection
+                    .when(() -> Cluster.connect("couchbase://localhost", 
"user", "pass"))
+                    .thenReturn(cluster);
+            CouchbaseSourceReader reader =
+                    (CouchbaseSourceReader) 
source(options()).createReader(context);
+            reader.addSplits(Collections.singletonList(new SingleSplit(null)));
+            reader.open();
+            try {
+                assertion.run(reader, context, cluster);
+            } finally {
+                reader.close();
+            }
+            verify(cluster, times(1)).disconnect();
+        }
+    }
+
+    static CouchbaseSource source(Map<String, Object> options) {
+        return (CouchbaseSource)
+                new CouchbaseSourceFactory()
+                        .<SeaTunnelRow, SingleSplit, 
SingleSplitEnumeratorState>createSource(
+                                new TableSourceFactoryContext(
+                                        ReadonlyConfig.fromMap(options),
+                                        
CouchbaseSourceTest.class.getClassLoader()))
+                        .createSource();
+    }
+
+    static Map<String, Object> options() {
+        Map<String, Object> options = new HashMap<>();
+        options.put("connection.string", "couchbase://localhost");
+        options.put("username", "user");
+        options.put("password", "pass");
+        options.put("bucket", "test_bucket");
+        options.put("collection", "_default");
+        Map<String, Object> fields = new LinkedHashMap<>();
+        fields.put("id", "int");
+        fields.put("name", "string");
+        fields.put("enabled", "boolean");
+        fields.put("amount", "double");
+        fields.put("nullable", "string");
+        options.put("schema", Collections.singletonMap("fields", fields));
+        return options;
+    }
+
+    static Collector<SeaTunnelRow> collector(List<SeaTunnelRow> rows) {
+        return new Collector<SeaTunnelRow>() {
+            private final Object lock = new Object();
+
+            @Override
+            public void collect(SeaTunnelRow row) {
+                rows.add(row);
+            }
+
+            @Override
+            public Object getCheckpointLock() {
+                return lock;
+            }
+        };
+    }
+
+    private interface ReaderAssertion {
+        void run(CouchbaseSourceReader reader, SourceReader.Context context, 
Cluster cluster)
+                throws Exception;
+    }
+}
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/pom.xml 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/pom.xml
index 83ac1f70dab..e63b955a2cd 100644
--- a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/pom.xml
+++ b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/pom.xml
@@ -59,5 +59,11 @@
             <version>${testcontainer.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>toxiproxy</artifactId>
+            <version>${testcontainer.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseIT.java
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseIT.java
index 20c7aeb8cdc..1a4cedebf6e 100644
--- 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseIT.java
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseIT.java
@@ -17,6 +17,14 @@
 
 package org.apache.seatunnel.e2e.connector.couchbase;
 
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.source.Collector;
+import org.apache.seatunnel.api.source.SourceReader;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplit;
+import 
org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitEnumeratorState;
+import 
org.apache.seatunnel.connectors.seatunnel.couchbase.source.CouchbaseSourceFactory;
 import org.apache.seatunnel.e2e.common.TestResource;
 import org.apache.seatunnel.e2e.common.TestSuiteBase;
 import org.apache.seatunnel.e2e.common.container.EngineType;
@@ -28,27 +36,52 @@ import org.awaitility.Awaitility;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.Timeout;
 import org.testcontainers.containers.Container;
+import org.testcontainers.containers.ToxiproxyContainer;
 import org.testcontainers.containers.output.Slf4jLogConsumer;
 import org.testcontainers.couchbase.BucketDefinition;
 import org.testcontainers.couchbase.CouchbaseContainer;
 import org.testcontainers.couchbase.CouchbaseService;
 import org.testcontainers.utility.DockerImageName;
 
+import com.couchbase.client.core.error.UnambiguousTimeoutException;
 import com.couchbase.client.java.Cluster;
+import com.couchbase.client.java.Collection;
 import com.couchbase.client.java.json.JsonObject;
+import com.couchbase.client.java.query.QueryOptions;
 import com.couchbase.client.java.query.QueryResult;
+import com.couchbase.client.java.query.QueryScanConsistency;
+import eu.rekawek.toxiproxy.model.ToxicDirection;
+import eu.rekawek.toxiproxy.model.toxic.Bandwidth;
 import lombok.extern.slf4j.Slf4j;
 
 import java.io.IOException;
 import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
 
 /**
- * End-to-end integration test for the Couchbase sink connector.
+ * End-to-end integration test for the Couchbase source and sink connector.
  *
  * <p>Starts a real Couchbase community server via {@link CouchbaseContainer}, 
which handles full
  * cluster bootstrap automatically (node init, services, memory quotas, 
credentials, bucket). The
@@ -66,11 +99,20 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
     private static final String COUCHBASE_SCOPE = "_default";
     private static final String COUCHBASE_COLLECTION = "test_collection";
     private static final String COUCHBASE_COLLECTION_TIMER_FLUSH = 
"test_collection_timer_flush";
+    private static final String COUCHBASE_COLLECTION_SOURCE_RESULT = 
"test_source_result";
+    private static final String COUCHBASE_SOURCE_SCOPE = "source_scope";
+    private static final String COUCHBASE_SOURCE_COLLECTION = 
"source_collection";
+    private static final String COUCHBASE_TIMEOUT_COLLECTION = 
"source_timeout";
+    private static final int TIMEOUT_ROW_COUNT = 512;
+    private static final int SMALL_QUERY_TIMEOUT_SECONDS = 5;
+    private static final int SLOW_COLLECTOR_DELAY_SECONDS = 10;
 
     /** Matches row.num in fake_source_to_couchbase.conf. */
     private static final int EXPECTED_ROW_COUNT = 100;
 
     private CouchbaseContainer couchbaseContainer;
+    private ToxiproxyContainer queryProxyContainer;
+    private ToxiproxyContainer.ContainerProxy queryProxy;
     private Cluster cluster;
 
     @BeforeAll
@@ -81,9 +123,20 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
         // the same name as threads from any other Reactor-based connector. 
The exemption must only
         // fire while this test is running to avoid masking leaks in unrelated 
connectors.
         SeaTunnelContainer.enableCouchbaseParallelThreadExemption();
+        queryProxyContainer =
+                new 
ToxiproxyContainer("ghcr.io/shopify/toxiproxy:2.4.0").withNetwork(NETWORK);
+        queryProxyContainer.start();
+        queryProxy = queryProxyContainer.getProxy(COUCHBASE_CONTAINER_HOST, 
8093);
         couchbaseContainer =
-                new CouchbaseContainer(DockerImageName.parse(COUCHBASE_IMAGE))
-                        .withNetwork(NETWORK)
+                new CouchbaseContainer(DockerImageName.parse(COUCHBASE_IMAGE)) 
{
+                    @Override
+                    public Integer getMappedPort(int originalPort) {
+                        // Both containers share the Docker host, including 
with remote Docker.
+                        return originalPort == 8093
+                                ? queryProxy.getProxyPort()
+                                : super.getMappedPort(originalPort);
+                    }
+                }.withNetwork(NETWORK)
                         .withNetworkAliases(COUCHBASE_CONTAINER_HOST)
                         .withCredentials(COUCHBASE_USERNAME, 
COUCHBASE_PASSWORD)
                         .withBucket(
@@ -227,6 +280,64 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
                                     rows.get(0).getString("state"),
                                     "Primary index not yet online");
                         });
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(2, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () ->
+                                cluster.query(
+                                        "CREATE COLLECTION 
`test_bucket`.`_default`.`test_source_result`"));
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(2, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () ->
+                                cluster.query(
+                                        "CREATE PRIMARY INDEX ON 
`test_bucket`.`_default`.`test_source_result`"));
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(2, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(() -> cluster.query("CREATE SCOPE 
`test_bucket`.`source_scope`"));
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(2, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () ->
+                                cluster.query(
+                                        "CREATE COLLECTION 
`test_bucket`.`source_scope`.`source_collection`"));
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(2, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () ->
+                                cluster.query(
+                                        "CREATE PRIMARY INDEX ON 
`test_bucket`.`source_scope`.`source_collection`"));
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(1, TimeUnit.SECONDS)
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () -> {
+                            QueryResult result =
+                                    cluster.query(
+                                            "SELECT state FROM system:indexes"
+                                                    + " WHERE keyspace_id = 
'source_collection'"
+                                                    + " AND scope_id = 
'source_scope'"
+                                                    + " AND bucket_id = 
'test_bucket'"
+                                                    + " AND `using` = 'gsi' 
AND is_primary = true");
+                            List<JsonObject> indexes = 
result.rowsAs(JsonObject.class);
+                            Assertions.assertFalse(
+                                    indexes.isEmpty(), "Source index not 
created yet");
+                            Assertions.assertEquals(
+                                    "online",
+                                    indexes.get(0).getString("state"),
+                                    "Source index not yet online");
+                        });
         log.info("Couchbase cluster ready at {}", 
couchbaseContainer.getConnectionString());
     }
 
@@ -237,13 +348,20 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
             if (cluster != null) {
                 cluster.disconnect();
             }
-            if (couchbaseContainer != null) {
-                couchbaseContainer.stop();
-            }
         } finally {
-            // Always clear the flag so that parallel-N threads are no longer 
exempt after
-            // this test class finishes, regardless of whether teardown 
succeeded.
-            SeaTunnelContainer.disableCouchbaseParallelThreadExemption();
+            try {
+                if (couchbaseContainer != null) {
+                    couchbaseContainer.stop();
+                }
+            } finally {
+                try {
+                    if (queryProxyContainer != null) {
+                        queryProxyContainer.stop();
+                    }
+                } finally {
+                    
SeaTunnelContainer.disableCouchbaseParallelThreadExemption();
+                }
+            }
         }
     }
 
@@ -339,6 +457,308 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
                         });
     }
 
+    @TestTemplate
+    public void testCouchbaseSourceToAssert(TestContainer container)
+            throws IOException, InterruptedException {
+        cluster.query(
+                "DELETE FROM `test_bucket`.`_default`.`test_source_result`",
+                
QueryOptions.queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS));
+        Collection sourceCollection =
+                cluster.bucket(COUCHBASE_BUCKET)
+                        .scope(COUCHBASE_SOURCE_SCOPE)
+                        .collection(COUCHBASE_SOURCE_COLLECTION);
+        sourceCollection.upsert(
+                "source-one",
+                JsonObject.create()
+                        .put("id", 1)
+                        .put("name", "first")
+                        .put("enabled", true)
+                        .put("amount", 12.5)
+                        .putNull("nullable"));
+        sourceCollection.upsert(
+                "source-two",
+                JsonObject.create()
+                        .put("id", 2)
+                        .put("name", "second")
+                        .put("enabled", false)
+                        .put("amount", -3.25));
+
+        Container.ExecResult result = 
container.executeJob("/couchbase_source_to_assert.conf");
+        Assertions.assertEquals(0, result.getExitCode(), result.getStderr());
+        Awaitility.given()
+                .ignoreExceptions()
+                .pollInterval(1, TimeUnit.SECONDS)
+                .atMost(30, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () -> {
+                            List<JsonObject> rows =
+                                    cluster.query(
+                                                    "SELECT RAW d FROM 
`test_bucket`.`_default`.`"
+                                                            + 
COUCHBASE_COLLECTION_SOURCE_RESULT
+                                                            + "` AS d ORDER BY 
d.id",
+                                                    QueryOptions.queryOptions()
+                                                            .scanConsistency(
+                                                                    
QueryScanConsistency
+                                                                            
.REQUEST_PLUS))
+                                            .rowsAsObject();
+                            Assertions.assertEquals(2, rows.size());
+                            Assertions.assertEquals(1, 
rows.get(0).getInt("id"));
+                            Assertions.assertEquals("first", 
rows.get(0).getString("name"));
+                            Assertions.assertEquals(true, 
rows.get(0).getBoolean("enabled"));
+                            Assertions.assertEquals(12.5, 
rows.get(0).getDouble("amount"));
+                            Assertions.assertNull(rows.get(0).get("nullable"));
+                            Assertions.assertEquals(2, 
rows.get(1).getInt("id"));
+                            Assertions.assertEquals("second", 
rows.get(1).getString("name"));
+                            Assertions.assertEquals(false, 
rows.get(1).getBoolean("enabled"));
+                            Assertions.assertEquals(-3.25, 
rows.get(1).getDouble("amount"));
+                            Assertions.assertNull(rows.get(1).get("nullable"));
+                        });
+    }
+
+    /** Verifies the server's streaming timeout through the production reader, 
without an engine. */
+    @Test
+    @Timeout(value = 5, unit = TimeUnit.MINUTES)
+    public void testCouchbaseSourceStreamingTimeoutAndReplay() throws 
Exception {
+        String path = "`test_bucket`.`source_scope`.`source_timeout`";
+        Awaitility.given()
+                .ignoreExceptions()
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(() -> cluster.query("CREATE COLLECTION " + 
path));
+        Awaitility.given()
+                .ignoreExceptions()
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(() -> cluster.query("CREATE PRIMARY INDEX ON " 
+ path));
+        Collection collection =
+                cluster.bucket(COUCHBASE_BUCKET)
+                        .scope(COUCHBASE_SOURCE_SCOPE)
+                        .collection(COUCHBASE_TIMEOUT_COLLECTION);
+        // Bound Query-service traffic before the SDK can buffer the complete 
response.
+        // Collector delays alone do not guarantee backpressure reaches a fast 
server.
+        String payload = "x".repeat(32 * 1024);
+        for (int id = 0; id < TIMEOUT_ROW_COUNT; id++) {
+            collection.upsert(
+                    "timeout-" + id, JsonObject.create().put("id", 
id).put("payload", payload));
+        }
+        Awaitility.given()
+                .ignoreExceptions()
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(
+                        () ->
+                                Assertions.assertEquals(
+                                        TIMEOUT_ROW_COUNT,
+                                        cluster.query(
+                                                        "SELECT RAW COUNT(*) 
FROM " + path,
+                                                        
QueryOptions.queryOptions()
+                                                                
.scanConsistency(
+                                                                        
QueryScanConsistency
+                                                                               
 .REQUEST_PLUS))
+                                                .rowsAs(Integer.class)
+                                                .get(0)));
+
+        Set<Integer> expectedIds =
+                IntStream.range(0, 
TIMEOUT_ROW_COUNT).boxed().collect(Collectors.toSet());
+        SourceReader.Context fastContext = mock(SourceReader.Context.class);
+        List<Integer> fast = new ArrayList<>();
+        try (SourceReader<SeaTunnelRow, SingleSplit> reader = 
timeoutReader(60, fastContext)) {
+            reader.addSplits(Collections.singletonList(new SingleSplit(null)));
+            reader.open();
+            // Allow CI headroom: this control checks complete results, not 
throughput.
+            reader.pollNext(collectorWithInitialDelay(fast, 0));
+            Assertions.assertEquals(TIMEOUT_ROW_COUNT, fast.size());
+            Assertions.assertEquals(expectedIds, new HashSet<>(fast));
+            verify(fastContext).signalNoMoreElement();
+        }
+
+        SourceReader.Context failedContext = mock(SourceReader.Context.class);
+        List<Integer> partial = new ArrayList<>();
+        List<SingleSplit> state;
+        try (QueryBandwidth bandwidth = limitQueryBandwidth();
+                SourceReader<SeaTunnelRow, SingleSplit> reader =
+                        timeoutReader(SMALL_QUERY_TIMEOUT_SECONDS, 
failedContext)) {
+            reader.addSplits(Collections.singletonList(new SingleSplit(null)));
+            reader.open();
+            UnambiguousTimeoutException failure =
+                    Assertions.assertThrows(
+                            UnambiguousTimeoutException.class,
+                            () ->
+                                    reader.pollNext(
+                                            collectorWithInitialDelay(
+                                                    partial, 
SLOW_COLLECTOR_DELAY_SECONDS)));
+            Assertions.assertTrue(
+                    failure.getMessage().contains("Query timed out while 
streaming/receiving rows"),
+                    "Must observe server error 1080, not a timeout before 
streaming starts");
+            Assertions.assertFalse(partial.isEmpty(), "Must emit rows before 
the timeout");
+            Assertions.assertTrue(partial.size() < TIMEOUT_ROW_COUNT);
+            verify(failedContext, never()).signalNoMoreElement();
+            state = reader.snapshotState(1);
+            Assertions.assertNull(state.get(0).getState(), "No offset is 
checkpointed");
+        }
+
+        SourceReader.Context restoredContext = 
mock(SourceReader.Context.class);
+        List<Integer> completed = new ArrayList<>();
+        try (QueryBandwidth bandwidth = limitQueryBandwidth();
+                SourceReader<SeaTunnelRow, SingleSplit> reader =
+                        timeoutReader(60, restoredContext)) {
+            reader.addSplits(state);
+            reader.open();
+            // Same bandwidth and collector delay; only the query budget 
changes.
+            reader.pollNext(collectorWithInitialDelay(completed, 
SLOW_COLLECTOR_DELAY_SECONDS));
+            Assertions.assertEquals(TIMEOUT_ROW_COUNT, completed.size());
+            Assertions.assertEquals(expectedIds, new HashSet<>(completed));
+            Assertions.assertTrue(completed.containsAll(partial), "Recovery 
replays emitted rows");
+            verify(restoredContext).signalNoMoreElement();
+        }
+    }
+
+    /** Cancels a real query during collection, closes twice, and restores the 
full split. */
+    @Test
+    @Timeout(value = 3, unit = TimeUnit.MINUTES)
+    public void testCouchbaseSourceConcurrentCloseAndReplay() throws Exception 
{
+        String collectionName = "source_cancel";
+        String path = "`test_bucket`.`source_scope`.`" + collectionName + "`";
+        Awaitility.given()
+                .ignoreExceptions()
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(() -> cluster.query("CREATE COLLECTION " + 
path));
+        Awaitility.given()
+                .ignoreExceptions()
+                .atMost(60, TimeUnit.SECONDS)
+                .untilAsserted(() -> cluster.query("CREATE PRIMARY INDEX ON " 
+ path));
+        Collection collection =
+                cluster.bucket(COUCHBASE_BUCKET)
+                        .scope(COUCHBASE_SOURCE_SCOPE)
+                        .collection(collectionName);
+        collection.upsert("one", JsonObject.create().put("id", 1));
+        collection.upsert("two", JsonObject.create().put("id", 2));
+        CountDownLatch collectedFirst = new CountDownLatch(1);
+        CountDownLatch continueCollecting = new CountDownLatch(1);
+        SourceReader.Context context = mock(SourceReader.Context.class);
+        List<Integer> partial = new ArrayList<>();
+        List<SingleSplit> state;
+        ExecutorService executor = Executors.newFixedThreadPool(2);
+        try (SourceReader<SeaTunnelRow, SingleSplit> reader =
+                sourceReader(collectionName, 60, context)) {
+            reader.addSplits(Collections.singletonList(new SingleSplit(null)));
+            reader.open();
+            Future<?> polling =
+                    executor.submit(
+                            () -> {
+                                try {
+                                    reader.pollNext(
+                                            new Collector<SeaTunnelRow>() {
+                                                private final Object lock = 
new Object();
+
+                                                @Override
+                                                public void 
collect(SeaTunnelRow row) {
+                                                    partial.add((Integer) 
row.getField(0));
+                                                    collectedFirst.countDown();
+                                                    try {
+                                                        Assertions.assertTrue(
+                                                                
continueCollecting.await(
+                                                                        30, 
TimeUnit.SECONDS));
+                                                    } catch 
(InterruptedException e) {
+                                                        
Thread.currentThread().interrupt();
+                                                        throw new 
IllegalStateException(e);
+                                                    }
+                                                }
+
+                                                @Override
+                                                public Object 
getCheckpointLock() {
+                                                    return lock;
+                                                }
+                                            });
+                                } catch (Exception e) {
+                                    throw new IllegalStateException(e);
+                                }
+                            });
+            try {
+                Assertions.assertTrue(collectedFirst.await(30, 
TimeUnit.SECONDS));
+                executor.submit(
+                                () -> {
+                                    try {
+                                        reader.close();
+                                    } catch (Exception e) {
+                                        throw new IllegalStateException(e);
+                                    }
+                                })
+                        .get(15, TimeUnit.SECONDS);
+                reader.close();
+            } finally {
+                continueCollecting.countDown();
+                polling.get(15, TimeUnit.SECONDS);
+            }
+            Assertions.assertEquals(1, partial.size());
+            verify(context, never()).signalNoMoreElement();
+            state = reader.snapshotState(1);
+        } finally {
+            continueCollecting.countDown();
+            executor.shutdownNow();
+        }
+        SourceReader.Context restoredContext = 
mock(SourceReader.Context.class);
+        List<Integer> replay = new ArrayList<>();
+        try (SourceReader<SeaTunnelRow, SingleSplit> reader =
+                sourceReader(collectionName, 60, restoredContext)) {
+            reader.addSplits(state);
+            reader.open();
+            reader.pollNext(collectorWithInitialDelay(replay, 0));
+            Assertions.assertEquals(2, replay.size());
+            Assertions.assertEquals(Set.of(1, 2), new HashSet<>(replay));
+            verify(restoredContext).signalNoMoreElement();
+        }
+    }
+
+    private SourceReader<SeaTunnelRow, SingleSplit> timeoutReader(
+            int timeoutSeconds, SourceReader.Context context) throws Exception 
{
+        return sourceReader(COUCHBASE_TIMEOUT_COLLECTION, timeoutSeconds, 
context);
+    }
+
+    private SourceReader<SeaTunnelRow, SingleSplit> sourceReader(
+            String collectionName, int timeoutSeconds, SourceReader.Context 
context)
+            throws Exception {
+        Map<String, Object> options = new HashMap<>();
+        options.put("connection.string", 
couchbaseContainer.getConnectionString());
+        options.put("username", COUCHBASE_USERNAME);
+        options.put("password", COUCHBASE_PASSWORD);
+        options.put("bucket", COUCHBASE_BUCKET);
+        options.put("scope", COUCHBASE_SOURCE_SCOPE);
+        options.put("collection", collectionName);
+        options.put("query.timeout", timeoutSeconds);
+        options.put(
+                "schema",
+                Collections.singletonMap("fields", 
Collections.singletonMap("id", "int")));
+        return new CouchbaseSourceFactory()
+                .<SeaTunnelRow, SingleSplit, 
SingleSplitEnumeratorState>createSource(
+                        new TableSourceFactoryContext(
+                                ReadonlyConfig.fromMap(options), 
getClass().getClassLoader()))
+                .createSource()
+                .createReader(context);
+    }
+
+    private Collector<SeaTunnelRow> collectorWithInitialDelay(List<Integer> 
ids, int delaySeconds) {
+        return new Collector<SeaTunnelRow>() {
+            private final Object lock = new Object();
+
+            @Override
+            public void collect(SeaTunnelRow row) {
+                ids.add((Integer) row.getField(0));
+                if (ids.size() == 1) {
+                    // Stall only after the first row to distinguish streaming 
from startup timeout.
+                    try {
+                        TimeUnit.SECONDS.sleep(delaySeconds);
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                        throw new IllegalStateException("Slow collector 
interrupted", e);
+                    }
+                }
+            }
+
+            @Override
+            public Object getCheckpointLock() {
+                return lock;
+            }
+        };
+    }
+
     @TestTemplate
     @DisabledOnContainer(
             value = {},
@@ -391,4 +811,31 @@ public class CouchbaseIT extends TestSuiteBase implements 
TestResource {
             }
         }
     }
+
+    private QueryBandwidth limitQueryBandwidth() throws IOException {
+        return new QueryBandwidth(
+                queryProxy.toxics().bandwidth("query-response", 
ToxicDirection.DOWNSTREAM, 1024));
+    }
+
+    /** Remove the traffic limit after the reader closes, including failed 
test paths. */
+    private static final class QueryBandwidth implements AutoCloseable {
+        private final Bandwidth toxic;
+        private final long started = System.nanoTime();
+        private boolean released;
+
+        private QueryBandwidth(Bandwidth toxic) {
+            this.toxic = toxic;
+        }
+
+        @Override
+        public void close() throws IOException {
+            if (!released) {
+                toxic.remove();
+                released = true;
+                log.info(
+                        "Query response limited to 1024 KB/s for {} ms",
+                        TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - 
started));
+            }
+        }
+    }
 }
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseSourceConfigTest.java
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseSourceConfigTest.java
new file mode 100644
index 00000000000..b7209ee6dc3
--- /dev/null
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/java/org/apache/seatunnel/e2e/connector/couchbase/CouchbaseSourceConfigTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.seatunnel.e2e.connector.couchbase;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+import org.apache.seatunnel.shade.com.typesafe.config.ConfigFactory;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
+import 
org.apache.seatunnel.connectors.seatunnel.couchbase.source.CouchbaseSourceFactory;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class CouchbaseSourceConfigTest {
+    @Test
+    void bothSinksReferenceTheSourceOutput() {
+        Config config = 
ConfigFactory.parseResources("couchbase_source_to_assert.conf");
+        String sourceOutput = 
config.getConfigList("source").get(0).getString("plugin_output");
+        assertEquals("couchbase_rows", sourceOutput);
+        assertEquals(2, config.getConfigList("sink").size());
+        config.getConfigList("sink")
+                .forEach(sink -> assertEquals(sourceOutput, 
sink.getString("plugin_input")));
+    }
+
+    @Test
+    void jobFixtureProvidesTheRequiredSchema() {
+        ReadonlyConfig options =
+                ReadonlyConfig.fromConfig(
+                        
ConfigFactory.parseResources("couchbase_source_to_assert.conf")
+                                .getConfigList("source")
+                                .get(0));
+        assertArrayEquals(
+                new String[] {"id", "name", "enabled", "amount", "nullable"},
+                new CouchbaseSourceFactory()
+                        .createSource(
+                                new TableSourceFactoryContext(options, 
getClass().getClassLoader()))
+                        .createSource()
+                        .getProducedCatalogTables()
+                        .get(0)
+                        .getSeaTunnelRowType()
+                        .getFieldNames());
+    }
+}
diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/resources/couchbase_source_to_assert.conf
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/resources/couchbase_source_to_assert.conf
new file mode 100644
index 00000000000..9ed865f18e6
--- /dev/null
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-couchbase-e2e/src/test/resources/couchbase_source_to_assert.conf
@@ -0,0 +1,98 @@
+#
+# 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.
+#
+
+env {
+  parallelism = 1
+  job.mode = "BATCH"
+}
+source {
+  Couchbase {
+    plugin_output = "couchbase_rows"
+    connection.string = "couchbase://e2e_couchbase"
+    username = "Administrator"
+    password = "password"
+    bucket = "test_bucket"
+    scope = "source_scope"
+    collection = "source_collection"
+    schema {
+      fields {
+        id = INT
+        name = STRING
+        enabled = BOOLEAN
+        amount = DOUBLE
+        nullable = STRING
+      }
+    }
+  }
+}
+sink {
+  Couchbase {
+    plugin_input = "couchbase_rows"
+    connection.string = "couchbase://e2e_couchbase"
+    username = "Administrator"
+    password = "password"
+    bucket = "test_bucket"
+    scope = "_default"
+    collection = "test_source_result"
+    primary-key = ["id"]
+    upsert-enable = true
+  }
+  Assert {
+    plugin_input = "couchbase_rows"
+    rules {
+      row_rules = [
+        { rule_type = MIN_ROW, rule_value = 2 },
+        { rule_type = MAX_ROW, rule_value = 2 }
+      ]
+      field_rules = [
+        {
+          field_name = "id"
+          field_type = "INT"
+          field_value = [
+            { rule_type = NOT_NULL },
+            { rule_type = MIN, rule_value = 1 },
+            { rule_type = MAX, rule_value = 2 }
+          ]
+        },
+        {
+          field_name = "name"
+          field_type = "STRING"
+          field_value = [{ rule_type = NOT_NULL }]
+        },
+        {
+          field_name = "enabled"
+          field_type = "BOOLEAN"
+          field_value = [{ rule_type = NOT_NULL }]
+        },
+        {
+          field_name = "amount"
+          field_type = "DOUBLE"
+          field_value = [
+            { rule_type = NOT_NULL },
+            { rule_type = MIN, rule_value = -3.25 },
+            { rule_type = MAX, rule_value = 12.5 }
+          ]
+        },
+        {
+          field_name = "nullable"
+          field_type = "STRING"
+          field_value = [{ rule_type = NULL }]
+        }
+      ]
+    }
+  }
+}

Reply via email to