NSAmelchev commented on a change in pull request #8840:
URL: https://github.com/apache/ignite/pull/8840#discussion_r585784263



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsProcessor.java
##########
@@ -214,6 +216,23 @@ public void stopCollectStatistics() throws 
IgniteCheckedException {
         metastorage.write(PERF_STAT_KEY, false);
     }
 
+    /**
+     * Rotate file collecting performance statistics.
+     *
+     * @throws IgniteCheckedException If stopping failed.
+     */
+    public void rotateCollectStatistics() throws IgniteCheckedException {
+        A.notNull(metastorage, "Metastorage not ready. Node not started?");
+
+        if (ctx.isStopping())
+            throw new NodeStoppingException("Operation has been cancelled 
(node is stopping)");
+
+        if (!enabled())
+            throw new IgniteCheckedException("Performance statistics 
collection not started.");
+
+        ctx.task().execute(PerformanceStatisticsRotateTask.class.getName(),new 
VisorTaskArgument());

Review comment:
       I suggest do not use the Visor's task in the core module. Lets do 
something like `CreateSnapshotCallable`

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/performancestatistics/PerformanceStatisticsProcessor.java
##########
@@ -278,6 +297,30 @@ private void stopWriter() {
         log.info("Performance statistics writer stopped.");
     }
 
+    /** Rotate performance statistics writer. */
+    public void rotateWriter() {
+        try {
+            synchronized (mux) {
+                if (writer == null)
+                    return;
+
+                FilePerformanceStatisticsWriter newWriter = new 
FilePerformanceStatisticsWriter(ctx);
+
+                newWriter.start();
+
+                FilePerformanceStatisticsWriter oldWriter = writer;
+
+                writer = newWriter;
+
+                oldWriter.stop();
+            }

Review comment:
       Add line break, please

##########
File path: 
modules/control-utility/src/test/java/org/apache/ignite/util/PerformanceStatisticsCommandTest.java
##########
@@ -73,6 +80,16 @@ public void testCommands() throws Exception {
         assertEquals(EXIT_CODE_OK, res);
         assertEquals(STATUS_ENABLED, lastOperationResult);
 
+        res = execute(PERFORMANCE_STATISTICS.text(), ROTATE.toString());
+
+        assertEquals(EXIT_CODE_OK, res);

Review comment:
       File rotation must be checked.




----------------------------------------------------------------
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:
[email protected]


Reply via email to