[fix](frontend) fix notify update storage policy agent task null exception #12470

This commit is contained in:
deardeng
2022-09-13 16:20:11 +08:00
committed by GitHub
parent 2306e46658
commit b98a3ed86c
2 changed files with 12 additions and 5 deletions

View File

@ -181,11 +181,8 @@ public class StoragePolicy extends Policy {
}
if (props.containsKey(COOLDOWN_TTL)) {
hasCooldownTtl = true;
if (Integer.parseInt(props.get(COOLDOWN_TTL)) < 0) {
throw new AnalysisException("cooldown_ttl must >= 0.");
}
this.cooldownTtl = props.get(COOLDOWN_TTL);
this.cooldownTtlMs = getMsByCooldownTtl(this.cooldownTtl);
// second
this.cooldownTtl = String.valueOf(getMsByCooldownTtl(props.get(COOLDOWN_TTL)) / 1000);
}
if (hasCooldownDatetime && hasCooldownTtl) {
throw new AnalysisException(COOLDOWN_DATETIME + " and " + COOLDOWN_TTL + " can't be set together.");

View File

@ -33,6 +33,7 @@ import org.apache.doris.thrift.TCompactionReq;
import org.apache.doris.thrift.TCreateTabletReq;
import org.apache.doris.thrift.TDownloadReq;
import org.apache.doris.thrift.TDropTabletReq;
import org.apache.doris.thrift.TGetStoragePolicy;
import org.apache.doris.thrift.TMoveDirReq;
import org.apache.doris.thrift.TNetworkAddress;
import org.apache.doris.thrift.TPublishVersionRequest;
@ -349,6 +350,15 @@ public class AgentBatchTask implements Runnable {
tAgentTaskRequest.setCompactionReq(request);
return tAgentTaskRequest;
}
case NOTIFY_UPDATE_STORAGE_POLICY: {
NotifyUpdateStoragePolicyTask notifyUpdateStoragePolicyTask = (NotifyUpdateStoragePolicyTask) task;
TGetStoragePolicy request = notifyUpdateStoragePolicyTask.toThrift();
if (LOG.isDebugEnabled()) {
LOG.debug(request.toString());
}
tAgentTaskRequest.setUpdatePolicy(request);
return tAgentTaskRequest;
}
default:
LOG.debug("could not find task type for task [{}]", task);
return null;