Skip to content

Commit 3e59e98

Browse files
committed
[HUDI-4448] Remove the latest commit refresh for timeline server
1 parent 51b5783 commit 3e59e98

5 files changed

Lines changed: 3 additions & 49 deletions

File tree

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/embedded/EmbeddedTimelineService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ public void startServer() throws IOException {
7878
.serverPort(writeConfig.getEmbeddedTimelineServerPort())
7979
.numThreads(writeConfig.getEmbeddedTimelineServerThreads())
8080
.compress(writeConfig.getEmbeddedTimelineServerCompressOutput())
81-
.async(writeConfig.getEmbeddedTimelineServerUseAsync())
82-
.refreshTimelineBasedOnLatestCommit(writeConfig.isRefreshTimelineServerBasedOnLatestCommit());
81+
.async(writeConfig.getEmbeddedTimelineServerUseAsync());
8382
// Only passing marker-related write configs to timeline server
8483
// if timeline-server-based markers are used.
8584
if (writeConfig.getMarkersType() == MarkerType.TIMELINE_SERVER_BASED) {

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ public class HoodieWriteConfig extends HoodieConfig {
359359
.withDocumentation("Timeline archiving removes older instants from the timeline, after each write operation, to minimize metadata overhead. "
360360
+ "Controls whether or not, the write should be failed as well, if such archiving fails.");
361361

362-
public static final ConfigProperty<Boolean> REFRESH_TIMELINE_SERVER_BASED_ON_LATEST_COMMIT = ConfigProperty
363-
.key("hoodie.refresh.timeline.server.based.on.latest.commit")
364-
.defaultValue(true)
365-
.withDocumentation("Refresh timeline in timeline server based on latest commit apart from timeline hash difference. By default (true).");
366-
367362
public static final ConfigProperty<Long> INITIAL_CONSISTENCY_CHECK_INTERVAL_MS = ConfigProperty
368363
.key("hoodie.consistency.check.initial_interval_ms")
369364
.defaultValue(2000L)
@@ -1105,10 +1100,6 @@ public boolean isFailOnTimelineArchivingEnabled() {
11051100
return getBoolean(FAIL_ON_TIMELINE_ARCHIVING_ENABLE);
11061101
}
11071102

1108-
public boolean isRefreshTimelineServerBasedOnLatestCommit() {
1109-
return getBoolean(REFRESH_TIMELINE_SERVER_BASED_ON_LATEST_COMMIT);
1110-
}
1111-
11121103
public int getMaxConsistencyChecks() {
11131104
return getInt(MAX_CONSISTENCY_CHECKS);
11141105
}
@@ -2514,11 +2505,6 @@ public Builder withAutoAdjustLockConfigs(boolean autoAdjustLockConfigs) {
25142505
return this;
25152506
}
25162507

2517-
public Builder withRefreshTimelineServerBasedOnLatestCommit(boolean refreshTimelineServerBasedOnLatestCommit) {
2518-
writeConfig.setValue(REFRESH_TIMELINE_SERVER_BASED_ON_LATEST_COMMIT, Boolean.toString(refreshTimelineServerBasedOnLatestCommit));
2519-
return this;
2520-
}
2521-
25222508
protected void setDefaults() {
25232509
writeConfig.setDefaultValue(MARKERS_TYPE, getDefaultMarkersType(engineType));
25242510
// Check for mandatory properties

hudi-common/src/main/java/org/apache/hudi/common/table/view/RemoteHoodieTableFileSystemView.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public class RemoteHoodieTableFileSystemView implements SyncableFileSystemView,
116116
public static final String FILEID_PARAM = "fileid";
117117
public static final String LAST_INSTANT_TS = "lastinstantts";
118118
public static final String TIMELINE_HASH = "timelinehash";
119-
public static final String NUM_INSTANTS = "numinstants";
120119
public static final String REFRESH_OFF = "refreshoff";
121120
public static final String INCLUDE_FILES_IN_PENDING_COMPACTION_PARAM = "includependingcompaction";
122121

@@ -163,7 +162,6 @@ private <T> T executeRequest(String requestPath, Map<String, String> queryParame
163162
// Adding mandatory parameters - Last instants affecting file-slice
164163
timeline.lastInstant().ifPresent(instant -> builder.addParameter(LAST_INSTANT_TS, instant.getTimestamp()));
165164
builder.addParameter(TIMELINE_HASH, timeline.getTimelineHash());
166-
builder.addParameter(NUM_INSTANTS, timeline.countInstants() + "");
167165

168166
String url = builder.toString();
169167
LOG.info("Sending request : (" + url + ")");

hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/RequestHandler.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ private boolean isLocalViewBehind(Context ctx) {
121121
String lastKnownInstantFromClient =
122122
ctx.queryParam(RemoteHoodieTableFileSystemView.LAST_INSTANT_TS, HoodieTimeline.INVALID_INSTANT_TS);
123123
String timelineHashFromClient = ctx.queryParam(RemoteHoodieTableFileSystemView.TIMELINE_HASH, "");
124-
String numInstantsFromClient = ctx.queryParam(RemoteHoodieTableFileSystemView.NUM_INSTANTS, "-1");
125124
HoodieTimeline localTimeline =
126125
viewManager.getFileSystemView(basePath).getTimeline().filterCompletedAndCompactionInstants();
127126
if (LOG.isDebugEnabled()) {
@@ -135,33 +134,15 @@ private boolean isLocalViewBehind(Context ctx) {
135134
}
136135

137136
String localTimelineHash = localTimeline.getTimelineHash();
138-
// refresh if timeline hash mismatches and if local's last known instant < client's last known instant (if config is enabled)
139-
if (!localTimelineHash.equals(timelineHashFromClient)
140-
&& (!timelineServiceConfig.refreshTimelineBasedOnLatestCommit
141-
|| localTimelineBehind(localTimeline, lastKnownInstantFromClient, numInstantsFromClient))) {
137+
// refresh if timeline hash mismatches
138+
if (!localTimelineHash.equals(timelineHashFromClient)) {
142139
return true;
143140
}
144141

145142
// As a safety check, even if hash is same, ensure instant is present
146143
return !localTimeline.containsOrBeforeTimelineStarts(lastKnownInstantFromClient);
147144
}
148145

149-
private static boolean localTimelineBehind(HoodieTimeline localTimeline, String lastKnownInstantFromClient, String numInstantsFromClient) {
150-
String localLastKnownInstant = localTimeline.lastInstant().isPresent() ? localTimeline.lastInstant().get().getTimestamp()
151-
: HoodieTimeline.INVALID_INSTANT_TS;
152-
// Why comparing the num commits ?
153-
// Assumes there are 4 commits on the timeline:
154-
// timestamp(action): ts_0(commit), ts_1(commit), ts_2(clean), ts_3(commit)
155-
// when ts_1 is in INFLIGHT state, ts_2 clean action is already finished,
156-
// after ts_1 triggers #sync, the local timeline is refreshed as [ts_0, ts_2],
157-
// when ts_1 switches state from INFLIGHT to COMPLETED, no #sync triggers.
158-
// at ts_3, when the fs view snapshot is requested, the ts_3 client timeline should be [ts_0, ts_1, ts_2],
159-
// if we only compare the latest commit, the local timeline is NOT behind, but the fs view is not complete
160-
// because ts_1 is lost.
161-
return HoodieTimeline.compareTimestamps(localLastKnownInstant, HoodieTimeline.LESSER_THAN, lastKnownInstantFromClient)
162-
|| localTimeline.countInstants() < Integer.parseInt(numInstantsFromClient);
163-
}
164-
165146
/**
166147
* Syncs data-set view if local view is behind.
167148
*/

hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/TimelineService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ public static class Config implements Serializable {
123123
@Parameter(names = {"--marker-parallelism", "-mdp"}, description = "Parallelism to use for reading and deleting marker files")
124124
public int markerParallelism = 100;
125125

126-
@Parameter(names = {"--refreshTimelineBasedOnLatestCommit"}, description = "Refresh local timeline based on latest commit in addition to timeline hash value")
127-
public boolean refreshTimelineBasedOnLatestCommit = true;
128-
129126
@Parameter(names = {"--help", "-h"})
130127
public Boolean help = false;
131128

@@ -150,7 +147,6 @@ public static class Builder {
150147
private int markerBatchNumThreads = 20;
151148
private long markerBatchIntervalMs = 50L;
152149
private int markerParallelism = 100;
153-
private boolean refreshTimelineBasedOnLatestCommit = true;
154150

155151
public Builder() {
156152
}
@@ -200,11 +196,6 @@ public Builder compress(boolean compress) {
200196
return this;
201197
}
202198

203-
public Builder refreshTimelineBasedOnLatestCommit(boolean refreshTimelineBasedOnLatestCommit) {
204-
this.refreshTimelineBasedOnLatestCommit = refreshTimelineBasedOnLatestCommit;
205-
return this;
206-
}
207-
208199
public Builder enableMarkerRequests(boolean enableMarkerRequests) {
209200
this.enableMarkerRequests = enableMarkerRequests;
210201
return this;
@@ -240,7 +231,6 @@ public Config build() {
240231
config.markerBatchNumThreads = this.markerBatchNumThreads;
241232
config.markerBatchIntervalMs = this.markerBatchIntervalMs;
242233
config.markerParallelism = this.markerParallelism;
243-
config.refreshTimelineBasedOnLatestCommit = this.refreshTimelineBasedOnLatestCommit;
244234
return config;
245235
}
246236
}

0 commit comments

Comments
 (0)