1
0

[HUDI-1352] Add FileSystemView APIs to query pending clustering operations (#2202)

This commit is contained in:
satishkotha
2020-11-05 08:49:58 -08:00
committed by GitHub
parent 5f5c15b0d9
commit 33ec88fc38
26 changed files with 974 additions and 14 deletions

View File

@@ -20,6 +20,7 @@ package org.apache.hudi.timeline.service;
import org.apache.hudi.common.table.timeline.HoodieTimeline;
import org.apache.hudi.common.table.timeline.dto.BaseFileDTO;
import org.apache.hudi.common.table.timeline.dto.ClusteringOpDTO;
import org.apache.hudi.common.table.timeline.dto.CompactionOpDTO;
import org.apache.hudi.common.table.timeline.dto.FileGroupDTO;
import org.apache.hudi.common.table.timeline.dto.FileSliceDTO;
@@ -297,6 +298,12 @@ public class FileSystemViewHandler {
ctx.queryParam(RemoteHoodieTableFileSystemView.PARTITION_PARAM,""));
writeValueAsString(ctx, dtos);
}, true));
app.get(RemoteHoodieTableFileSystemView.PENDING_CLUSTERING_FILEGROUPS, new ViewHandler(ctx -> {
List<ClusteringOpDTO> dtos = sliceHandler.getFileGroupsInPendingClustering(
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.BASEPATH_PARAM).getOrThrow());
writeValueAsString(ctx, dtos);
}, true));
}
private static boolean isRefreshCheckDisabledInQuery(Context ctxt) {

View File

@@ -19,6 +19,7 @@
package org.apache.hudi.timeline.service.handlers;
import org.apache.hadoop.conf.Configuration;
import org.apache.hudi.common.table.timeline.dto.ClusteringOpDTO;
import org.apache.hudi.common.table.timeline.dto.CompactionOpDTO;
import org.apache.hudi.common.table.timeline.dto.FileGroupDTO;
import org.apache.hudi.common.table.timeline.dto.FileSliceDTO;
@@ -93,6 +94,12 @@ public class FileSliceHandler extends Handler {
.collect(Collectors.toList());
}
public List<ClusteringOpDTO> getFileGroupsInPendingClustering(String basePath) {
return viewManager.getFileSystemView(basePath).getFileGroupsInPendingClustering()
.map(fgInstant -> ClusteringOpDTO.fromClusteringOp(fgInstant.getLeft(), fgInstant.getRight()))
.collect(Collectors.toList());
}
public boolean refreshTable(String basePath) {
viewManager.clearFileSystemView(basePath);
return true;