[HUDI-2984] Implement #close for AbstractTableFileSystemView (#4285)
This commit is contained in:
@@ -243,6 +243,16 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
|
||||
+ replacedFileGroups.size() + " replaced file groups");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
writeLock.lock();
|
||||
clear();
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the partition Map and reset view states.
|
||||
*/
|
||||
@@ -250,12 +260,7 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
|
||||
public final void reset() {
|
||||
try {
|
||||
writeLock.lock();
|
||||
|
||||
addedPartitions.clear();
|
||||
resetViewState();
|
||||
|
||||
bootstrapIndex = null;
|
||||
|
||||
clear();
|
||||
// Initialize with new Hoodie timeline.
|
||||
init(metaClient, getTimeline());
|
||||
} finally {
|
||||
@@ -263,6 +268,15 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -349,12 +349,12 @@ public class HoodieTableFileSystemView extends IncrementalTimelineSyncFileSystem
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
closed = true;
|
||||
super.reset();
|
||||
super.close();
|
||||
partitionToFileGroupsMap = null;
|
||||
fgIdToPendingCompaction = null;
|
||||
fgIdToBootstrapBaseFile = null;
|
||||
fgIdToReplaceInstants = null;
|
||||
closed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -450,6 +450,7 @@ public class RemoteHoodieTableFileSystemView implements SyncableFileSystemView,
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
timeline = metaClient.reloadActiveTimeline().filterCompletedAndCompactionInstants();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ public class WriteProfile {
|
||||
return;
|
||||
}
|
||||
this.metaClient.reloadActiveTimeline();
|
||||
this.fsView = getFileSystemView();
|
||||
this.fsView.sync();
|
||||
recordProfile();
|
||||
cleanMetadataCache(this.metaClient.getCommitsTimeline().filterCompletedInstants().getInstants());
|
||||
this.smallFilesMap.clear();
|
||||
|
||||
Reference in New Issue
Block a user