You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/14 00:52:16 UTC

[doris] branch master updated: [fix](meta) void NPE when save meta (#18600)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b6b4408283 [fix](meta) void NPE when save meta (#18600)
b6b4408283 is described below

commit b6b44082836f006b73aef171641275abb9c2fa1f
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Fri Apr 14 08:52:09 2023 +0800

    [fix](meta) void NPE when save meta (#18600)
    
    Introduced from #16878,
    the newly added string field can not be null, or NPE will be thrown when calling `Text.writeString()`
---
 fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java  | 6 +++++-
 .../main/java/org/apache/doris/load/routineload/RoutineLoadJob.java | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java
index 2916f2e713..9c1fb49566 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadJob.java
@@ -132,7 +132,7 @@ public abstract class LoadJob extends AbstractTxnStateChangeCallback implements
 
     protected List<ErrorTabletInfo> errorTabletInfos = Lists.newArrayList();
 
-    protected UserIdentity userInfo;
+    protected UserIdentity userInfo = UserIdentity.UNKNOWN;
 
     protected String comment = "";
 
@@ -1116,8 +1116,12 @@ public abstract class LoadJob extends AbstractTxnStateChangeCallback implements
                 userInfo = UserIdentity.read(in);
                 // must set is as analyzed, because when write the user info to meta image, it will be checked.
                 userInfo.setIsAnalyzed();
+            } else {
+                userInfo = UserIdentity.UNKNOWN;
             }
             comment = Text.readString(in);
+        } else {
+            comment = "";
         }
     }
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java
index 4180c39eee..56b4807681 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java
@@ -1572,7 +1572,7 @@ public abstract class RoutineLoadJob extends AbstractTxnStateChangeCallback impl
         Text.writeString(out, comment);
     }
 
-    public void readFields(DataInput in) throws IOException {
+    protected void readFields(DataInput in) throws IOException {
         if (!isTypeRead) {
             dataSourceType = LoadDataSourceType.valueOf(Text.readString(in));
             isTypeRead = true;
@@ -1651,13 +1651,13 @@ public abstract class RoutineLoadJob extends AbstractTxnStateChangeCallback impl
                 userIdentity = UserIdentity.read(in);
                 userIdentity.setIsAnalyzed();
             } else {
-                userIdentity = null;
+                userIdentity = UserIdentity.UNKNOWN;
             }
         }
         if (Env.getCurrentEnvJournalVersion() >= FeMetaVersion.VERSION_117) {
             comment = Text.readString(in);
         } else {
-            comment = null;
+            comment = "";
         }
     }
 


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