You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "tsreaper (via GitHub)" <gi...@apache.org> on 2025/08/25 08:01:36 UTC
[PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
tsreaper opened a new pull request, #6142:
URL: https://github.com/apache/paimon/pull/6142
### Purpose
Due to incorrect calculation, currently postpone bucket tables with `'changelog-producer' = 'none'` cannot produce all records with multiple streaming readers. This PR fixes the bug.
### Tests
* `PostponeBucketTableITCase#testNoneChangelogProducer`
### API and Format
No format changes.
### Documentation
No new feature.
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6142:
URL: https://github.com/apache/paimon/pull/6142#discussion_r2297569875
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
Review Comment:
`SplitTaskCalculator`?
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6142:
URL: https://github.com/apache/paimon/pull/6142#discussion_r2297582250
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
+
+ int suggest(DataSplit dataSplit, int parallelism);
+
+ /** Calculate task id according to both bucket and partition. */
+ class BucketAndPartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.partition(), dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /** Calculate task id only considering bucket. */
+ class BucketIgnorePartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /**
+ * Special {@link SuggestedTaskCalculator} for postpone bucket tables with no changelog
+ * producer.
+ */
+ class PostponeBucketNoChangelogProducerCalculator implements SuggestedTaskCalculator {
+
+ private final Pattern pattern;
+
+ public PostponeBucketNoChangelogProducerCalculator() {
+ this.pattern = Pattern.compile("-s-(\\d+?)-");
+ }
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ String fileName = dataSplit.dataFiles().get(0).fileName();
Review Comment:
Please add itcase for this.
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #6142:
URL: https://github.com/apache/paimon/pull/6142#issuecomment-3220045739
+1
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #6142:
URL: https://github.com/apache/paimon/pull/6142
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6142:
URL: https://github.com/apache/paimon/pull/6142#discussion_r2297569875
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
Review Comment:
`SplitTaskComputer`?
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
+
+ int suggest(DataSplit dataSplit, int parallelism);
Review Comment:
compute
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6142:
URL: https://github.com/apache/paimon/pull/6142#discussion_r2297581071
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
+
+ int suggest(DataSplit dataSplit, int parallelism);
+
+ /** Calculate task id according to both bucket and partition. */
+ class BucketAndPartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.partition(), dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /** Calculate task id only considering bucket. */
+ class BucketIgnorePartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /**
+ * Special {@link SuggestedTaskCalculator} for postpone bucket tables with no changelog
+ * producer.
+ */
+ class PostponeBucketNoChangelogProducerCalculator implements SuggestedTaskCalculator {
+
+ private final Pattern pattern;
+
+ public PostponeBucketNoChangelogProducerCalculator() {
+ this.pattern = Pattern.compile("-s-(\\d+?)-");
+ }
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ String fileName = dataSplit.dataFiles().get(0).fileName();
+
+ Matcher matcher = pattern.matcher(fileName);
+ Preconditions.checkState(
+ matcher.find(),
+ "Data file name %s does not match the pattern. This is unexpected.",
+ fileName);
+ return ChannelComputer.select(
+ dataSplit.partition(), Integer.parseInt(matcher.group(1)), parallelism);
+ }
+ }
+
+ static SuggestedTaskCalculator create(Options options) {
+ if (options.get(CoreOptions.BUCKET) == BucketMode.POSTPONE_BUCKET
+ && options.get(CoreOptions.CHANGELOG_PRODUCER)
Review Comment:
We don' need to care changelog producer.
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [flink] Fix postpone bucket without changelog producer cannot read all records with multiple streaming readers [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #6142:
URL: https://github.com/apache/paimon/pull/6142#discussion_r2297580240
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/source/SuggestedTaskCalculator.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.flink.source;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.flink.FlinkConnectorOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.table.BucketMode;
+import org.apache.paimon.table.sink.ChannelComputer;
+import org.apache.paimon.table.source.DataSplit;
+import org.apache.paimon.utils.Preconditions;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Given a {@link DataSplit}, calculate suggested task id for {@link ContinuousFileSplitEnumerator}.
+ */
+public interface SuggestedTaskCalculator {
+
+ int suggest(DataSplit dataSplit, int parallelism);
+
+ /** Calculate task id according to both bucket and partition. */
+ class BucketAndPartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.partition(), dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /** Calculate task id only considering bucket. */
+ class BucketIgnorePartitionCalculator implements SuggestedTaskCalculator {
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ return ChannelComputer.select(dataSplit.bucket(), parallelism);
+ }
+ }
+
+ /**
+ * Special {@link SuggestedTaskCalculator} for postpone bucket tables with no changelog
+ * producer.
+ */
+ class PostponeBucketNoChangelogProducerCalculator implements SuggestedTaskCalculator {
+
+ private final Pattern pattern;
+
+ public PostponeBucketNoChangelogProducerCalculator() {
+ this.pattern = Pattern.compile("-s-(\\d+?)-");
+ }
+
+ @Override
+ public int suggest(DataSplit dataSplit, int parallelism) {
+ String fileName = dataSplit.dataFiles().get(0).fileName();
Review Comment:
You should judge bucket of data split.
--
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: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org