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 89f91a89af [Improve][Benchmark] Move CDC stream fetcher bridge beside
its fixture (#13299)
89f91a89af is described below
commit 89f91a89af15f33d97a942d8b65f4fc1b0c80bf5
Author: zhiweiniu <[email protected]>
AuthorDate: Wed Nov 18 01:45:29 2026 +0000
[Improve][Benchmark] Move CDC stream fetcher bridge beside its fixture
(#13299)
---
.../cdc/IncrementalSourceRecordEmitterFixture.java | 1 -
.../cdc/IncrementalSourceStreamFetcherBridge.java | 59 ++++++++++++++++++++++
.../IncrementalSourceStreamFetcherBridge.java | 30 -----------
3 files changed, 59 insertions(+), 31 deletions(-)
diff --git
a/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceRecordEmitterFixture.java
b/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceRecordEmitterFixture.java
index 364844f8a3..d150c1f9a6 100644
---
a/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceRecordEmitterFixture.java
+++
b/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceRecordEmitterFixture.java
@@ -37,7 +37,6 @@ import
org.apache.seatunnel.connectors.cdc.base.source.offset.OffsetFactory;
import
org.apache.seatunnel.connectors.cdc.base.source.reader.IncrementalSourceRecordEmitter;
import
org.apache.seatunnel.connectors.cdc.base.source.reader.external.FetchTask;
import
org.apache.seatunnel.connectors.cdc.base.source.reader.external.IncrementalSourceStreamFetcher;
-import
org.apache.seatunnel.connectors.cdc.base.source.reader.external.IncrementalSourceStreamFetcherBridge;
import org.apache.seatunnel.connectors.cdc.base.source.split.IncrementalSplit;
import org.apache.seatunnel.connectors.cdc.base.source.split.SourceRecords;
import org.apache.seatunnel.connectors.cdc.base.source.split.SourceSplitBase;
diff --git
a/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceStreamFetcherBridge.java
b/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceStreamFetcherBridge.java
new file mode 100644
index 0000000000..995b25d99b
--- /dev/null
+++
b/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/benchmark/cdc/IncrementalSourceStreamFetcherBridge.java
@@ -0,0 +1,59 @@
+/*
+ * 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.benchmark.cdc;
+
+import
org.apache.seatunnel.connectors.cdc.base.source.reader.external.IncrementalSourceStreamFetcher;
+
+import org.apache.kafka.connect.source.SourceRecord;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+/**
+ * Accesses the package-private stream filter with a method handle resolved
once for the benchmark.
+ */
+final class IncrementalSourceStreamFetcherBridge {
+
+ private static final MethodHandle SHOULD_EMIT = resolveShouldEmit();
+
+ private IncrementalSourceStreamFetcherBridge() {}
+
+ static boolean shouldEmit(IncrementalSourceStreamFetcher fetcher,
SourceRecord record) {
+ try {
+ return (boolean) SHOULD_EMIT.invokeExact(fetcher, record);
+ } catch (RuntimeException | Error e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new IllegalStateException("Failed to invoke the CDC stream
record filter", e);
+ }
+ }
+
+ private static MethodHandle resolveShouldEmit() {
+ try {
+ return MethodHandles.privateLookupIn(
+ IncrementalSourceStreamFetcher.class,
MethodHandles.lookup())
+ .findVirtual(
+ IncrementalSourceStreamFetcher.class,
+ "shouldEmit",
+ MethodType.methodType(boolean.class,
SourceRecord.class));
+ } catch (ReflectiveOperationException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+}
diff --git
a/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/reader/external/IncrementalSourceStreamFetcherBridge.java
b/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/reader/external/IncrementalSourceStreamFetcherBridge.java
deleted file mode 100644
index 433299bf38..0000000000
---
a/seatunnel-benchmarks/src/main/java/org/apache/seatunnel/connectors/cdc/base/source/reader/external/IncrementalSourceStreamFetcherBridge.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.cdc.base.source.reader.external;
-
-import org.apache.kafka.connect.source.SourceRecord;
-
-/** Gives the CDC benchmark direct access to the stream fetcher's
package-private filter. */
-public final class IncrementalSourceStreamFetcherBridge {
-
- private IncrementalSourceStreamFetcherBridge() {}
-
- public static boolean shouldEmit(IncrementalSourceStreamFetcher fetcher,
SourceRecord record) {
- return fetcher.shouldEmit(record);
- }
-}