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



##########
File path: docs/_docs/monitoring-metrics/system-views.adoc
##########
@@ -899,3 +899,17 @@ Note, lock will be shown on the non parent node only after 
initial usage on that
 |GROUP_ID | int | Cache group id to store data structure
 |REMOVED | boolean | `True` if removed
 |===
+
+== SNAPSHOTS
+
+The SNAPSHOTS view exposes information about local snapshots.
+
+[{table_opts}]
+|===
+| Column | Data Type | Description
+| SNAPSHOT_NAME | VARCHAR | Snapshot name.
+| NODE_ID | VARCHAR | Consistent id of a node to which this metadata relates.

Review comment:
       done

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -1750,6 +1773,30 @@ static void copy(FileIOFactory factory, File from, File 
to, long length) {
         return new 
IgniteFutureImpl<>(cctx.kernalContext().task().execute(taskCls, snpName));
     }
 
+    /**
+     * Snapshots view supplier.
+     *
+     * @param filter Filter.
+     */
+    private Iterable<SnapshotView> snapshotViewSupplier(Map<String, Object> 
filter) {
+        String snapshotName = 
(String)filter.get(SnapshotViewWalker.SNAPSHOT_NAME_FILTER);
+        String nodeConsistentId = 
(String)filter.get(SnapshotViewWalker.NODE_CONSISTENT_ID_FILTER);
+
+        Collection<ClusterNode> nodes = 
cctx.kernalContext().discovery().aliveServerNodes();
+
+        if (nodeConsistentId != null)

Review comment:
       done

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -1750,6 +1773,30 @@ static void copy(FileIOFactory factory, File from, File 
to, long length) {
         return new 
IgniteFutureImpl<>(cctx.kernalContext().task().execute(taskCls, snpName));
     }
 
+    /**
+     * Snapshots view supplier.
+     *
+     * @param filter Filter.
+     */
+    private Iterable<SnapshotView> snapshotViewSupplier(Map<String, Object> 
filter) {
+        String snapshotName = 
(String)filter.get(SnapshotViewWalker.SNAPSHOT_NAME_FILTER);
+        String nodeConsistentId = 
(String)filter.get(SnapshotViewWalker.NODE_CONSISTENT_ID_FILTER);
+
+        Collection<ClusterNode> nodes = 
cctx.kernalContext().discovery().aliveServerNodes();
+
+        if (nodeConsistentId != null)
+             nodes = nodes.stream()
+                 .filter(n -> 
toStringSafe(n.consistentId()).equals(nodeConsistentId))
+                 .collect(Collectors.toSet());
+
+        List<UUID> ids = 
nodes.stream().map(ClusterNode::id).collect(Collectors.toList());
+
+        ComputeTaskFuture<Set<SnapshotView>> fut = 
((ClusterGroupAdapter)cctx.kernalContext().cluster().get().forServers()).compute()
+            .executeAsync(new SnapshotViewTask(), new 
VisorTaskArgument<String>(ids, snapshotName, false));
+
+        return fut.get();

Review comment:
       done

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -2468,4 +2515,67 @@ public 
IgniteSnapshotFutureImpl(IgniteInternalFuture<Void> fut) {
                 return new IgniteException("Snapshot has not been created", 
U.convertException(e));
         }
     }
+
+    /** Get the snapshot view of a cluster. */
+    @GridInternal
+    private static class SnapshotViewTask extends VisorMultiNodeTask<String, 
Set<SnapshotView>, List<SnapshotView>> {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** {@inheritDoc} */
+        @Override protected SnapshotViewJob job(String arg) {
+            return new SnapshotViewJob(arg, debug);
+        }
+
+        /**  */
+        private static class SnapshotViewJob extends VisorJob<String, 
List<SnapshotView>> {
+            /** */
+            private static final long serialVersionUID = 0L;
+
+            /**
+             * Create job without specified argument.
+             *
+             * @param arg Job argument.
+             * @param debug Flag indicating whether debug information should 
be printed into node log.
+             */
+            protected SnapshotViewJob(@Nullable String arg, boolean debug) {
+                super(arg, debug);
+            }
+
+            /** {@inheritDoc} */
+            @Override protected List<SnapshotView> run(@Nullable String 
snapName) {
+                IgniteSnapshotManager snapMngr = 
(IgniteSnapshotManager)ignite.snapshot();
+
+                List<SnapshotMetadata> metas;
+
+                if (snapName != null)
+                    metas = snapMngr.readSnapshotMetadatas(snapName);
+                else

Review comment:
       done




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

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

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


Reply via email to