Skip to content

Conversation

@VolkodamovDaniil
Copy link
Contributor

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com #ignite channel.

@timoninmaxim
Copy link
Member

Please, fix merge conflicts

# Conflicts:
#	modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerWalTest.java
#	modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
#	modules/core/src/main/java/org/apache/ignite/internal/management/wal/WalSetStateTask.java
#	modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeAdvancedSelfTest.java
*/
@Test
public void testWalChangeForMultiCacheGroup() throws Exception {
public void testWalManagementOperations() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep old test name

* @throws Exception If failed.
*/
@Test
public void testWalChangeForNonPersistentCaches() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix this behavior in different patch

@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()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arr -> list -> set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use List

}
}

for (String requestedGrp : requestedGrps) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can reuse request groups after removing

}
catch (Exception e) {
errors.add("Failed to execute operation - " + e.getMessage());
return new WalSetStateTaskResult(successGrps, errors);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add NL before return

else {
WalSetStateTaskResult result = jobRes.getData();
if (result.successGroups() != null)
successGrps.addAll(result.successGroups());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can safely reuse success groups from any response

if (errors.isEmpty())
return new WalSetStateTaskResult(new ArrayList<>(successGrps));
else
return new WalSetStateTaskResult(new ArrayList<>(successGrps), errors);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make successGrps list in definition

if (result.successGroups() != null)
successGrps.addAll(result.successGroups());
if (!Boolean.TRUE.equals(result.success()) && result.errorMessages() != null)
errors.addAll(result.errorMessages());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are duplicates of errors

private static final long serialVersionUID = 0L;

/** Success flag. */
private Boolean success;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can check errors for empty.

}

/** {@inheritDoc} */
@Override public void printResult(WalDisableCommandArg arg, WalSetStateTaskResult res, Consumer<String> printer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move logic to a separate class

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<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use map

successGrps.add(grpName);
}
catch (Exception e) {
errors.add("Failed to " + (isEnable ? "enable" : "disable") +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send only exception messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants