deardeng commented on code in PR #10693: URL: https://github.com/apache/doris/pull/10693#discussion_r917528490
########## fe/fe-core/src/main/java/org/apache/doris/policy/StoragePolicy.java: ########## @@ -149,26 +190,55 @@ public void init(final Map<String, String> props) throws AnalysisException { if (!hasCooldownDatetime && !hasCooldownTtl) { throw new AnalysisException(COOLDOWN_DATETIME + " or " + COOLDOWN_TTL + " must be set"); } - if (!Catalog.getCurrentCatalog().getResourceMgr().containsResource(this.storageResource)) { - throw new AnalysisException("storage resource doesn't exist: " + this.storageResource); + + // no set ttl use -1 + if (!hasCooldownTtl) { + this.cooldownTtl = "-1"; + } + + Resource r = checkIsS3ResourceAndExist(this.storageResource); + if (!((S3Resource) r).policyAddToSet(super.getPolicyName()) && !ifNotExists) { + throw new AnalysisException("this policy has been added to s3 resource once, policy has been created."); + } + this.md5Checksum = calcPropertiesMd5(); + } + + private static Resource checkIsS3ResourceAndExist(final String storageResource) throws AnalysisException { Review Comment: Currently implemented, only supported S3. If there are other types of requirements in the future, can modify based on this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org