xiaochen-zhou commented on code in PR #6766:
URL: https://github.com/apache/seatunnel/pull/6766#discussion_r1582620200
##########
seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/source/PaimonSourceSplitEnumerator.java:
##########
@@ -39,36 +44,51 @@ public class PaimonSourceSplitEnumerator
/** Source split enumerator context */
private final Context<PaimonSourceSplit> context;
- /** The splits that has assigned */
- private final Set<PaimonSourceSplit> assignedSplit;
+ private Map<Integer, List<PaimonSourceSplit>> pendingSplit;
- /** The splits that have not assigned */
- private Set<PaimonSourceSplit> pendingSplit;
+ private volatile boolean shouldEnumerate;
+
+ private final Object stateLock = new Object();
/** The table that wants to read */
private final Table table;
public PaimonSourceSplitEnumerator(Context<PaimonSourceSplit> context,
Table table) {
- this.context = context;
- this.table = table;
- this.assignedSplit = new HashSet<>();
+ this(context, table, null);
}
public PaimonSourceSplitEnumerator(
Context<PaimonSourceSplit> context, Table table, PaimonSourceState
sourceState) {
this.context = context;
this.table = table;
- this.assignedSplit = sourceState.getAssignedSplits();
+ this.pendingSplit = new HashMap<>();
+ this.shouldEnumerate = sourceState == null;
Review Comment:
> I think you can refer the
org.apache.seatunnel.connectors.seatunnel.file.source.split.FileSourceSplitEnumerator
in which we can keep the pendingSplit and assignedSplit at the sametime. It's
more logical that way.
OK, I will optimize the code based on your suggestions
--
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]