timoninmaxim commented on code in PR #12608:
URL: https://github.com/apache/ignite/pull/12608#discussion_r2690193118
##########
modules/core/src/main/java/org/apache/ignite/internal/management/wal/WalSetStateTask.java:
##########
@@ -57,22 +52,46 @@ protected WalDisableJob(@Nullable WalDisableCommandArg arg,
boolean debug) {
}
/** {@inheritDoc} */
- @Override protected Void run(@Nullable WalDisableCommandArg arg)
throws IgniteException {
- Set<String> grps = F.isEmpty(arg.groups()) ? null : new
HashSet<>(Arrays.asList(arg.groups()));
+ @Override protected WalSetStateTaskResult run(@Nullable
WalDisableCommandArg arg) throws IgniteException {
+ Set<String> requestedGrps = F.isEmpty(arg.groups()) ? null : new
HashSet<>(Arrays.asList(arg.groups()));
+ boolean isEnable = arg instanceof WalEnableCommandArg;
+ List<String> successGrps = new ArrayList<>();
+ List<String> errors = new ArrayList<>();
Review Comment:
Let's use map
##########
modules/core/src/main/java/org/apache/ignite/internal/management/wal/WalSetStateTask.java:
##########
@@ -57,22 +52,46 @@ protected WalDisableJob(@Nullable WalDisableCommandArg arg,
boolean debug) {
}
/** {@inheritDoc} */
- @Override protected Void run(@Nullable WalDisableCommandArg arg)
throws IgniteException {
- Set<String> grps = F.isEmpty(arg.groups()) ? null : new
HashSet<>(Arrays.asList(arg.groups()));
+ @Override protected WalSetStateTaskResult run(@Nullable
WalDisableCommandArg arg) throws IgniteException {
+ Set<String> requestedGrps = F.isEmpty(arg.groups()) ? null : new
HashSet<>(Arrays.asList(arg.groups()));
+ boolean isEnable = arg instanceof WalEnableCommandArg;
+ List<String> successGrps = new ArrayList<>();
+ List<String> errors = new ArrayList<>();
+
+ try {
+ for (CacheGroupContext gctx :
ignite.context().cache().cacheGroups()) {
+ String grpName = gctx.cacheOrGroupName();
- for (CacheGroupContext gctx :
ignite.context().cache().cacheGroups()) {
- String grpName = gctx.cacheOrGroupName();
+ if (requestedGrps != null &&
!requestedGrps.remove(grpName))
+ continue;
- if (grps != null && !grps.contains(grpName))
- continue;
+ try {
+ if (isEnable)
+ ignite.cluster().enableWal(grpName);
+ else
+ ignite.cluster().disableWal(grpName);
- if (arg instanceof WalEnableCommandArg)
- ignite.cluster().enableWal(grpName);
+ successGrps.add(grpName);
+ }
+ catch (Exception e) {
+ errors.add("Failed to " + (isEnable ? "enable" :
"disable") +
Review Comment:
Send only exception messages
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]