[HUDI-2737] Use earliest instant by default for async compaction and clustering jobs (#3991)
Address review comments Fix test failures Co-authored-by: Sagar Sumit <sagarsumit09@gmail.com>
This commit is contained in:
@@ -274,6 +274,12 @@ public class HoodieDefaultTimeline implements HoodieTimeline {
|
||||
return Option.fromJavaOptional(instants.stream().findFirst());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option<HoodieInstant> firstInstant(String action, State state) {
|
||||
return Option.fromJavaOptional(instants.stream()
|
||||
.filter(s -> action.equals(s.getAction()) && state.equals(s.getState())).findFirst());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Option<HoodieInstant> nthInstant(int n) {
|
||||
if (empty() || n >= countInstants()) {
|
||||
|
||||
@@ -209,6 +209,13 @@ public interface HoodieTimeline extends Serializable {
|
||||
*/
|
||||
Option<HoodieInstant> firstInstant();
|
||||
|
||||
/**
|
||||
* @param action Instant action String.
|
||||
* @param state Instant State.
|
||||
* @return first instant of a specific action and state if available
|
||||
*/
|
||||
Option<HoodieInstant> firstInstant(String action, State state);
|
||||
|
||||
/**
|
||||
* @return nth completed instant from the first completed instant
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user