feature(web): 增加时间线 Rollback 和 Clean 的查询

This commit is contained in:
2023-07-06 19:26:49 +08:00
parent f0c4031365
commit a5a9f600f1
8 changed files with 571 additions and 26 deletions

View File

@@ -0,0 +1,130 @@
package com.lanyuanxiaoyao.service.configuration.entity.hudi;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;
/**
* @author lanyuanxiaoyao
* @date 2023-07-06
*/
public final class HudiCleanerPlan {
private Integer version;
private String policy;
private Instant earliestInstantToRetain;
private ImmutableMap<String, ImmutableList<Info>> filePathsToBeDeletedPerPartition;
private ImmutableMap<String, ImmutableList<String>> filesToBeDeletedPerPartition;
private ImmutableList<String> partitionsToBeDeleted;
public HudiCleanerPlan() {
}
public HudiCleanerPlan(Integer version, String policy, Instant earliestInstantToRetain, ImmutableMap<String, ImmutableList<Info>> filePathsToBeDeletedPerPartition, ImmutableMap<String, ImmutableList<String>> filesToBeDeletedPerPartition, ImmutableList<String> partitionsToBeDeleted) {
this.version = version;
this.policy = policy;
this.earliestInstantToRetain = earliestInstantToRetain;
this.filePathsToBeDeletedPerPartition = filePathsToBeDeletedPerPartition;
this.filesToBeDeletedPerPartition = filesToBeDeletedPerPartition;
this.partitionsToBeDeleted = partitionsToBeDeleted;
}
public Integer getVersion() {
return version;
}
public String getPolicy() {
return policy;
}
public Instant getEarliestInstantToRetain() {
return earliestInstantToRetain;
}
public ImmutableMap<String, ImmutableList<Info>> getFilePathsToBeDeletedPerPartition() {
return filePathsToBeDeletedPerPartition;
}
public ImmutableMap<String, ImmutableList<String>> getFilesToBeDeletedPerPartition() {
return filesToBeDeletedPerPartition;
}
public ImmutableList<String> getPartitionsToBeDeleted() {
return partitionsToBeDeleted;
}
@Override
public String toString() {
return "HudiCleanerPlan{" +
"version=" + version +
", policy='" + policy + '\'' +
", earliestInstantToRetain=" + earliestInstantToRetain +
", filePathsToBeDeletedPerPartition=" + filePathsToBeDeletedPerPartition +
", filesToBeDeletedPerPartition=" + filesToBeDeletedPerPartition +
", partitionsToBeDeleted=" + partitionsToBeDeleted +
'}';
}
public static final class Instant {
private String action;
private String state;
private String timestamp;
public Instant() {
}
public Instant(String action, String state, String timestamp) {
this.action = action;
this.state = state;
this.timestamp = timestamp;
}
public String getAction() {
return action;
}
public String getState() {
return state;
}
public String getTimestamp() {
return timestamp;
}
@Override
public String toString() {
return "Instant{" +
"action='" + action + '\'' +
", state='" + state + '\'' +
", timestamp='" + timestamp + '\'' +
'}';
}
}
public static final class Info {
private String filePath;
private Boolean isBootstrapBaseFile;
public Info() {
}
public Info(String filePath, Boolean isBootstrapBaseFile) {
this.filePath = filePath;
this.isBootstrapBaseFile = isBootstrapBaseFile;
}
public String getFilePath() {
return filePath;
}
public Boolean getBootstrapBaseFile() {
return isBootstrapBaseFile;
}
@Override
public String toString() {
return "Info{" +
"filePath='" + filePath + '\'' +
", isBootstrapBaseFile=" + isBootstrapBaseFile +
'}';
}
}
}

View File

@@ -10,17 +10,21 @@ import org.eclipse.collections.api.map.ImmutableMap;
* @date 2023-05-11
*/
public final class HudiCompactionPlan {
private Integer version;
private ImmutableList<Operation> operations;
private ImmutableMap<String, String> extraMetadata;
private Integer version;
public HudiCompactionPlan() {
}
public HudiCompactionPlan(ImmutableList<Operation> operations, ImmutableMap<String, String> extraMetadata, Integer version) {
public HudiCompactionPlan(Integer version, ImmutableList<Operation> operations, ImmutableMap<String, String> extraMetadata) {
this.version = version;
this.operations = operations;
this.extraMetadata = extraMetadata;
this.version = version;
}
public Integer getVersion() {
return version;
}
public ImmutableList<Operation> getOperations() {
@@ -31,16 +35,12 @@ public final class HudiCompactionPlan {
return extraMetadata;
}
public Integer getVersion() {
return version;
}
@Override
public String toString() {
return "HudiCompactionPlan{" +
"operations=" + operations +
"version=" + version +
", operations=" + operations +
", extraMetadata=" + extraMetadata +
", version=" + version +
'}';
}

View File

@@ -0,0 +1,125 @@
package com.lanyuanxiaoyao.service.configuration.entity.hudi;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;
/**
* Hudi Rollback
*
* @author lanyuanxiaoyao
* @date 2023-07-06
*/
public final class HudiRollbackPlan {
private Integer version;
private Info instantToRollback;
private ImmutableList<Request> rollbackRequests;
public HudiRollbackPlan() {
}
public HudiRollbackPlan(Integer version, Info instantToRollback, ImmutableList<Request> rollbackRequests) {
this.version = version;
this.instantToRollback = instantToRollback;
this.rollbackRequests = rollbackRequests;
}
public Integer getVersion() {
return version;
}
public Info getInstantToRollback() {
return instantToRollback;
}
public ImmutableList<Request> getRollbackRequests() {
return rollbackRequests;
}
@Override
public String toString() {
return "HudiRollbackPlan{" +
"version=" + version +
", instantToRollback=" + instantToRollback +
", rollbackRequests=" + rollbackRequests +
'}';
}
public static final class Info {
private String action;
private String commitTime;
public Info() {
}
public Info(String action, String commitTime) {
this.action = action;
this.commitTime = commitTime;
}
public String getAction() {
return action;
}
public String getCommitTime() {
return commitTime;
}
@Override
public String toString() {
return "Info{" +
"action='" + action + '\'' +
", commitTime='" + commitTime + '\'' +
'}';
}
}
public static final class Request {
private String fileId;
private String partitionPath;
private String latestBaseInstant;
private ImmutableList<String> filesToBeDeleted;
private ImmutableMap<String, Long> logBlocksToBeDeteled;
public Request() {
}
public Request(String fileId, String partitionPath, String latestBaseInstant, ImmutableList<String> filesToBeDeleted, ImmutableMap<String, Long> logBlocksToBeDeteled) {
this.fileId = fileId;
this.partitionPath = partitionPath;
this.latestBaseInstant = latestBaseInstant;
this.filesToBeDeleted = filesToBeDeleted;
this.logBlocksToBeDeteled = logBlocksToBeDeteled;
}
public String getFileId() {
return fileId;
}
public String getPartitionPath() {
return partitionPath;
}
public String getLatestBaseInstant() {
return latestBaseInstant;
}
public ImmutableList<String> getFilesToBeDeleted() {
return filesToBeDeleted;
}
public ImmutableMap<String, Long> getLogBlocksToBeDeteled() {
return logBlocksToBeDeteled;
}
@Override
public String toString() {
return "Request{" +
"fileId='" + fileId + '\'' +
", partitionPath='" + partitionPath + '\'' +
", latestBaseInstant='" + latestBaseInstant + '\'' +
", filesToBeDeleted=" + filesToBeDeleted +
", logBlocksToBeDeteled=" + logBlocksToBeDeteled +
'}';
}
}
}