Skip to content

Commit

Permalink
[fix](fe) Avoid invoking RPC in compatibility checking mode (apache#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored and dataroaring committed Aug 2, 2024
1 parent d1d2e63 commit ff91fcc
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ private void checkCreatePartitions(long dbId, long tableId, List<Long> partition

private void preparePartition(long dbId, long tableId, List<Long> partitionIds, List<Long> indexIds)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip prepare partition in checking compatibility mode");
return;
}

Cloud.PartitionRequest.Builder partitionRequestBuilder = Cloud.PartitionRequest.newBuilder();
partitionRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
partitionRequestBuilder.setTableId(tableId);
Expand Down Expand Up @@ -479,6 +484,11 @@ private void preparePartition(long dbId, long tableId, List<Long> partitionIds,

private void commitPartition(long dbId, long tableId, List<Long> partitionIds, List<Long> indexIds)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip committing partitions in check compatibility mode");
return;
}

Cloud.PartitionRequest.Builder partitionRequestBuilder = Cloud.PartitionRequest.newBuilder();
partitionRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
partitionRequestBuilder.addAllPartitionIds(partitionIds);
Expand Down Expand Up @@ -512,6 +522,11 @@ private void commitPartition(long dbId, long tableId, List<Long> partitionIds, L

// if `expiration` = 0, recycler will delete uncommitted indexes in `retention_seconds`
public void prepareMaterializedIndex(Long tableId, List<Long> indexIds, long expiration) throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip prepare materialized index in checking compatibility mode");
return;
}

Cloud.IndexRequest.Builder indexRequestBuilder = Cloud.IndexRequest.newBuilder();
indexRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
indexRequestBuilder.addAllIndexIds(indexIds);
Expand Down Expand Up @@ -544,6 +559,11 @@ public void prepareMaterializedIndex(Long tableId, List<Long> indexIds, long exp

public void commitMaterializedIndex(long dbId, long tableId, List<Long> indexIds, boolean isCreateTable)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip committing materialized index in checking compatibility mode");
return;
}

Cloud.IndexRequest.Builder indexRequestBuilder = Cloud.IndexRequest.newBuilder();
indexRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
indexRequestBuilder.addAllIndexIds(indexIds);
Expand Down Expand Up @@ -577,6 +597,11 @@ public void commitMaterializedIndex(long dbId, long tableId, List<Long> indexIds

private void checkPartition(long dbId, long tableId, List<Long> partitionIds)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip checking partitions in checking compatibility mode");
return;
}

Cloud.CheckKeyInfos.Builder checkKeyInfosBuilder = Cloud.CheckKeyInfos.newBuilder();
checkKeyInfosBuilder.addAllPartitionIds(partitionIds);
// for ms log
Expand Down Expand Up @@ -612,6 +637,11 @@ private void checkPartition(long dbId, long tableId, List<Long> partitionIds)

public void checkMaterializedIndex(long dbId, long tableId, List<Long> indexIds)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip checking materialized index in checking compatibility mode");
return;
}

Cloud.CheckKeyInfos.Builder checkKeyInfosBuilder = Cloud.CheckKeyInfos.newBuilder();
checkKeyInfosBuilder.addAllIndexIds(indexIds);
// for ms log
Expand Down Expand Up @@ -775,6 +805,11 @@ public void erasePartitionDropBackendReplicas(List<Partition> partitions) {

private void dropCloudPartition(long dbId, long tableId, List<Long> partitionIds, List<Long> indexIds,
boolean needUpdateTableVersion) throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip dropping cloud partitions in checking compatibility mode");
return;
}

Cloud.PartitionRequest.Builder partitionRequestBuilder =
Cloud.PartitionRequest.newBuilder();
partitionRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
Expand Down Expand Up @@ -811,6 +846,11 @@ private void dropCloudPartition(long dbId, long tableId, List<Long> partitionIds
}

public void dropMaterializedIndex(long tableId, List<Long> indexIds, boolean dropTable) throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip dropping materialized index in compatibility checking mode");
return;
}

Cloud.IndexRequest.Builder indexRequestBuilder = Cloud.IndexRequest.newBuilder();
indexRequestBuilder.setCloudUniqueId(Config.cloud_unique_id);
indexRequestBuilder.addAllIndexIds(indexIds);
Expand Down Expand Up @@ -966,6 +1006,11 @@ private void unprotectUpdateCloudReplica(OlapTable olapTable, UpdateCloudReplica
}

public void createStage(Cloud.StagePB stagePB, boolean ifNotExists) throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip creating stage in checking compatibility mode");
return;
}

Cloud.CreateStageRequest createStageRequest = Cloud.CreateStageRequest.newBuilder()
.setCloudUniqueId(Config.cloud_unique_id).setStage(stagePB).build();
Cloud.CreateStageResponse response = null;
Expand Down Expand Up @@ -1099,6 +1144,11 @@ private Cloud.GetStageResponse getStageRpc(Cloud.StagePB.StageType stageType, St
public void dropStage(Cloud.StagePB.StageType stageType, String userName, String userId,
String stageName, String reason, boolean ifExists)
throws DdlException {
if (Config.enable_check_compatibility_mode) {
LOG.info("skip dropping stage in checking compatibility mode");
return;
}

Cloud.DropStageRequest.Builder builder = Cloud.DropStageRequest.newBuilder()
.setCloudUniqueId(Config.cloud_unique_id).setType(stageType);
if (userName != null) {
Expand Down

0 comments on commit ff91fcc

Please sign in to comment.