nsivabalan commented on a change in pull request #4123:
URL: https://github.com/apache/hudi/pull/4123#discussion_r757658855
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java
##########
@@ -851,22 +903,28 @@ public Boolean rollbackFailedWrites() {
*/
public Boolean rollbackFailedWrites(boolean skipLocking) {
HoodieTable<T, I, K, O> table = createTable(config, hadoopConf);
- List<String> instantsToRollback =
getInstantsToRollback(table.getMetaClient(),
config.getFailedWritesCleanPolicy(),
- Option.empty());
- rollbackFailedWrites(instantsToRollback, skipLocking);
+ List<String> instantsToRollback =
getInstantsToRollback(table.getMetaClient(),
config.getFailedWritesCleanPolicy(), Option.empty());
+ Map<String, Option<HoodiePendingRollbackInfo>> pendingRollbacks =
getPendingRollbacks(table.getMetaClient(), Option.empty());
+ instantsToRollback.forEach(entry -> pendingRollbacks.putIfAbsent(entry,
Option.empty()));
+
+ HashMap<String, Option<HoodiePendingRollbackInfo>>
reverseSortedRollbackInstants = pendingRollbacks.entrySet()
+ .stream().sorted((i1, i2) -> i2.getKey().compareTo(i1.getKey()))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1,
e2) -> e1, LinkedHashMap::new));
Review comment:
yeah, if we go with hashmap, then ordering will not be not maintained.
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java
##########
@@ -851,22 +903,28 @@ public Boolean rollbackFailedWrites() {
*/
public Boolean rollbackFailedWrites(boolean skipLocking) {
HoodieTable<T, I, K, O> table = createTable(config, hadoopConf);
- List<String> instantsToRollback =
getInstantsToRollback(table.getMetaClient(),
config.getFailedWritesCleanPolicy(),
- Option.empty());
- rollbackFailedWrites(instantsToRollback, skipLocking);
+ List<String> instantsToRollback =
getInstantsToRollback(table.getMetaClient(),
config.getFailedWritesCleanPolicy(), Option.empty());
+ Map<String, Option<HoodiePendingRollbackInfo>> pendingRollbacks =
getPendingRollbacks(table.getMetaClient(), Option.empty());
+ instantsToRollback.forEach(entry -> pendingRollbacks.putIfAbsent(entry,
Option.empty()));
+
+ HashMap<String, Option<HoodiePendingRollbackInfo>>
reverseSortedRollbackInstants = pendingRollbacks.entrySet()
+ .stream().sorted((i1, i2) -> i2.getKey().compareTo(i1.getKey()))
Review comment:
I found natural ordering one but can use it only for primitive ones.
here our entries are Map.Key,Value and hence had to go with 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]