-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improve][Connector[File] Optimize files commit order #5045
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ | |
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
|
@@ -34,7 +34,7 @@ public class FileCommitInfo implements Serializable { | |
* | ||
* <p>V is the target file path of the data file. | ||
*/ | ||
private final Map<String, String> needMoveFiles; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as above. |
||
private final LinkedHashMap<String, String> needMoveFiles; | ||
|
||
/** | ||
* Storage the partition information in map. | ||
|
@@ -43,7 +43,7 @@ public class FileCommitInfo implements Serializable { | |
* | ||
* <p>V is the list of partition column's values. | ||
*/ | ||
private final Map<String, List<String>> partitionDirAndValuesMap; | ||
private final LinkedHashMap<String, List<String>> partitionDirAndValuesMap; | ||
|
||
/** Storage the transaction directory */ | ||
private final String transactionDir; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
|
@@ -44,7 +44,7 @@ public List<FileAggregatedCommitInfo> commit( | |
aggregatedCommitInfos.forEach( | ||
aggregatedCommitInfo -> { | ||
try { | ||
for (Map.Entry<String, Map<String, String>> entry : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as above. |
||
for (Map.Entry<String, LinkedHashMap<String, String>> entry : | ||
aggregatedCommitInfo.getTransactionMap().entrySet()) { | ||
for (Map.Entry<String, String> mvFileEntry : | ||
entry.getValue().entrySet()) { | ||
|
@@ -77,13 +77,14 @@ public FileAggregatedCommitInfo combine(List<FileCommitInfo> commitInfos) { | |
if (commitInfos == null || commitInfos.size() == 0) { | ||
return null; | ||
} | ||
Map<String, Map<String, String>> aggregateCommitInfo = new HashMap<>(); | ||
Map<String, List<String>> partitionDirAndValuesMap = new HashMap<>(); | ||
LinkedHashMap<String, LinkedHashMap<String, String>> aggregateCommitInfo = | ||
new LinkedHashMap<>(); | ||
LinkedHashMap<String, List<String>> partitionDirAndValuesMap = new LinkedHashMap<>(); | ||
commitInfos.forEach( | ||
commitInfo -> { | ||
Map<String, String> needMoveFileMap = | ||
LinkedHashMap<String, String> needMoveFileMap = | ||
aggregateCommitInfo.computeIfAbsent( | ||
commitInfo.getTransactionDir(), k -> new HashMap<>()); | ||
commitInfo.getTransactionDir(), k -> new LinkedHashMap<>()); | ||
needMoveFileMap.putAll(commitInfo.getNeedMoveFiles()); | ||
if (commitInfo.getPartitionDirAndValuesMap() != null | ||
&& !commitInfo.getPartitionDirAndValuesMap().isEmpty()) { | ||
|
@@ -109,7 +110,7 @@ public void abort(List<FileAggregatedCommitInfo> aggregatedCommitInfos) throws E | |
aggregatedCommitInfos.forEach( | ||
aggregatedCommitInfo -> { | ||
try { | ||
for (Map.Entry<String, Map<String, String>> entry : | ||
for (Map.Entry<String, LinkedHashMap<String, String>> entry : | ||
aggregatedCommitInfo.getTransactionMap().entrySet()) { | ||
// rollback the file | ||
for (Map.Entry<String, String> mvFileEntry : | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,16 @@ | |
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class FileSinkState implements Serializable { | ||
private final String transactionId; | ||
private final String uuidPrefix; | ||
private final Long checkpointId; | ||
private final Map<String, String> needMoveFiles; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as above. |
||
private final Map<String, List<String>> partitionDirAndValuesMap; | ||
private final LinkedHashMap<String, String> needMoveFiles; | ||
private final LinkedHashMap<String, List<String>> partitionDirAndValuesMap; | ||
private final String transactionDir; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change it?