Skip to content
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

[HUDI-2984] Implement #close for AbstractTableFileSystemView #4285

Merged
merged 1 commit into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,26 +243,40 @@ private void resetFileGroupsReplaced(HoodieTimeline timeline) {
+ replacedFileGroups.size() + " replaced file groups");
}

@Override
public void close() {
try {
writeLock.lock();
clear();
} finally {
writeLock.unlock();
}
}

/**
* Clears the partition Map and reset view states.
*/
@Override
public final void reset() {
try {
writeLock.lock();

addedPartitions.clear();
resetViewState();

bootstrapIndex = null;

clear();
// Initialize with new Hoodie timeline.
init(metaClient, getTimeline());
} finally {
writeLock.unlock();
}
}

/**
* Clear the resource.
*/
private void clear() {
addedPartitions.clear();
resetViewState();
bootstrapIndex = null;
}

/**
* Allows all view metadata in file system view storage to be reset by subclasses.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ protected Option<HoodieInstant> getReplaceInstant(final HoodieFileGroupId fileGr

@Override
public void close() {
closed = true;
super.reset();
super.close();
partitionToFileGroupsMap = null;
fgIdToPendingCompaction = null;
fgIdToBootstrapBaseFile = null;
fgIdToReplaceInstants = null;
closed = true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class RemoteHoodieTableFileSystemView implements SyncableFileSystemView,
private final int serverPort;
private final String basePath;
private final HoodieTableMetaClient metaClient;
private final HoodieTimeline timeline;
private HoodieTimeline timeline;
private final ObjectMapper mapper;
private final int timeoutSecs;

Expand Down Expand Up @@ -450,6 +450,7 @@ public void close() {

@Override
public void reset() {
timeline = metaClient.reloadActiveTimeline().filterCompletedAndCompactionInstants();
refresh();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public synchronized void reload(long checkpointId) {
return;
}
this.metaClient.reloadActiveTimeline();
this.fsView = getFileSystemView();
this.fsView.sync();
recordProfile();
cleanMetadataCache(this.metaClient.getCommitsTimeline().filterCompletedInstants().getInstants());
this.smallFilesMap.clear();
Expand Down