You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/04/08 15:19:59 UTC

[GitHub] [incubator-doris] morningman commented on a diff in pull request #8808: [feature](cold-hot) support s3 resource

morningman commented on code in PR #8808:
URL: https://github.com/apache/incubator-doris/pull/8808#discussion_r845798039


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/DataProperty.java:
##########
@@ -46,40 +57,72 @@ public DataProperty(TStorageMedium medium) {
         this.storageMedium = medium;
         if (medium == TStorageMedium.SSD) {
             long currentTimeMs = System.currentTimeMillis();
-            this.cooldownTimeMs = currentTimeMs + Config.storage_cooldown_second * 1000L;
+            this.coolDownTimeMs = currentTimeMs + Config.storage_cooldown_second * 1000L;
         } else {
-            this.cooldownTimeMs = MAX_COOLDOWN_TIME_MS;
+            this.coolDownTimeMs = MAX_COOL_DOWN_TIME_MS;
         }
+        this.remoteStorageResourceName = "";
+        this.remoteCoolDownTimeMs = MAX_COOL_DOWN_TIME_MS;
+        this.remoteStorageMedium = TStorageMedium.S3;
     }
 
-    public DataProperty(TStorageMedium medium, long cooldown) {
+    public DataProperty(TStorageMedium medium, long coolDown,
+                        String remoteStorageResourceName, long remoteCoolDownTimeMs) {
         this.storageMedium = medium;
-        this.cooldownTimeMs = cooldown;
+        this.coolDownTimeMs = coolDown;
+        this.remoteStorageResourceName = remoteStorageResourceName;
+        this.remoteCoolDownTimeMs = remoteCoolDownTimeMs;
+        if (Strings.isNullOrEmpty(remoteStorageResourceName)) {
+            this.remoteStorageMedium = TStorageMedium.S3;
+        } else {
+            this.remoteStorageMedium = TStorageMedium.valueOf(
+                    Catalog.getCurrentCatalog().getResourceMgr().getResource(remoteStorageResourceName).getType().name()
+            );
+        }
     }
 
     public TStorageMedium getStorageMedium() {
         return storageMedium;
     }
 
-    public long getCooldownTimeMs() {
-        return cooldownTimeMs;
+    public long getCoolDownTimeMs() {
+        return coolDownTimeMs;
+    }
+
+    public long getRemoteCoolDownTimeMs() {
+        return remoteCoolDownTimeMs;
+    }
+
+    public String getRemoteStorageResourceName() {
+        return remoteStorageResourceName;
+    }
+
+    public TStorageMedium getRemoteStorageMedium() {
+        return remoteStorageMedium;
     }
 
     public static DataProperty read(DataInput in) throws IOException {
+        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_108) {
+            String json = Text.readString(in);
+            return GsonUtils.GSON.fromJson(json, DataProperty.class);
+        }
         DataProperty dataProperty = new DataProperty();
         dataProperty.readFields(in);
         return dataProperty;
     }
 
     @Override
     public void write(DataOutput out) throws IOException {
-        Text.writeString(out, storageMedium.name());
-        out.writeLong(cooldownTimeMs);
+        String json = GsonUtils.GSON.toJson(this);
+        Text.writeString(out, json);

Review Comment:
   You can not just modify the serialized method like this.



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/OdbcCatalogResource.java:
##########
@@ -93,6 +93,29 @@ private void checkProperties(String propertiesKey) throws DdlException {
 
     }
 
+    @Override
+    public void modifyProperties(Map<String, String> properties) throws DdlException {
+        // check properties
+        String host = properties.remove(HOST);
+        String port = properties.remove(PORT);
+        String user = properties.remove(USER);
+        String password = properties.remove(PASSWORD);
+        String type = properties.remove(TYPE);
+        String driver = properties.remove(DRIVER);
+
+        if (!properties.isEmpty()) {
+            throw new DdlException("Unknown ODBC catalog resource: " + properties);

Review Comment:
   This check should be done in analysis phase.



##########
fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java:
##########
@@ -79,9 +82,15 @@
 
 import java.util.Arrays;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.doris.common.util.PropertyAnalyzer.PROPERTIES_REMOTE_STORAGE_RESOURCE;

Review Comment:
   Do not use static import



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org