You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/11/16 18:35:26 UTC

[GitHub] [ignite] Sega76 commented on a change in pull request #8402: IGNITE-13510: Getting status of snapshot execution via command line and jmx.

Sega76 commented on a change in pull request #8402:
URL: https://github.com/apache/ignite/pull/8402#discussion_r524487500



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/visor/snapshot/VisorSnapshotStatusTask.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.snapshot;
+
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteSnapshot;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * @see IgniteSnapshot#statusSnapshot()
+ */
+@GridInternal
+public class VisorSnapshotStatusTask extends VisorOneNodeTask<Void, String> {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorJob<Void, String> job(Void arg) {
+        return new VisorSnapshotStatusJob(debug);
+    }
+
+    /** */
+    private static class VisorSnapshotStatusJob extends VisorJob<Void, String> {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * @param debug Flag indicating whether debug information should be printed into node log.
+         */
+        protected VisorSnapshotStatusJob(boolean debug) {
+            super(null, debug);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected String run(Void arg) throws IgniteException {
+            Set<Object> ids = ignite.context().cache().context().snapshotMgr().statusSnapshot().get().stream()
+                    .filter(Objects::nonNull)
+                    .collect(Collectors.toSet());
+
+            if (ids.isEmpty())
+                return "No snapshot operations.";
+
+            StringBuilder sb = new StringBuilder("чSnapshot operation in progress on nodes with Consistent ID:");

Review comment:
       fixed




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