You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/11/15 07:18:02 UTC

[incubator-iotdb] branch rel/0.9 updated: fix parallel upgrade user profile (#558)

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

qiaojialin pushed a commit to branch rel/0.9
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/rel/0.9 by this push:
     new a1a5247  fix parallel upgrade user profile (#558)
a1a5247 is described below

commit a1a5247a8d1d5a346579cfcc14c79064658b18b6
Author: gwmh <16...@qq.com>
AuthorDate: Fri Nov 15 15:17:52 2019 +0800

    fix parallel upgrade user profile (#558)
    
    * [fix] fix upgrade user profile when parallel
---
 .../main/java/org/apache/iotdb/db/auth/user/LocalFileUserAccessor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/auth/user/LocalFileUserAccessor.java b/server/src/main/java/org/apache/iotdb/db/auth/user/LocalFileUserAccessor.java
index 88ffd74..4b25b2f 100644
--- a/server/src/main/java/org/apache/iotdb/db/auth/user/LocalFileUserAccessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/auth/user/LocalFileUserAccessor.java
@@ -108,12 +108,13 @@ public class LocalFileUserAccessor implements IUserAccessor {
       user.setRoleList(roleList);
 
       // for online upgrading, profile for 0.8.x does not contain waterMark
+      long userProfileLength = userProfile.length();
       try {
         user.setUseWaterMark(dataInputStream.readInt() != 0);
       } catch (EOFException e1) {
         user.setUseWaterMark(false);
         try (RandomAccessFile file = new RandomAccessFile(userProfile, "rw")) {
-          file.seek(file.length());
+          file.seek(userProfileLength);
           file.writeInt(0);
         }
       }