Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-13697 Defragmentation control.sh API first commands. #8449

Closed
wants to merge 150 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
5c0bb03
Simplest test added
May 27, 2020
f9abfb4
Test improvements
May 28, 2020
a979a2a
Defragmentation events listener
Jun 1, 2020
8e361c4
Minor refactoring to extract inner class
Jun 2, 2020
d922b36
GridCacheDataStore moved to separate class for reuse
Jun 2, 2020
495c68e
DefragmentationContext abstraction introduced, core is rewritten base…
Jun 5, 2020
9e6754e
Simplest test added
May 27, 2020
4ccb5a0
Test improvements
May 28, 2020
1e013a7
Defragmentation events listener
Jun 1, 2020
8990604
Minor refactoring to extract inner class
Jun 2, 2020
da70362
GridCacheDataStore moved to separate class for reuse
Jun 2, 2020
560ad16
DefragmentationContext abstraction introduced, core is rewritten base…
Jun 5, 2020
5066364
Added PageStoreCollection
alievmirza Jun 29, 2020
62d6fdd
IGNITE-13190 Changes from feature branch integrated
Jul 14, 2020
e506a1b
IGNITE-13190 Add link mapping tree.
SammyVimes Jul 21, 2020
e000ab2
IGNITE-13190 Encrypted file page store factory
SammyVimes Aug 4, 2020
8e68138
IGNITE-13190 New outer classes moved back to prevent merge conflicts.
ibessonov Aug 5, 2020
e173af0
IGNITE-13190 GridGain licenses removed from code.
ibessonov Aug 5, 2020
f104b0b
IGNITE-13190 PageStore management improved. Code reorganized and clea…
ibessonov Aug 6, 2020
51706e8
IGNITE-13190 Ability to checkpoint pages from new regions. Small code…
ibessonov Aug 6, 2020
3a150fe
IGNITE-13190 Basic failover code, not fully completed yet. Checkpoint…
ibessonov Aug 7, 2020
0ffb7e6
IGNITE-13190 Few small bugs fixed. Partition metadata copying impleme…
ibessonov Aug 13, 2020
b395fff
IGNITE-13190 Utility class extracted from manager.
ibessonov Aug 14, 2020
cf88708
IGNITE-13190 wip
ibessonov Aug 14, 2020
1d6f103
IGNITE-13190 Filtering of CacheDataStores fixed to find needed partition
sergey-chugunov-1985 Aug 28, 2020
deb3527
IGNITE-13190 Partial revert to avoid merge conflicts.
ibessonov Aug 31, 2020
e04858d
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Aug 31, 2020
2f50851
IGNITE-13190 Merge conflicts reapplied.
ibessonov Aug 31, 2020
6ab14b7
IGNITE-13190 Merge conflicts reapplied.
ibessonov Aug 31, 2020
8ff3e5f
Merge remote-tracking branch 'professional/ignite-13190' into ignite-…
ibessonov Aug 31, 2020
9563932
IGNITE-13190 JVM Crash fixed; Number of partitions in test lowered ba…
ibessonov Aug 31, 2020
678f46b
IGNITE-13190 Improved failover; Refactoring.
ibessonov Sep 2, 2020
5270a26
IGNITE-13190 Failover tests.
ibessonov Sep 2, 2020
7100748
IGNITE-13190 Creation of new row in defragmented partition fixed.
ibessonov Sep 4, 2020
30fba1f
IGNITE-13190 Index defragmentation.
SammyVimes Sep 3, 2020
6d28a7b
IGNITE-13190 Remove odd field.
SammyVimes Sep 7, 2020
dc3388e
IGNITE-13190 Failed tests fixed.
ibessonov Sep 8, 2020
a222a54
Merge remote-tracking branch 'professional/ignite-13190' into ignite-…
ibessonov Sep 8, 2020
7fb3362
IGNITE-13190 Fix index tree root creation.
SammyVimes Sep 8, 2020
e8509f1
IGNITE-13190 Test that defragmented index root is in meta tree.
SammyVimes Sep 8, 2020
555485a
IGNITE-13190 Refactoring; Eviction mode bug fixed.
ibessonov Sep 10, 2020
f4da2c5
IGNITE-13190 Fix indexing defragmentation for not inline indexes.
SammyVimes Sep 14, 2020
d4f5324
IGNITE-13190 [IGNITE-13190] Squashed Maintenance mode, unfinished.
ibessonov Sep 16, 2020
1daf29c
IGNITE-13190 Maintenance mode used for defragmentation but without au…
ibessonov Sep 17, 2020
6d4276e
IGNITE-13190 Eliminated some checkpoint future waits.
ibessonov Sep 18, 2020
a15b4cf
IGNITE-13190 Few javadocs.
ibessonov Sep 21, 2020
75ee7c3
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Sep 21, 2020
66e5c27
IGNITE-13190 MVCC indexes defragmentation and tests.
SammyVimes Sep 15, 2020
a937c07
IGNITE-13190 Checkpoint integration
akalash Sep 21, 2020
a1b7442
Merge branch 'master' into checkpoint-integration
akalash Sep 25, 2020
aa3c723
IGNITE-13190 Configuration; Checkpoint locks for index; Wrappers for …
ibessonov Sep 30, 2020
ff452df
IGNITE-13190 Few adjustments to the code.
ibessonov Oct 6, 2020
37cc862
IGNITE-13190 Few adjustments to the code.
ibessonov Oct 8, 2020
d21ac60
IGNITE-13190 Commented line removed.
ibessonov Oct 8, 2020
33acaa2
IGNITE-13190 Tiny log message at the end.
ibessonov Oct 15, 2020
6e91f1f
IGNITE-13190 Revert "IGNITE-13190 [IGNITE-13190] Squashed Maintenance…
akalash Oct 16, 2020
81db3b6
Merge branch 'master' into ignite-13190
akalash Oct 16, 2020
8785422
IGNITE-13190 Maintenance mode integration
akalash Oct 16, 2020
19ca7ee
IGNITE-13190 Deprecated system property removed.
ibessonov Oct 23, 2020
1b17c8b
IGNITE-13190 Defragmentation context mostly removed.
ibessonov Oct 23, 2020
dce6a73
IGNITE-13190 Defragmentation context mostly removed, part 2.
ibessonov Oct 26, 2020
bdc9662
IGNITE-13190 Crash fixed.
ibessonov Oct 26, 2020
ced2dac
IGNITE-13190 LICENSES
ibessonov Oct 26, 2020
7a244b9
IGNITE-13190 First checkpoint moved into defragmentation code.
ibessonov Oct 27, 2020
a3795fa
IGNITE-13190 Logs for the problem in benchmark scenario.
ibessonov Oct 27, 2020
52a5f4a
IGNITE-13190 Bunch of tiny fixes.
ibessonov Oct 27, 2020
7d752f6
IGNITE-13190 Tests ignored in MVCC suite.
ibessonov Oct 27, 2020
d3fc45f
IGNITE-13190 Javadoc
ibessonov Oct 27, 2020
bc2e16c
IGNITE-13190 Indexing fix.
ibessonov Oct 27, 2020
9abcf15
IGNITE-13190 Lost log message returned back.
ibessonov Oct 28, 2020
1c899d2
IGNITE-13190 MVCC suite 4.
ibessonov Oct 28, 2020
7e15622
IGNITE-13190 Few more tests fixed.
ibessonov Oct 28, 2020
99c5d99
IGNITE-13190 One more test fixed.
ibessonov Oct 28, 2020
8d96744
IGNITE-13190 Extra formatting removed. We don't need it, patch is alr…
ibessonov Oct 28, 2020
88464df
IGNITE-13190 Checkpoint listeners leak removed.
ibessonov Oct 29, 2020
2cf598f
Merge branch 'apache-master' into ignite-13190
ibessonov Oct 29, 2020
f32d2ac
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Oct 29, 2020
cbc5614
IGNITE-13190 Compilation error fixed.
ibessonov Oct 29, 2020
10af061
IGNITE-13190 New meta page version supported.
ibessonov Oct 29, 2020
7d2a375
IGNITE-13190 "Defragmentation started." message added.
ibessonov Oct 29, 2020
ce9d890
IGNITE-13190 Encryption test; Context removed completely.
ibessonov Oct 30, 2020
6abffdf
IGNITE-13190 Control.sh basic code
ibessonov Nov 5, 2020
5daec74
IGNITE-13190 Control.sh basic code, part 2
ibessonov Nov 5, 2020
c5aedc3
IGNITE-13190 Missing checkpoint lock.
ibessonov Nov 5, 2020
ddf9563
Merge branch 'ignite-13190' into ignite-13190-api
ibessonov Nov 5, 2020
e7360f2
IGNITE-13190 Stupid error fixed.
ibessonov Nov 5, 2020
f603c1c
IGNITE-13190 A bit of commands code.
ibessonov Nov 6, 2020
4b16d75
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Nov 6, 2020
ce6715c
IGNITE-13190 Compilation error fixed
ibessonov Nov 6, 2020
59e74ca
Merge branch 'ignite-13190' into ignite-13190-api
ibessonov Nov 6, 2020
f5808ba
IGNITE-13190 Checkstyle.
ibessonov Nov 6, 2020
551149e
IGNITE-13190 Several bugs fixed.
ibessonov Nov 6, 2020
085ef77
IGNITE-13190 Test for cancellation + bunch of small fixes so that tes…
ibessonov Nov 10, 2020
38e3d38
IGNITE-13190 "status" command removed from possibilities.
ibessonov Nov 10, 2020
616e37b
IGNITE-13190 Help.
ibessonov Nov 10, 2020
6bb19d1
IGNITE-13190 Several bugs / issues fixed.
ibessonov Nov 11, 2020
adfbd5c
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Nov 12, 2020
c943aab
IGNITE-13684 Compilation errors fixed.
ibessonov Nov 12, 2020
9a28415
IGNITE-13190 Incompatible changes merged.
ibessonov Nov 12, 2020
96944ff
IGNITE-13190 Several TODO removed.
ibessonov Nov 12, 2020
893ed7d
IGNITE-13190 Removed some debug logging.
ibessonov Nov 12, 2020
fc392b7
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 13, 2020
e6b3830
IGNITE-13190 Unused code removed.
ibessonov Nov 13, 2020
be9cef3
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 13, 2020
9f055a0
IGNITE-13697 Conflict fixed.
ibessonov Nov 13, 2020
b815762
IGNITE-13697 Typo + classnames.properties
ibessonov Nov 16, 2020
d0efe52
IGNITE-13190 A bit of dead code removed.
ibessonov Nov 16, 2020
3fce806
IGNITE-13190 Several review remarks addressed.
ibessonov Nov 17, 2020
bb18443
IGNITE-13190 Several review remarks addressed #2.
ibessonov Nov 17, 2020
87fd6fc
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Nov 17, 2020
fb3b458
IGNITE-13190 Compilation errors.
ibessonov Nov 17, 2020
3c19a84
IGNITE-13190 Reconfiguring region size if defragmentation is needed
akalash Nov 18, 2020
58125c1
IGNITE-13190 Improved indexing tests.
ibessonov Nov 19, 2020
d9f3836
IGNITE-13190 LinkMapTest
ibessonov Nov 19, 2020
8382f6b
IGNITE-13190 LinkMapTest
ibessonov Nov 19, 2020
b7db370
Merge remote-tracking branch 'professional/ignite-13190' into ignite-…
ibessonov Nov 19, 2020
385ca67
IGNITE-13697 Tests fixed.
ibessonov Nov 20, 2020
1f11b21
IGNITE-13697 More tests fixed.
ibessonov Nov 20, 2020
50e8525
IGNITE-13697 Partial test fix.
ibessonov Nov 20, 2020
9a0f817
IGNITE-13697 Ignored test.
ibessonov Nov 20, 2020
4809e35
IGNITE-13190 More fair regions configuration.
ibessonov Nov 24, 2020
cbcd198
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Nov 24, 2020
1371623
Merge remote-tracking branch 'professional/ignite-13190' into ignite-…
ibessonov Nov 24, 2020
4ea97a9
IGNITE-13190 Fix of review remarks.
ibessonov Nov 25, 2020
7544d1c
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 25, 2020
4783701
IGNITE-13697 Review fix re-fixed
ibessonov Nov 25, 2020
b86f240
IGNITE-13190 Default changed.
ibessonov Nov 26, 2020
ac661f0
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 26, 2020
55b08fe
IGNITE-13190 Refactoring of indexing API.
ibessonov Nov 27, 2020
bc45e61
IGNITE-13190 Eliminated explicit busy lock usage.
ibessonov Nov 27, 2020
64fa01e
IGNITE-13190 More unchecked exceptions used.
ibessonov Nov 27, 2020
da4e14e
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Nov 27, 2020
32a2297
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 27, 2020
93eb825
IGNITE-13697 Compilation errors after merge.
ibessonov Nov 27, 2020
8118ec4
IGNITE-13190 More review remarks addressed.
ibessonov Nov 30, 2020
52f7dcf
Merge branch 'ignite-13190' into ignite-13697
ibessonov Nov 30, 2020
1b7d8ee
IGNITE-13190 TimeTracker removed.
ibessonov Dec 1, 2020
a0e65d9
Merge branch 'ignite-13190' into ignite-13697
ibessonov Dec 1, 2020
c1c6747
Merge remote-tracking branch 'origin/master' into ignite-13190
ibessonov Dec 2, 2020
8f0ec22
Merge branch 'ignite-13190' into ignite-13697
ibessonov Dec 2, 2020
4aa80e0
IGNITE-13697 Test unignored. It's going to fixed in master soon.
ibessonov Dec 2, 2020
27baead
IGNITE-13697 Flaky tests fixed.
ibessonov Dec 2, 2020
15554bd
IGNITE-13697 Test fixed
ibessonov Dec 2, 2020
1f5a1cf
IGNITE-13190 Unused class removed.
ibessonov Dec 3, 2020
77cff60
Merge branch 'apache-master' into ignite-13190
ibessonov Dec 3, 2020
e4a714c
Merge branch 'ignite-13190' into ignite-13697
ibessonov Dec 3, 2020
aed2ad1
Merge remote-tracking branch 'origin/master' into ignite-13697
ibessonov Dec 3, 2020
f61ad06
IGNITE-13697 Javadoc.
ibessonov Dec 3, 2020
d56e118
Merge remote-tracking branch 'origin/master' into ignite-13697
ibessonov Dec 3, 2020
45132d7
IGNITE-13697 Bad formatting fixed.
ibessonov Dec 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ public enum CommandList {
METRIC("--metric", new MetricCommand()),

/** */
PERSISTENCE("--persistence", new PersistenceCommand());
PERSISTENCE("--persistence", new PersistenceCommand()),

/** Command to manage PDS defragmentation. */
DEFRAGMENTATION("--defragmentation", new DefragmentationCommand());

/** Private values copy so there's no need in cloning it every time. */
private static final CommandList[] VALUES = CommandList.values();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
/*
* 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.commandline;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.apache.ignite.internal.client.GridClient;
import org.apache.ignite.internal.client.GridClientConfiguration;
import org.apache.ignite.internal.client.GridClientNode;
import org.apache.ignite.internal.commandline.defragmentation.DefragmentationArguments;
import org.apache.ignite.internal.commandline.defragmentation.DefragmentationSubcommands;
import org.apache.ignite.internal.visor.VisorTaskArgument;
import org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationOperation;
import org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTask;
import org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTaskArg;
import org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationTaskResult;

import static org.apache.ignite.internal.commandline.Command.usage;
import static org.apache.ignite.internal.commandline.CommandList.DEFRAGMENTATION;
import static org.apache.ignite.internal.commandline.defragmentation.DefragmentationSubcommands.CANCEL;
import static org.apache.ignite.internal.commandline.defragmentation.DefragmentationSubcommands.SCHEDULE;

/** */
public class DefragmentationCommand implements Command<DefragmentationArguments> {
/** */
private static final String NODES_ARG = "--nodes";

/** */
private static final String CACHES_ARG = "--caches";

/** */
private DefragmentationArguments args;

/** {@inheritDoc} */
@Override public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception {
try (GridClient client = Command.startClient(clientCfg)) {
Optional<GridClientNode> firstNodeOpt = client.compute().nodes().stream().filter(GridClientNode::connectable).findFirst();

if (firstNodeOpt.isPresent()) {
VisorDefragmentationTaskResult res;

if (args.nodeIds() == null) {
res = TaskExecutor.executeTaskByNameOnNode(
client,
VisorDefragmentationTask.class.getName(),
convertArguments(),
null, // Use node from clientCfg.
clientCfg
);
}
else {
VisorTaskArgument<?> visorArg = new VisorTaskArgument<>(
client.compute().nodes().stream().filter(
node -> args.nodeIds().contains(node.consistentId().toString())
).map(GridClientNode::nodeId).collect(Collectors.toList()),
convertArguments(),
false
);

res = client.compute()
.projection(firstNodeOpt.get())
.execute(
VisorDefragmentationTask.class.getName(),
visorArg
);
}

printResult(res, log);
}
else
log.warning("No nodes found in topology, command won't be executed.");
}
catch (Throwable t) {
log.severe("Failed to execute defragmentation command='" + args.subcommand().text() + "'");
log.severe(CommandLogger.errorMessage(t));

throw t;
}

return null;
}

/** */
private void printResult(VisorDefragmentationTaskResult res, Logger log) {
assert res != null;

log.info(res.getMessage());
}

/** {@inheritDoc} */
@Override public void parseArguments(CommandArgIterator argIter) {
DefragmentationSubcommands cmd = DefragmentationSubcommands.of(argIter.nextArg("Expected defragmentation subcommand."));

if (cmd == null || cmd == DefragmentationSubcommands.STATUS) // Status subcommand is not yet completed.
throw new IllegalArgumentException("Expected correct defragmentation subcommand.");

args = new DefragmentationArguments(cmd);

switch (cmd) {
case SCHEDULE:
List<String> consistentIds = null;
List<String> cacheNames = null;

String subarg;

do {
subarg = argIter.nextArg("Expected one of subcommand arguments.").toLowerCase(Locale.ENGLISH);

switch (subarg) {
case NODES_ARG: {
Set<String> ids = argIter.nextStringSet(NODES_ARG);

if (ids.isEmpty())
throw new IllegalArgumentException("Consistent ids list is empty.");

consistentIds = new ArrayList<>(ids);

break;
}

case CACHES_ARG: {
Set<String> ids = argIter.nextStringSet(CACHES_ARG);

if (ids.isEmpty())
throw new IllegalArgumentException("Caches list is empty.");

cacheNames = new ArrayList<>(ids);

break;
}

default:
subarg = null;
}
}
while (subarg != null);

if (consistentIds == null)
throw new IllegalArgumentException("--nodes argument is missing.");

args.setNodeIds(consistentIds);
args.setCacheNames(cacheNames);

break;

case STATUS:
case CANCEL:
// No-op.
}
}

/** {@inheritDoc} */
@Override public DefragmentationArguments arg() {
return args;
}

/** {@inheritDoc} */
@Override public void printUsage(Logger log) {
String consistentIds = "consistentId0,consistentId1";

String cacheNames = "cache1,cache2,cache3";

usage(
log,
"Schedule PDS defragmentation on given nodes for all caches:",
DEFRAGMENTATION,
SCHEDULE.text(),
NODES_ARG,
consistentIds
);

usage(
log,
"Schedule PDS defragmentation on given nodes but only for given caches:",
DEFRAGMENTATION,
SCHEDULE.text(),
NODES_ARG,
consistentIds,
CACHES_ARG,
cacheNames
);

usage(
log,
"Cancel scheduled or active PDS defragmentation on underlying node:",
DEFRAGMENTATION,
CANCEL.text()
);
}

/** {@inheritDoc} */
@Override public String name() {
return DEFRAGMENTATION.toCommandName();
}

/** */
private VisorDefragmentationTaskArg convertArguments() {
return new VisorDefragmentationTaskArg(
convertSubcommand(args.subcommand()),
args.nodeIds(),
args.cacheNames()
);
}

/** */
private static VisorDefragmentationOperation convertSubcommand(DefragmentationSubcommands subcmd) {
switch (subcmd) {
case SCHEDULE:
return VisorDefragmentationOperation.SCHEDULE;

case STATUS:
return VisorDefragmentationOperation.STATUS;

case CANCEL:
return VisorDefragmentationOperation.CANCEL;

default:
throw new IllegalArgumentException(subcmd.name());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.commandline.defragmentation;

import java.util.List;

/** */
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
public class DefragmentationArguments {
/** */
private final DefragmentationSubcommands subcmd;

/** */
private List<String> nodeIds;

/** */
private List<String> cacheNames;

/** */
public DefragmentationArguments(DefragmentationSubcommands subcmd) {
this.subcmd = subcmd;
}

/** */
public DefragmentationSubcommands subcommand() {
return subcmd;
}

/** */
public void setNodeIds(List<String> nodeIds) {
this.nodeIds = nodeIds;
}

/** */
public List<String> nodeIds() {
return nodeIds;
}

/** */
public void setCacheNames(List<String> cacheNames) {
this.cacheNames = cacheNames;
}

/** */
public List<String> cacheNames() {
return cacheNames;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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.commandline.defragmentation;

import org.apache.ignite.internal.visor.defragmentation.VisorDefragmentationOperation;
import org.jetbrains.annotations.Nullable;

/** */
public enum DefragmentationSubcommands {
/** */
SCHEDULE("schedule", VisorDefragmentationOperation.SCHEDULE),

/** */
STATUS("status", VisorDefragmentationOperation.STATUS),

/** */
CANCEL("cancel", VisorDefragmentationOperation.CANCEL);

/** */
private final String name;

/** */
private final VisorDefragmentationOperation visorOperation;

/** */
DefragmentationSubcommands(String name, VisorDefragmentationOperation visorOperation) {
this.name = name;
this.visorOperation = visorOperation;
}

/**
* @param strRep String representation of subcommand.
* @return Subcommand for its string representation.
*/
public static @Nullable DefragmentationSubcommands of(String strRep) {
for (DefragmentationSubcommands cmd : values()) {
if (cmd.text().equalsIgnoreCase(strRep))
return cmd;
}

return null;
}

/** */
public String text() {
return name;
}

/** */
public VisorDefragmentationOperation operation() {
return visorOperation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ private boolean requireArgs(@Nullable CommandList cmd) {
cmd == CommandList.WARM_UP ||
cmd == CommandList.PROPERTY ||
cmd == CommandList.SYSTEM_VIEW ||
cmd == CommandList.METRIC;
cmd == CommandList.METRIC ||
cmd == CommandList.DEFRAGMENTATION;
}
}
Loading