[HUDI-2761] Fixing timeline server for repeated refreshes (#4812)
* Fixing timeline server for repeated refreshes
This commit is contained in:
committed by
GitHub
parent
0986d5a01d
commit
6a46130037
@@ -123,18 +123,22 @@ public class RequestHandler {
|
||||
String timelineHashFromClient = ctx.queryParam(RemoteHoodieTableFileSystemView.TIMELINE_HASH, "");
|
||||
HoodieTimeline localTimeline =
|
||||
viewManager.getFileSystemView(basePath).getTimeline().filterCompletedAndCompactionInstants();
|
||||
String localLastKnownInstant = localTimeline.lastInstant().isPresent() ? localTimeline.lastInstant().get().getTimestamp()
|
||||
: HoodieTimeline.INVALID_INSTANT_TS;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Client [ LastTs=" + lastKnownInstantFromClient + ", TimelineHash=" + timelineHashFromClient
|
||||
+ "], localTimeline=" + localTimeline.getInstants().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if ((localTimeline.getInstants().count() == 0)
|
||||
if ((!localTimeline.getInstants().findAny().isPresent())
|
||||
&& HoodieTimeline.INVALID_INSTANT_TS.equals(lastKnownInstantFromClient)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String localTimelineHash = localTimeline.getTimelineHash();
|
||||
if (!localTimelineHash.equals(timelineHashFromClient)) {
|
||||
// refresh if timeline hash mismatches and if local's last known instant < client's last known instant
|
||||
if (!localTimelineHash.equals(timelineHashFromClient)
|
||||
&& HoodieTimeline.compareTimestamps(localLastKnownInstant, HoodieTimeline.LESSER_THAN, lastKnownInstantFromClient)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user