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 2021/03/27 17:06:02 UTC

[GitHub] [iotdb] liu-hai opened a new pull request #2930: [IOTDB-2911]Fix The write stream is not closed when executing the command 'tracing off'

liu-hai opened a new pull request #2930:
URL: https://github.com/apache/iotdb/pull/2930


   ## Description
   
   The write stream is not closed when executing the command 'tracing off'
   Fix the bug by adding the following changes
   ### Content1 ...
   server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
   update:
   /** when tracing off need Close the stream */
     private void operateTracing(TracingPlan plan) {
       IoTDBDescriptor.getInstance().getConfig().setEnablePerformanceTracing(plan.isTracingOn());
       if (!plan.isTracingOn()) {
         TracingManager.getInstance().close();
       } else {
         if (!TracingManager.getInstance().getWriterStatus()) {
           TracingManager.getInstance().openTracingWriteStream();
         }
       }
     }
   ### Content2 ...
    server/src/main/java/org/apache/iotdb/db/query/control/TracingManager.java
   add:
     public void close() {
       try {
         writer.close();
       } catch (IOException e) {
         logger.error("Meeting error while Close the tracing log stream : {}", e.getMessage());
       }
     }
   
     public boolean getWriterStatus() {
       try {
         writer.flush();
         return true;
       } catch (IOException e) {
         return false;
       }
     }
   
     public void openTracingWriteStream() {
       File tracingDir =
           SystemFileFactory.INSTANCE.getFile(
               IoTDBDescriptor.getInstance().getConfig().getTracingDir());
       if (!tracingDir.exists()) {
         if (tracingDir.mkdirs()) {
           logger.info("create performance folder {}.", tracingDir);
         } else {
           logger.info("create performance folder {} failed.", tracingDir);
         }
       }
       File logFile =
           SystemFileFactory.INSTANCE.getFile(
               IoTDBDescriptor.getInstance().getConfig().getTracingDir()
                   + File.separator
                   + IoTDBConstant.TRACING_LOG);
       FileWriter fileWriter = null;
       try {
         fileWriter = new FileWriter(logFile, true);
       } catch (IOException e) {
         logger.error("Meeting error while creating TracingManager: {}", e.getMessage());
       }
       writer = new BufferedWriter(fileWriter);
     }
   ### Content3 ...
   server/src/test/java/org/apache/iotdb/db/query/control/TracingManagerTest.java
   add:
       tracingManager.openTracingWriteStream();
   
   
   


-- 
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] [iotdb] jixuan1989 commented on pull request #2930: [ISSUE-2911]Fix The write stream is not closed when executing the command 'tracing off'

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on pull request #2930:
URL: https://github.com/apache/iotdb/pull/2930#issuecomment-811686117


   Can not compile successfully. ..


-- 
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] [iotdb] liu-hai closed pull request #2930: [ISSUE-2911]Fix The write stream is not closed when executing the command 'tracing off'

Posted by GitBox <gi...@apache.org>.
liu-hai closed pull request #2930:
URL: https://github.com/apache/iotdb/pull/2930


   


-- 
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] [iotdb] wangchao316 commented on pull request #2930: [IOTDB-2911]Fix The write stream is not closed when executing the command 'tracing off'

Posted by GitBox <gi...@apache.org>.
wangchao316 commented on pull request #2930:
URL: https://github.com/apache/iotdb/pull/2930#issuecomment-808997573


   hi, IOTDB-2911 does not exist in apache jira.
   if there is issue in github, which rename [ISSUE-2911]..


-- 
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] [iotdb] wangchao316 removed a comment on pull request #2930: [IOTDB-2911]Fix The write stream is not closed when executing the command 'tracing off'

Posted by GitBox <gi...@apache.org>.
wangchao316 removed a comment on pull request #2930:
URL: https://github.com/apache/iotdb/pull/2930#issuecomment-808997573


   hi, IOTDB-2911 does not exist in apache jira.
   if there is issue in github, which rename [ISSUE-2911]..


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