Skip to content

Commit

Permalink
rebase and fix case
Browse files Browse the repository at this point in the history
  • Loading branch information
deardeng committed Sep 12, 2024
1 parent cfc7618 commit 9b5e6a7
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,18 @@ public long getBackendId() throws ClusterException {

private long getBackendIdImpl(String cluster) throws ClusterException {
// if cluster is SUSPENDED, wait
String wakeUPCluster = "";
try {
cluster = ((CloudSystemInfoService) Env.getCurrentSystemInfo()).waitForAutoStart(cluster);
wakeUPCluster = ((CloudSystemInfoService) Env.getCurrentSystemInfo()).waitForAutoStart(cluster);
} catch (DdlException e) {
// this function cant throw exception. so just log it
LOG.warn("cant resume cluster {}, exception", cluster, e);
}
if (!Strings.isNullOrEmpty(wakeUPCluster) && !cluster.equals(wakeUPCluster)) {
cluster = wakeUPCluster;
LOG.warn("get backend input cluster {} useless, so auto start choose a new one cluster {}",
cluster, wakeUPCluster);
}
// check default cluster valid.
if (Strings.isNullOrEmpty(cluster)) {
LOG.warn("failed to get available be, clusterName: {}", cluster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ private void completeRouteInfo() {
LOG.warn("failed to hash replica to be {}", cluster, e);
beId = -1;
}
((CloudReplica) replica).updateClusterToBe(cluster, beId, true);
if (beId <= 0) {
assignedErrNum++;
continue;
}
((CloudReplica) replica).updateClusterToBe(cluster, beId, true);
List<Long> bes = new ArrayList<Long>();
bes.add(beId);
primaryClusterToBackends.put(cluster, bes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private static void logAuditLogImpl(ConnectContext ctx, String origStmt, Stateme
String cloudCluster = "";
try {
if (Config.isCloudMode()) {
cloudCluster = ctx.getCloudCluster();
cloudCluster = ctx.getCloudCluster(false);
}
} catch (ClusterException e) {
LOG.warn("Failed to get cloud cluster", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1251,12 +1251,12 @@ public String getCloudCluster(boolean updateErr) throws ClusterException {

if (Strings.isNullOrEmpty(cluster)) {
LOG.warn("cant get a valid cluster for user {} to use", getCurrentUserIdentity());
ClusterException exception = new ClusterException("the user is not granted permission to the cluster",
ClusterException.FailedTypeEnum.CURRENT_USER_NO_AUTH_TO_USE_ANY_CLUSTER);
if (updateErr) {
getState().setError(ErrorCode.ERR_NO_CLUSTER_ERROR,
"Cant get a Valid cluster for you to use, plz connect admin");
getState().setError(ErrorCode.ERR_CLOUD_CLUSTER_ERROR, exception.getMessage());
}
throw new ClusterException("the user is not granted permission to the cluster",
ClusterException.FailedTypeEnum.CURRENT_USER_NO_AUTH_TO_USE_ANY_CLUSTER);
throw exception;
} else {
this.cloudCluster = cluster;
LOG.info("finally set context cluster name {} for user {} with chose way '{}'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.awaitility.Awaitility;
import org.apache.doris.regression.util.Http
import static java.util.concurrent.TimeUnit.SECONDS;

suite('test_auto_start_in_cloud', 'multi_cluster') {
suite('test_auto_start_in_cloud', 'multi_cluster, docker') {
if (!isCloudMode()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ import groovy.json.JsonSlurper
import org.awaitility.Awaitility;
import static java.util.concurrent.TimeUnit.SECONDS;

suite('test_no_cluster_hits', 'multi_cluster') {
suite('test_no_cluster_hits', 'multi_cluster, docker') {
if (!isCloudMode()) {
return;
}
def options = new ClusterOptions()
options.feConfigs += [
'cloud_cluster_check_interval_second=1',
'sys_log_verbose_modules=org',
'max_query_retry_time=2000'
'max_query_retry_time=2000',
'heartbeat_interval_second=1'
]
options.setFeNum(3)
options.setBeNum(3)
Expand Down Expand Up @@ -106,6 +107,7 @@ suite('test_no_cluster_hits', 'multi_cluster') {
}

cluster.startBackends(1, 2, 3)
Thread.sleep(3000)
result = sql """insert into $table values (3, 3)"""
result = sql """select * from $table"""
log.info("result = {}", result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.awaitility.Awaitility;
import static java.util.concurrent.TimeUnit.SECONDS;
import org.codehaus.groovy.runtime.IOGroovyMethods

suite('test_warmup_rebalance_in_cloud', 'multi_cluster') {
suite('test_warmup_rebalance_in_cloud', 'multi_cluster, docker') {
if (!isCloudMode()) {
return;
}
Expand Down

0 comments on commit 9b5e6a7

Please sign in to comment.