You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/02/02 10:05:56 UTC

[GitHub] [incubator-ratis] elek opened a new pull request #414: Do not print error if ratis log is not yet created

elek opened a new pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414


   I found that Ozone prints out a lot of errors related to missing ratis-meta.conf, even if everything works well.
   
   The related code path seems to be prepared to this case, but still prints out errors.


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



[GitHub] [incubator-ratis] adoroszlai commented on a change in pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#discussion_r568514048



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       I think we should keep the log for other exceptions, otherwise the two `catch` blocks can be merged.




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



[GitHub] [incubator-ratis] runzhiwang merged pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
runzhiwang merged pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414


   


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



[GitHub] [incubator-ratis] adoroszlai commented on a change in pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#discussion_r568514048



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       I think we should keep the log for other exceptions, otherwise the two `catch` blocks can be merged.




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



[GitHub] [incubator-ratis] amaliujia commented on a change in pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#discussion_r569030579



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       Reverted my previous comment.
   
   +1 to @adoroszlai 's comment.




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



[GitHub] [incubator-ratis] runzhiwang commented on pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#issuecomment-773678250


   @elek Thanks the patch. @adoroszlai @amaliujia Thanks for review. I have merged the patch.


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



[GitHub] [incubator-ratis] runzhiwang commented on pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
runzhiwang commented on pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#issuecomment-773678250


   @elek Thanks the patch. @adoroszlai @amaliujia Thanks for review. I have merged the patch.


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



[GitHub] [incubator-ratis] amaliujia commented on a change in pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#discussion_r569030579



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       Or actually move the LOG.error to `FileNotFoundException` as that is a error that has happened thus printing that into log is useful?
   
   I guess to avoid printing every exception is the goal of this PR?  

##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       Reverted my previous comment.
   
   +1 to @adoroszlai 's comment.




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



[GitHub] [incubator-ratis] runzhiwang merged pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
runzhiwang merged pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414


   


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



[GitHub] [incubator-ratis] amaliujia commented on a change in pull request #414: RATIS-1304. Do not print error if ratis log is not yet created

Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #414:
URL: https://github.com/apache/incubator-ratis/pull/414#discussion_r569030579



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java
##########
@@ -143,8 +143,10 @@ public RaftConfiguration readRaftConfiguration() {
     try (FileInputStream fio = new FileInputStream(confFile)) {
       LogEntryProto confProto = LogEntryProto.newBuilder().mergeFrom(fio).build();
       return LogProtoUtils.toRaftConfiguration(confProto);
+    } catch (FileNotFoundException e) {
+
+      return null;
     } catch (Exception e) {
-      LOG.error("Failed reading configuration from file:" + confFile, e);
       return null;

Review comment:
       Or actually move the LOG.error to `FileNotFoundException` as that is a error that has happened thus printing that into log is useful?
   
   I guess to avoid printing every exception is the goal of this PR?  




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