You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/10/26 11:45:02 UTC

[GitHub] [iotdb] liutaohua commented on a change in pull request #1846: [IOTDB-872] Use system timezone in CLI (Session)

liutaohua commented on a change in pull request #1846:
URL: https://github.com/apache/iotdb/pull/1846#discussion_r511895980



##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -916,23 +922,14 @@ public boolean checkTimeseriesExists(String path)
     return result;
   }
 
-  private synchronized String getTimeZone()
-      throws StatementExecutionException, IoTDBConnectionException {
+  private synchronized String getTimeZone() {
     if (zoneId != null) {
       return zoneId.toString();
     }
-
-    TSGetTimeZoneResp resp;
-    try {
-      resp = client.getTimeZone(sessionId);
-    } catch (TException e) {
-      throw new IoTDBConnectionException(e);
-    }
-    RpcUtils.verifySuccess(resp.getStatus());
-    return resp.getTimeZone();
+    return ZoneId.systemDefault().getId();

Review comment:
       There is something wrong with the logic. 
   It should be the default value that the server stores when the client is not registered with the server.

##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -916,23 +922,14 @@ public boolean checkTimeseriesExists(String path)
     return result;
   }
 
-  private synchronized String getTimeZone()
-      throws StatementExecutionException, IoTDBConnectionException {
+  private synchronized String getTimeZone() {
     if (zoneId != null) {
       return zoneId.toString();
     }
-
-    TSGetTimeZoneResp resp;
-    try {
-      resp = client.getTimeZone(sessionId);
-    } catch (TException e) {
-      throw new IoTDBConnectionException(e);
-    }
-    RpcUtils.verifySuccess(resp.getStatus());
-    return resp.getTimeZone();
+    return ZoneId.systemDefault().getId();
   }
 
-  private synchronized void setTimeZone(String zoneId)
+  public synchronized void setTimeZone(String zoneId)
       throws StatementExecutionException, IoTDBConnectionException {
     TSSetTimeZoneReq req = new TSSetTimeZoneReq(sessionId, zoneId);
     TSStatus resp;

Review comment:
       There may be a bug here, because the value stored by the server does not necessarily change when an error is encountered, but the local cached zoneId does




----------------------------------------------------------------
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.

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