nzw921rx opened a new issue, #13371:
URL: https://github.com/apache/seatunnel/issues/13371

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   Starting an `OceanBase-CDC` job on Zeta with `startup.mode = "timestamp"` 
fails before the source emits any records. While resolving the timestamp to a 
binlog position, SeaTunnel executes `SHOW MASTER LOGS`. OceanBase rejects the 
statement with the following error:
   
   ```text
   java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; 
check the manual that corresponds to your OceanBase version for the right 
syntax to use near 'MASTER LOGS' at line 1
   ```
   
   I ran `SHOW BINARY LOGS` against the same OceanBase endpoint using the job 
account. It returned the binlog file list, confirming that the account has 
permission to list binlogs.
   
   ### Steps to reproduce
   
   1. Configure an `OceanBase-CDC` source for a MySQL-compatible OceanBase 
tenant with Binlog Service enabled.
   2. Set `startup.mode` to `timestamp` and choose a timestamp within the 
retained binlog range. For example:
   
      ```hocon
      startup.mode = "timestamp"
      startup.timestamp = 1795143600000
      ```
   
   3. Submit the configuration as a new streaming job on Zeta.
   
   ### Expected behavior
   
   The source resolves the requested timestamp to a binlog position and starts 
streaming changes from that point.
   
   ### Cause
   
   In SeaTunnel 3.1.0, `MySqlConnectionUtils.findBinlogOffsetBytimestamp()` 
selects the file-listing statement based on the statement used to query the 
current binlog position. When the status statement is `SHOW MASTER STATUS`, the 
method selects `SHOW MASTER LOGS`.
   
   OceanBase supports `SHOW MASTER STATUS` for querying the current position 
and `SHOW BINARY LOGS` for listing files. The timestamp lookup should use `SHOW 
BINARY LOGS` directly. The same conditional also appears in 
`earliestBinlogOffset()`.
   
   [SeaTunnel timestamp 
lookup](https://github.com/apache/seatunnel/blob/3.1.0/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlConnectionUtils.java#L200-L218)
 ยท [OceanBase Binlog Service command 
compatibility](https://www.oceanbase.com/docs/common-oblogproxy-doc-1000000006282183)
   
   ### SeaTunnel Version
   
   3.1.0
   
   ### SeaTunnel Config
   
   ```conf
   env {
     job.mode = "STREAMING"
     parallelism = 1
     checkpoint.interval = 5000
   }
   
   source {
     OceanBase-CDC {
       url = "jdbc:mysql://odp.example.com:2883/inventory"
       username = "cdc_user@demo_tenant"
       password = "<redacted>"
       compatible_mode = "mysql"
       server-id = 5701
   
       database-names = ["inventory"]
       table-names = ["inventory.orders"]
   
       startup.mode = "timestamp"
       startup.timestamp = 1795143600000
     }
   }
   
   sink {
     Console {}
   }
   ```
   
   ### Running Command
   
   ```shell
   ./bin/seatunnel.sh --config ./config/oceanbase-cdc-timestamp.conf -m local
   ```
   
   ### Error Exception
   
   ```log
   java.lang.RuntimeException: One or more fetchers have encountered exception
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.fetcher.SplitFetcherManager.checkErrors(SplitFetcherManager.java:147)
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.SourceReaderBase.getNextFetch(SourceReaderBase.java:167)
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:93)
     at 
org.apache.seatunnel.connectors.cdc.base.source.reader.IncrementalSourceReader.pollNext(IncrementalSourceReader.java:130)
     at 
org.apache.seatunnel.engine.server.task.flow.SourceFlowLifeCycle.collect(SourceFlowLifeCycle.java:299)
     at 
org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.collect(SourceSeaTunnelTask.java:155)
     at 
org.apache.seatunnel.engine.server.task.SeaTunnelTask.stateProcess(SeaTunnelTask.java:292)
     at 
org.apache.seatunnel.engine.server.task.SourceSeaTunnelTask.call(SourceSeaTunnelTask.java:160)
     at 
org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:1304)
     at 
org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:1780)
     at org.apache.seatunnel.api.tracing.MDCRunnable.run(MDCRunnable.java:43)
     at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
     at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
     at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
     at java.base/java.lang.Thread.run(Thread.java:840)
   Caused by: java.lang.RuntimeException: SplitFetcher thread 0 received 
unexpected exception while polling the records
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.fetcher.SplitFetcher.runOnce(SplitFetcher.java:165)
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.fetcher.SplitFetcher.run(SplitFetcher.java:81)
     ... 5 more
   Caused by: org.apache.seatunnel.common.utils.SeaTunnelException: 
org.apache.seatunnel.common.utils.SeaTunnelException: 
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check 
the manual that corresponds to your OceanBase version for the right syntax to 
use near 'MASTER LOGS' at line 1
     at 
org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source.reader.fetch.MySqlSourceFetchTaskContext.getInitOffset(MySqlSourceFetchTaskContext.java:311)
     at 
org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source.reader.fetch.MySqlSourceFetchTaskContext.loadStartingOffsetState(MySqlSourceFetchTaskContext.java:288)
     at 
org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source.reader.fetch.MySqlSourceFetchTaskContext.configure(MySqlSourceFetchTaskContext.java:135)
     at 
org.apache.seatunnel.connectors.cdc.base.source.reader.external.IncrementalSourceStreamFetcher.submitTask(IncrementalSourceStreamFetcher.java:110)
     at 
org.apache.seatunnel.connectors.cdc.base.source.reader.IncrementalSourceSplitReader.checkSplitOrStartNext(IncrementalSourceSplitReader.java:186)
     at 
org.apache.seatunnel.connectors.cdc.base.source.reader.IncrementalSourceSplitReader.fetch(IncrementalSourceSplitReader.java:84)
     at 
org.apache.seatunnel.connectors.seatunnel.common.source.reader.fetcher.FetchTask.run(FetchTask.java:54)
   ```
   
   ### Zeta or Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   java 17
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to