deardeng commented on code in PR #10693:
URL: https://github.com/apache/doris/pull/10693#discussion_r917526837


##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java:
##########
@@ -992,6 +999,57 @@ public TWaitingTxnStatusResult 
waitingTxnStatus(TWaitingTxnStatusRequest request
 
     @Override
     public TGetStoragePolicyResult refreshStoragePolicy() throws TException {
-        throw new TException("not implement");
+        LOG.debug("refresh storage policy request");
+        TGetStoragePolicyResult result = new TGetStoragePolicyResult();
+        TStatus status = new TStatus(TStatusCode.OK);
+        result.setStatus(status);
+
+        List<Policy> policyList = 
Catalog.getCurrentCatalog().getPolicyMgr().getPoliciesByType(PolicyTypeEnum.STORAGE);
+        policyList.forEach(
+                iter -> {
+                    // default policy not init.
+                    if (((StoragePolicy) iter).getStorageResource() == null) {
+                        return;
+                    }
+                    TGetStoragePolicy rEntry = new TGetStoragePolicy();
+                    rEntry.setPolicyName(iter.getPolicyName());
+                    //java 8 not support ifPresentOrElse
+                    final long[] ttlCoolDown = {-1};
+                    Optional.ofNullable(((StoragePolicy) 
iter).getCooldownTtl())
+                            .ifPresent(ttl -> ttlCoolDown[0] = 
Integer.parseInt(ttl));
+                    rEntry.setCooldownTtl(ttlCoolDown[0]);
+
+                    final long[] secondTimestamp = {-1};
+                    Optional.ofNullable(((StoragePolicy) 
iter).getCooldownDatetime())
+                        .ifPresent(date -> secondTimestamp[0] = date.getTime() 
/ 1000);
+                    rEntry.setCooldownDatetime(secondTimestamp[0]);
+
+                    Optional.ofNullable(((StoragePolicy) 
iter).getMd5Checksum()).ifPresent(rEntry::setMd5Checksum);
+
+                    TS3StorageParam s3Info = new TS3StorageParam();
+                    Optional.ofNullable(((StoragePolicy) 
iter).getStorageResource()).ifPresent(resource -> {

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

Reply via email to