You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2020/08/21 14:58:17 UTC

[incubator-doris] branch master updated: make some readFields Deprecated (#4399)

This is an automated email from the ASF dual-hosted git repository.

yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new af2b749  make some readFields Deprecated (#4399)
af2b749 is described below

commit af2b749a878b82c7685f4bb60aae4f4d34b9025c
Author: Zhengguo Yang <ya...@gmail.com>
AuthorDate: Fri Aug 21 22:58:08 2020 +0800

    make some readFields Deprecated (#4399)
    
    We have changed most of our serialization methods to json. In order to be compatible with previous data, these classes still retain the readFields method. Some prs that involve modifying metadata often modify the readFields method. To avoid this, we should Mark these methods as Deprecated #4398
---
 .../java/org/apache/doris/alter/AlterJobV2.java    |  1 +
 .../main/java/org/apache/doris/catalog/Column.java |  1 +
 .../java/org/apache/doris/catalog/FsBroker.java    |  1 +
 .../org/apache/doris/catalog/TempPartitions.java   |  1 +
 .../java/org/apache/doris/persist/DropDbInfo.java  |  1 +
 .../apache/doris/persist/DropPartitionInfo.java    |  1 +
 .../apache/doris/persist/TruncateTableInfo.java    |  1 +
 .../java/org/apache/doris/qe/SessionVariable.java  | 91 ++++++++++++----------
 8 files changed, 55 insertions(+), 43 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
index 3a51472..f7578ca 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterJobV2.java
@@ -266,6 +266,7 @@ public abstract class AlterJobV2 implements Writable {
         out.writeLong(timeoutMs);
     }
 
+    @Deprecated
     public void readFields(DataInput in) throws IOException {
         // read common members as write in AlterJobV2.write().
         // except 'type' member, which is read in AlterJobV2.read()
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
index 974df88..7c37de9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
@@ -470,6 +470,7 @@ public class Column implements Writable {
         Text.writeString(out, json);
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         name = Text.readString(in);
         type = ColumnType.read(in);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
index 12e69ec..a7fffe2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/FsBroker.java
@@ -119,6 +119,7 @@ public class FsBroker implements Writable, Comparable<FsBroker> {
         Text.writeString(out, json);
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         ip = Text.readString(in);
         port = in.readInt();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
index 4a1c59d..b5fb03c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TempPartitions.java
@@ -133,6 +133,7 @@ public class TempPartitions implements Writable, GsonPostProcessable {
         }
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         int size = in.readInt();
         for (int i = 0; i < size; i++) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/DropDbInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/DropDbInfo.java
index 1fb335c..f6dce08 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/DropDbInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/DropDbInfo.java
@@ -51,6 +51,7 @@ public class DropDbInfo implements Writable {
         return  forceDrop;
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         dbName = Text.readString(in);
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/DropPartitionInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/DropPartitionInfo.java
index f10b8d2..91669cc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/DropPartitionInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/DropPartitionInfo.java
@@ -72,6 +72,7 @@ public class DropPartitionInfo implements Writable {
         return forceDrop;
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         dbId = in.readLong();
         tableId = in.readLong();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/TruncateTableInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/TruncateTableInfo.java
index 3032123..f75ad13 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/TruncateTableInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/TruncateTableInfo.java
@@ -87,6 +87,7 @@ public class TruncateTableInfo implements Writable {
         Text.writeString(out, json);
     }
 
+    @Deprecated
     private void readFields(DataInput in) throws IOException {
         dbId = in.readLong();
         tblId = in.readLong();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index d9e7241..06114ad 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -578,51 +578,56 @@ public class SessionVariable implements Serializable, Writable {
         Text.writeString(out, root.toString());
     }
 
+    @Deprecated
+    private void readFromStream(DataInput in) throws IOException {
+        codegenLevel = in.readInt();
+        netBufferLength = in.readInt();
+        sqlSafeUpdates = in.readInt();
+        timeZone = Text.readString(in);
+        netReadTimeout = in.readInt();
+        netWriteTimeout = in.readInt();
+        waitTimeout = in.readInt();
+        interactiveTimeout = in.readInt();
+        queryCacheType = in.readInt();
+        autoIncrementIncrement = in.readInt();
+        maxAllowedPacket = in.readInt();
+        sqlSelectLimit = in.readLong();
+        sqlAutoIsNull = in.readBoolean();
+        collationDatabase = Text.readString(in);
+        collationConnection = Text.readString(in);
+        charsetServer = Text.readString(in);
+        charsetResults = Text.readString(in);
+        charsetConnection = Text.readString(in);
+        charsetClient = Text.readString(in);
+        txIsolation = Text.readString(in);
+        autoCommit = in.readBoolean();
+        resourceGroup = Text.readString(in);
+        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_65) {
+            sqlMode = in.readLong();
+        } else {
+            // read old version SQL mode
+            Text.readString(in);
+            sqlMode = 0L;
+        }
+        isReportSucc = in.readBoolean();
+        queryTimeoutS = in.readInt();
+        maxExecMemByte = in.readLong();
+        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_37) {
+            collationServer = Text.readString(in);
+        }
+        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_38) {
+            batchSize = in.readInt();
+            disableStreamPreaggregations = in.readBoolean();
+            parallelExecInstanceNum = in.readInt();
+        }
+        if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_62) {
+            exchangeInstanceParallel = in.readInt();
+        }
+    }
+
     public void readFields(DataInput in) throws IOException {
         if (Catalog.getCurrentCatalogJournalVersion() < FeMetaVersion.VERSION_67) {
-            codegenLevel = in.readInt();
-            netBufferLength = in.readInt();
-            sqlSafeUpdates = in.readInt();
-            timeZone = Text.readString(in);
-            netReadTimeout = in.readInt();
-            netWriteTimeout = in.readInt();
-            waitTimeout = in.readInt();
-            interactiveTimeout = in.readInt();
-            queryCacheType = in.readInt();
-            autoIncrementIncrement = in.readInt();
-            maxAllowedPacket = in.readInt();
-            sqlSelectLimit = in.readLong();
-            sqlAutoIsNull = in.readBoolean();
-            collationDatabase = Text.readString(in);
-            collationConnection = Text.readString(in);
-            charsetServer = Text.readString(in);
-            charsetResults = Text.readString(in);
-            charsetConnection = Text.readString(in);
-            charsetClient = Text.readString(in);
-            txIsolation = Text.readString(in);
-            autoCommit = in.readBoolean();
-            resourceGroup = Text.readString(in);
-            if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_65) {
-                sqlMode = in.readLong();
-            } else {
-                // read old version SQL mode
-                Text.readString(in);
-                sqlMode = 0L;
-            }
-            isReportSucc = in.readBoolean();
-            queryTimeoutS = in.readInt();
-            maxExecMemByte = in.readLong();
-            if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_37) {
-                collationServer = Text.readString(in);
-            }
-            if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_38) {
-                batchSize = in.readInt();
-                disableStreamPreaggregations = in.readBoolean();
-                parallelExecInstanceNum = in.readInt();
-            }
-            if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_62) {
-                exchangeInstanceParallel = in.readInt();
-            }
+            readFromStream(in);
         } else {
             readFromJson(in);
         }


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