From 40752973c4fec8b3eb7f4b5fcc8d71797676fc81 Mon Sep 17 00:00:00 2001 From: Anastasia Iakimova <94782753+Nastya828@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:13:02 +0300 Subject: [PATCH] IGNITE-20761 Added descriptions and values to the properties list command (#11027) (cherry picked from commit 57278867252bca4048eab50ff248178c56835f59) --- .../GridCommandHandlerPropertiesTest.java | 25 +++++++-- .../DistributedBaselineConfiguration.java | 7 ++- .../DistributedTransactionConfiguration.java | 30 ++++++++--- .../internal/cluster/IgniteClusterImpl.java | 4 ++ .../property/PropertiesListResult.java | 12 ++--- .../property/PropertiesListTask.java | 22 ++++---- .../property/PropertyListCommand.java | 32 ++++++++--- .../property/PropertyListCommandArg.java | 54 +++++++++++++++++++ .../GridCacheDatabaseSharedManager.java | 8 ++- .../snapshot/IgniteSnapshotManager.java | 4 +- .../wal/FileWriteAheadLogManager.java | 5 +- .../DistributedBooleanProperty.java | 9 ++-- .../DistributedComparableProperty.java | 4 +- .../DistributedDoubleProperty.java | 9 ++-- .../distributed/DistributedEnumProperty.java | 9 +++- .../DistributedIntegerProperty.java | 9 ++-- .../distributed/DistributedLongProperty.java | 9 ++-- .../distributed/DistributedProperty.java | 5 ++ .../DistributedThinClientConfiguration.java | 4 +- .../SimpleDistributedProperty.java | 12 ++++- .../processors/job/GridJobProcessor.java | 3 +- .../query/DistributedSqlConfiguration.java | 3 +- .../stat/IgniteStatisticsManagerImpl.java | 2 + .../DistributedTracingConfiguration.java | 3 +- .../DistributedConfigurationAbstractTest.java | 6 +-- ...istributedConfigurationPersistentTest.java | 20 +++---- ...mmandHandlerClusterByClassTest_help.output | 5 +- ...ndlerClusterByClassWithSSLTest_help.output | 5 +- .../h2/DistributedIndexingConfiguration.java | 6 ++- 29 files changed, 247 insertions(+), 79 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommandArg.java diff --git a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java index e331d3b934b60..c81733098d4fc 100644 --- a/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java +++ b/modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java @@ -71,7 +71,8 @@ public void testHelp() { assertContains(log, out, "control.(sh|bat) --property help"); assertContains(log, out, "Print list of available properties:"); - assertContains(log, out, "control.(sh|bat) --property list"); + assertContains(log, out, "control.(sh|bat) --property list [--info]"); + assertContains(log, out, "--info - Print detailed information: name, value, description."); assertContains(log, out, "Get the property value:"); assertContains(log, out, "control.(sh|bat) --property get --name "); @@ -80,6 +81,24 @@ public void testHelp() { assertContains(log, out, "control.(sh|bat) --property set --name --val "); } + /** + * Check the command ' --property list [--info]'. + * Steps: + */ + @Test + public void testListWithValues() { + assertEquals(EXIT_CODE_OK, execute("--property", "list", "--info")); + + String out = testOut.toString(); + + for (DistributedChangeableProperty pd : crd.context() + .distributedConfiguration().properties()) { + assertContains(log, out, pd.getName()); + assertContains(log, out, String.valueOf(pd.get())); + assertContains(log, out, pd.description()); + } + } + /** * Check the command '--property list'. * Steps: @@ -111,7 +130,7 @@ public void testGet() { } /** - * Check the set command fro property 'sql.disabledFunctions'. + * Check the set command for property 'sql.disabledFunctions'. * Steps: */ @Test @@ -177,7 +196,7 @@ public void testPropertyCheckpointDeviation() throws IgniteCheckedException { } /** - * Check the set command fro property 'sql.defaultQueryTimeout'. + * Check the set command for property 'sql.defaultQueryTimeout'. * Steps: */ @Test diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedBaselineConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedBaselineConfiguration.java index 855efe408ed82..4e0ca5ac4ff80 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedBaselineConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedBaselineConfiguration.java @@ -62,13 +62,16 @@ public class DistributedBaselineConfiguration { /** Value of manual baseline control or auto adjusting baseline. */ private final DistributedChangeableProperty baselineAutoAdjustEnabled = - detachedBooleanProperty("baselineAutoAdjustEnabled"); + detachedBooleanProperty("baselineAutoAdjustEnabled", "Value of manual baseline control or auto" + + " adjusting baseline. True - If cluster in auto-adjust. False - If cluster in manual."); /** * Value of time which we would wait before the actual topology change since last discovery event(node join/exit). */ private final DistributedChangeableProperty baselineAutoAdjustTimeout = - detachedLongProperty("baselineAutoAdjustTimeout"); + detachedLongProperty("baselineAutoAdjustTimeout", + "Number of milliseconds to wait before the actual topology change since last server topology " + + "change(node join/left/fail)."); /** * @param isp Subscription processor. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedTransactionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedTransactionConfiguration.java index ae51691cd6eda..d17205834dd6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedTransactionConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/DistributedTransactionConfiguration.java @@ -83,24 +83,34 @@ public class DistributedTransactionConfiguration { * owner thread. */ private final DistributedChangeableProperty txOwnerDumpRequestsAllowed = - detachedBooleanProperty("txOwnerDumpRequestsAllowed"); + detachedBooleanProperty("txOwnerDumpRequestsAllowed", + "Shows if dump requests from local node to near node are allowed, when " + + "long running transaction is found. If allowed, the compute request to near node will be made to get" + + " thread dump of transaction owner thread."); /** Long operations dump timeout. */ private final DistributedChangeableProperty longOperationsDumpTimeout = - detachedLongProperty("longOperationsDumpTimeout"); + detachedLongProperty("longOperationsDumpTimeout", "Cache operations that take more time than value " + + "of this property in milliseconds will be output to log. Set to 0 to disable."); /** * Threshold timeout for long transactions, if transaction exceeds it, it will be dumped in log with * information about how much time did it spent in system time (time while aquiring locks, preparing, * commiting, etc) and user time (time when client node runs some code while holding transaction and not - * waiting it). Equals 0 if not set. No transactions are dumped in log if this parameter is not set. + * waiting it). Equals 0 if not set. */ private final DistributedChangeableProperty longTransactionTimeDumpThreshold = - detachedLongProperty("longTransactionTimeDumpThreshold"); + detachedLongProperty("longTransactionTimeDumpThreshold", + "Threshold timeout for long transactions, if transaction exceeds it, it will be dumped in log with " + + "information about how much time did it spent in system time (time while acquiring " + + "locks, preparing, committing, etc) and user time (time when client node runs some code while holding " + + "transaction and not waiting it). Equals 0 if not set."); /** The coefficient for samples of completed transactions that will be dumped in log. */ private final DistributedChangeableProperty transactionTimeDumpSamplesCoefficient = - detachedDoubleProperty("transactionTimeDumpSamplesCoefficient"); + detachedDoubleProperty("transactionTimeDumpSamplesCoefficient", + "The coefficient for samples of completed transactions that will be dumped " + + "in log. Must be float value between 0.0 and 1.0 inclusive."); /** * The limit of samples of completed transactions that will be dumped in log per second, if @@ -108,11 +118,17 @@ public class DistributedTransactionConfiguration { * greater than 0. */ private final DistributedChangeableProperty longTransactionTimeDumpSamplesPerSecondLimit = - detachedIntegerProperty("longTransactionTimeDumpSamplesPerSecondLimit"); + detachedIntegerProperty("longTransactionTimeDumpSamplesPerSecondLimit", + "The limit of samples of completed transactions that will be dumped in log per second, if " + + IGNITE_TRANSACTION_TIME_DUMP_SAMPLES_COEFFICIENT + " is above 0.0. Must be integer value " + + "greater than 0."); /** Collisions dump interval. */ private final DistributedChangeableProperty collisionsDumpInterval = - detachedIntegerProperty("collisionsDumpInterval"); + detachedIntegerProperty("collisionsDumpInterval", + "When above zero, prints tx key collisions once per interval. Each transaction besides " + + "OPTIMISTIC SERIALIZABLE capture locks on all enlisted keys, for some reasons per key lock queue may rise. " + + "This property sets the interval in milliseconds during which statistics are collected."); /** * @param ctx Kernal context. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java index f2cf3d298ca15..b64762891df78 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java @@ -119,6 +119,10 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus /** Property for update policy of shutdown. */ private DistributedEnumProperty shutdown = new DistributedEnumProperty<>( "shutdown.policy", + "Policy of shutdown. The policy specifies data safety guarantees on ordinary shutdown" + + " of one or more cluster nodes. IMMEDIATE - Stop immediately as soon as all components are ready." + + " GRACEFUL - Node will stop if and only if it does not store any unique partitions, that don't have " + + "another copies in the cluster.", (ordinal) -> ordinal == null ? null : ShutdownPolicy.fromOrdinal(ordinal), (policy) -> policy == null ? null : policy.index(), ShutdownPolicy.class diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListResult.java b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListResult.java index a14587a00e069..cec86e64bd331 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListResult.java @@ -21,9 +21,9 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Collection; -import java.util.Collections; import org.apache.ignite.internal.dto.IgniteDataTransferObject; import org.apache.ignite.internal.processors.task.GridInternal; +import org.apache.ignite.internal.util.typedef.T3; import org.apache.ignite.internal.util.typedef.internal.U; /** @@ -34,8 +34,8 @@ public class PropertiesListResult extends IgniteDataTransferObject { /** */ private static final long serialVersionUID = 0L; - /** Properties names. */ - private Collection props = Collections.emptyList(); + /** Properties info: name, value, description. */ + private Collection> props; /** * Constructor for optimized marshaller. @@ -47,7 +47,7 @@ public PropertiesListResult() { /** * @param props Properties. */ - public PropertiesListResult(Collection props) { + public PropertiesListResult(Collection> props) { this.props = props; } @@ -65,9 +65,9 @@ public PropertiesListResult(Collection props) { } /** - * @return Properties (name, description) collection. + * @return Properties (name, value, description) collection. */ - public Collection properties() { + public Collection> properties() { return props; } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListTask.java b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListTask.java index f2c3cbc9a9239..2d295b1d023c3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertiesListTask.java @@ -17,16 +17,19 @@ package org.apache.ignite.internal.management.property; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; import org.apache.ignite.IgniteException; import org.apache.ignite.compute.ComputeJobResult; -import org.apache.ignite.internal.management.api.NoArg; import org.apache.ignite.internal.processors.task.GridInternal; +import org.apache.ignite.internal.util.lang.GridTuple3; +import org.apache.ignite.internal.util.typedef.T3; import org.apache.ignite.internal.visor.VisorJob; import org.apache.ignite.internal.visor.VisorMultiNodeTask; import org.apache.ignite.plugin.security.SecurityPermissionSet; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.plugin.security.SecurityPermission.ADMIN_READ_DISTRIBUTED_PROPERTY; import static org.apache.ignite.plugin.security.SecurityPermissionSetBuilder.systemPermissions; @@ -34,13 +37,13 @@ * Task for property operations. */ @GridInternal -public class PropertiesListTask extends VisorMultiNodeTask { +public class PropertiesListTask extends VisorMultiNodeTask { /** */ private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override protected VisorJob job(NoArg arg) { - return new PropertiesListJob(debug); + @Override protected VisorJob job(PropertyListCommandArg arg) { + return new PropertiesListJob(arg, debug); } /** {@inheritDoc} */ @@ -60,15 +63,15 @@ public class PropertiesListTask extends VisorMultiNodeTask { + private static class PropertiesListJob extends VisorJob { /** */ private static final long serialVersionUID = 0L; /** * @param debug Debug. */ - protected PropertiesListJob(boolean debug) { - super(null, debug); + protected PropertiesListJob(PropertyListCommandArg arg, boolean debug) { + super(arg, debug); } /** {@inheritDoc} */ @@ -77,10 +80,11 @@ protected PropertiesListJob(boolean debug) { } /** {@inheritDoc} */ - @Override protected PropertiesListResult run(@Nullable NoArg arg) { + @Override protected PropertiesListResult run(@Nullable PropertyListCommandArg arg) { return new PropertiesListResult( ignite.context().distributedConfiguration().properties().stream() - .map(pd -> pd.getName()) + .map(p -> new T3<>(p.getName(), String.valueOf(p.get()), p.description())) + .sorted(Comparator.comparing(GridTuple3::get1)) .collect(Collectors.toList()) ); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommand.java index f7a8549702028..14da943e2f6a7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommand.java @@ -17,20 +17,25 @@ package org.apache.ignite.internal.management.property; +import java.util.List; import java.util.function.Consumer; +import java.util.stream.Collectors; +import org.apache.ignite.internal.management.SystemViewCommand; +import org.apache.ignite.internal.management.SystemViewTask; import org.apache.ignite.internal.management.api.ComputeCommand; -import org.apache.ignite.internal.management.api.NoArg; +import org.apache.ignite.internal.util.lang.GridTuple3; +import org.apache.ignite.internal.util.typedef.F; /** */ -public class PropertyListCommand implements ComputeCommand { +public class PropertyListCommand implements ComputeCommand { /** {@inheritDoc} */ @Override public String description() { return "Print list of available properties"; } /** {@inheritDoc} */ - @Override public Class argClass() { - return NoArg.class; + @Override public Class argClass() { + return PropertyListCommandArg.class; } /** {@inheritDoc} */ @@ -39,8 +44,21 @@ public class PropertyListCommand implements ComputeCommand printer) { - for (String prop : res.properties()) - printer.accept(prop); + @Override public void printResult(PropertyListCommandArg arg, PropertiesListResult res, Consumer printer) { + if (arg.info()) { + List types = F.asList("Name", "Value", "Description").stream() + .map(x -> SystemViewTask.SimpleType.STRING).collect(Collectors.toList()); + + List> data = res.properties().stream() + .map(p -> F.asList(p.get1(), p.get2(), p.get3())) + .collect(Collectors.toList()); + + SystemViewCommand.printTable(F.asList("Name", "Value", "Description"), types, data, printer); + } + else { + res.properties().stream() + .map(GridTuple3::get1) + .forEach(printer); + } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommandArg.java b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommandArg.java new file mode 100644 index 0000000000000..a5b15fb11ae48 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/property/PropertyListCommandArg.java @@ -0,0 +1,54 @@ +/* + * 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.management.property; + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import org.apache.ignite.internal.dto.IgniteDataTransferObject; +import org.apache.ignite.internal.management.api.Argument; + +/** */ +public class PropertyListCommandArg extends IgniteDataTransferObject { + /** */ + private static final long serialVersionUID = 0; + + /** */ + @Argument(optional = true, description = "Print detailed information: name, value, description") + private boolean info; + + /** {@inheritDoc} */ + @Override protected void writeExternalData(ObjectOutput out) throws IOException { + out.writeBoolean(info); + } + + /** {@inheritDoc} */ + @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { + info = in.readBoolean(); + } + + /** */ + public boolean info() { + return info; + } + + /** */ + public void info(boolean info) { + this.info = info; + } +} diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java index 6cd08378b248c..b6e35b706e759 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java @@ -360,7 +360,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan /** WAL rebalance threshold. */ private final SimpleDistributedProperty historicalRebalanceThreshold = - new SimpleDistributedProperty<>(HISTORICAL_REBALANCE_THRESHOLD_DMS_KEY, Integer::parseInt); + new SimpleDistributedProperty<>(HISTORICAL_REBALANCE_THRESHOLD_DMS_KEY, Integer::parseInt, + "WAL rebalance threshold. Threshold value to use history or full rebalance for local partition."); /** */ private GridKernalContext ctx; @@ -539,7 +540,10 @@ private DataRegionConfiguration createDefragmentationMappingRegionConfig(long re if (!kernalCtx.clientNode()) { kernalCtx.internalSubscriptionProcessor().registerDatabaseListener(new MetastorageRecoveryLifecycle()); - cpFreqDeviation = new SimpleDistributedProperty<>("checkpoint.deviation", Integer::parseInt); + cpFreqDeviation = new SimpleDistributedProperty<>("checkpoint.deviation", Integer::parseInt, + "Checkpoint frequency deviation from the configured frequency in percentage. " + + "Gets a checkpoint interval with a randomized delay. It helps when the cluster makes a checkpoint " + + "in the same time in every node."); kernalCtx.internalSubscriptionProcessor().registerDistributedConfigurationListener(dispatcher -> { cpFreqDeviation.addListener((name, oldVal, newVal) -> diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java index 7e0dac69069cd..18e905635c27e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java @@ -465,7 +465,9 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter private volatile @Nullable IncrementalSnapshotMarkWalFuture markWalFut; /** Snapshot transfer rate limit in bytes/sec. */ - private final DistributedLongProperty snapshotTransferRate = detachedLongProperty(SNAPSHOT_TRANSFER_RATE_DMS_KEY); + private final DistributedLongProperty snapshotTransferRate = detachedLongProperty(SNAPSHOT_TRANSFER_RATE_DMS_KEY, + "Snapshot transfer rate in bytes per second at which snapshot files are created. " + + "0 means there is no limit."); /** Value of {@link IgniteSystemProperties#IGNITE_SNAPSHOT_SEQUENTIAL_WRITE}. */ private final boolean sequentialWrite = diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java index c1f04bd3baab7..2a0eb000909a7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java @@ -418,7 +418,10 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl private volatile WALPointer lastCheckpointPtr = new WALPointer(0, 0, 0); /** CDC disabled flag. */ - private final DistributedBooleanProperty cdcDisabled = detachedBooleanProperty(CDC_DISABLED); + private final DistributedBooleanProperty cdcDisabled = detachedBooleanProperty(CDC_DISABLED, + "CDC disabled flag. Disables CDC in the cluster to avoid disk overflow. " + + "Note that cache changes will be lost when CDC is disabled. Useful if the CDC application " + + "is down for a long time."); /** * Constructor. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedBooleanProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedBooleanProperty.java index 934a32ae8a9dd..5218c54ac00f4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedBooleanProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedBooleanProperty.java @@ -22,15 +22,16 @@ */ public class DistributedBooleanProperty extends SimpleDistributedProperty { /** {@inheritDoc} */ - DistributedBooleanProperty(String name) { - super(name, Boolean::parseBoolean); + DistributedBooleanProperty(String name, String desc) { + super(name, Boolean::parseBoolean, desc); } /** * @param name Name of property. + * @param desc Description of property. * @return Property detached from processor.(Distributed updating are not accessable). */ - public static DistributedBooleanProperty detachedBooleanProperty(String name) { - return new DistributedBooleanProperty(name); + public static DistributedBooleanProperty detachedBooleanProperty(String name, String desc) { + return new DistributedBooleanProperty(name, desc); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedComparableProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedComparableProperty.java index 7ec38a3a95d97..2bca155eb83f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedComparableProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedComparableProperty.java @@ -26,8 +26,8 @@ */ public class DistributedComparableProperty & Serializable> extends SimpleDistributedProperty { /** {@inheritDoc} */ - DistributedComparableProperty(String name, Function parser) { - super(name, parser); + DistributedComparableProperty(String name, Function parser, String desc) { + super(name, parser, desc); } /** */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedDoubleProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedDoubleProperty.java index b6278f19bbe10..05c7df0a4b151 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedDoubleProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedDoubleProperty.java @@ -22,15 +22,16 @@ */ public class DistributedDoubleProperty extends DistributedComparableProperty { /** {@inheritDoc} */ - DistributedDoubleProperty(String name) { - super(name, Double::parseDouble); + DistributedDoubleProperty(String name, String desc) { + super(name, Double::parseDouble, desc); } /** * @param name Name of property. + * @param desc Description of property. * @return Property detached from processor.(Distributed updating are not accessable). */ - public static DistributedDoubleProperty detachedDoubleProperty(String name) { - return new DistributedDoubleProperty(name); + public static DistributedDoubleProperty detachedDoubleProperty(String name, String desc) { + return new DistributedDoubleProperty(name, desc); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java index 763255432643b..2356877dd506b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java @@ -50,16 +50,18 @@ public class DistributedEnumProperty implements DistributedChang * Property constructor. * * @param name Name of property. + * @param desc Property description. * @param fromOrdinalFunc Function reflects an integer to an enumiration value. * @param toOrdinalFunc Function converts an enumeration value to an integer. */ public DistributedEnumProperty( String name, + String desc, IgniteClosure fromOrdinalFunc, IgniteClosure toOrdinalFunc, Class enumCls ) { - this.internal = new SimpleDistributedProperty<>(name, null); + this.internal = new SimpleDistributedProperty<>(name, null, desc); this.fromOrdinalFunc = fromOrdinalFunc; this.toOrdinalFunc = toOrdinalFunc; this.values = Arrays.stream(enumCls.getEnumConstants()) @@ -118,6 +120,11 @@ else if (newVal instanceof Integer) return internal.getName(); } + /** {@inheritDoc} */ + @Override public String description() { + return internal.description(); + } + /** {@inheritDoc} */ @Override public void addListener(DistributePropertyListener listener) { internal.addListener(new DistributePropertyListener() { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedIntegerProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedIntegerProperty.java index 5e7b5033d520e..23160a5310010 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedIntegerProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedIntegerProperty.java @@ -22,15 +22,16 @@ */ public class DistributedIntegerProperty extends DistributedComparableProperty { /** {@inheritDoc} */ - DistributedIntegerProperty(String name) { - super(name, Integer::parseInt); + DistributedIntegerProperty(String name, String desc) { + super(name, Integer::parseInt, desc); } /** * @param name Name of property. + * @param desc Description of property. * @return Property detached from processor.(Distributed updating are not accessable). */ - public static DistributedIntegerProperty detachedIntegerProperty(String name) { - return new DistributedIntegerProperty(name); + public static DistributedIntegerProperty detachedIntegerProperty(String name, String desc) { + return new DistributedIntegerProperty(name, desc); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedLongProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedLongProperty.java index fbfd316babb98..f1f55e9dc9ab1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedLongProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedLongProperty.java @@ -22,15 +22,16 @@ */ public class DistributedLongProperty extends DistributedComparableProperty { /** {@inheritDoc} */ - DistributedLongProperty(String name) { - super(name, Long::parseLong); + DistributedLongProperty(String name, String desc) { + super(name, Long::parseLong, desc); } /** * @param name Name of property. + * @param desc Description of property. * @return Property detached from processor.(Distributed updating are not accessable). */ - public static DistributedLongProperty detachedLongProperty(String name) { - return new DistributedLongProperty(name); + public static DistributedLongProperty detachedLongProperty(String name, String desc) { + return new DistributedLongProperty(name, desc); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedProperty.java index b47062c358ca2..e4c01571c85c0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedProperty.java @@ -82,6 +82,11 @@ public interface DistributedProperty { */ String getName(); + /** + * @return Property description. + */ + String description(); + /** * @param listener Update listener. */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedThinClientConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedThinClientConfiguration.java index ff41dca967cad..549844f85fced 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedThinClientConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedThinClientConfiguration.java @@ -36,7 +36,9 @@ public class DistributedThinClientConfiguration { /** . */ private final DistributedChangeableProperty showStackTrace = - detachedBooleanProperty("thinClientProperty.showStackTrace"); + detachedBooleanProperty("thinClientProperty.showStackTrace", + "If true, thin client response will include full stack trace when exception occurs." + + " When false, only top level exception message is included."); /** Message of baseline auto-adjust parameter was changed. */ private static final String PROPERTY_UPDATE_MESSAGE = diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/SimpleDistributedProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/SimpleDistributedProperty.java index 5753d307477fb..e45154ea36acc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/SimpleDistributedProperty.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/SimpleDistributedProperty.java @@ -36,6 +36,9 @@ public class SimpleDistributedProperty implements Distri /** Name of property. */ private final String name; + /** Description of property. */ + private final String description; + /** Property value. */ protected volatile T val; @@ -59,10 +62,12 @@ public class SimpleDistributedProperty implements Distri /** * @param name Name of property. * @param parser Property value parser. + * @param description Description of property. */ - public SimpleDistributedProperty(String name, Function parser) { + public SimpleDistributedProperty(String name, Function parser, String description) { this.name = name; this.parser = parser; + this.description = description; } /** {@inheritDoc} */ @@ -117,6 +122,11 @@ private void ensureClusterWideUpdateIsReady() throws DetachedPropertyException, return name; } + /** {@inheritDoc} */ + @Override public String description() { + return description; + } + /** {@inheritDoc} */ @Override public void addListener(DistributePropertyListener listener) { updateListeners.add(listener); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java index 6f7ef6b5772a8..75708954230e1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java @@ -322,7 +322,8 @@ public class GridJobProcessor extends GridProcessorAdapter { /** Timeout interrupt {@link GridJobWorker workers} after {@link GridJobWorker#cancel cancel} im mills. */ private final DistributedLongProperty computeJobWorkerInterruptTimeout = - detachedLongProperty(COMPUTE_JOB_WORKER_INTERRUPT_TIMEOUT); + detachedLongProperty(COMPUTE_JOB_WORKER_INTERRUPT_TIMEOUT, + "The timeout in milliseconds for interrupting the a job worker after a cancel operation is called."); /** * @param ctx Kernal context. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DistributedSqlConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DistributedSqlConfiguration.java index da2f9b857e292..050c9686960af 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DistributedSqlConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DistributedSqlConfiguration.java @@ -69,7 +69,8 @@ protected DistributedSqlConfiguration( dfltQryTimeout = new SimpleDistributedProperty<>( QUERY_TIMEOUT_PROPERTY_NAME, - SimpleDistributedProperty::parseNonNegativeInteger + SimpleDistributedProperty::parseNonNegativeInteger, + "Timeout in milliseconds for default query timeout. 0 means there is no timeout." ); dfltQryTimeout.addListener(makeUpdateListener(PROPERTY_UPDATE_MESSAGE, log)); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java index c49b25896d1d4..66f5af303b865 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java @@ -98,6 +98,8 @@ public class IgniteStatisticsManagerImpl implements IgniteStatisticsManager { /** Cluster wide statistics usage state. */ private final DistributedEnumProperty usageState = new DistributedEnumProperty<>( "statistics.usage.state", + "Statistics usage state. OFF - No statistics used, NO_UPDATE - Statistics used 'as is' without updates, " + + "ON - Statistics used and updated after each changes.", StatisticsUsageState::fromOrdinal, StatisticsUsageState::index, StatisticsUsageState.class); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/tracing/configuration/DistributedTracingConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/tracing/configuration/DistributedTracingConfiguration.java index 690d1455ae611..7a5fb959cb095 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/tracing/configuration/DistributedTracingConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/tracing/configuration/DistributedTracingConfiguration.java @@ -37,7 +37,8 @@ public class DistributedTracingConfiguration * Constructor. */ public DistributedTracingConfiguration() { - super(TRACING_CONFIGURATION_DISTRIBUTED_METASTORE_KEY, null); + super(TRACING_CONFIGURATION_DISTRIBUTED_METASTORE_KEY, null, + "The tracing configuration. Please use the '--tracing-configuration' command to modify."); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationAbstractTest.java index 3b793b7987282..63aa727b2d698 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationAbstractTest.java @@ -85,7 +85,7 @@ public void testRegisterExistedProperty() throws Exception { ignite0.cluster().state(ClusterState.ACTIVE); - DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); long0.propagate(0L); @@ -93,7 +93,7 @@ public void testRegisterExistedProperty() throws Exception { assertTrue(long0.propagate(2L)); - DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP, "")); //Already changed to 2. assertEquals(2, long1.get().longValue()); @@ -104,7 +104,7 @@ public void testRegisterExistedProperty() throws Exception { */ @Test(expected = DetachedPropertyException.class) public void testNotAttachedProperty() throws Exception { - DistributedLongProperty long0 = detachedLongProperty(TEST_PROP); + DistributedLongProperty long0 = detachedLongProperty(TEST_PROP, ""); long0.propagate(1L); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationPersistentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationPersistentTest.java index 5b5ea46db5f0e..d28d1ec415691 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationPersistentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedConfigurationPersistentTest.java @@ -42,8 +42,8 @@ public void testSuccessClusterWideUpdate() throws Exception { ignite0.cluster().state(ClusterState.ACTIVE); - DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); - DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); + DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP, "")); long0.propagate(0L); @@ -63,8 +63,8 @@ public void testSuccessClusterWideUpdate() throws Exception { ignite0.cluster().state(ClusterState.ACTIVE); - long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); - long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP)); + long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); + long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP, "")); assertEquals(2, long0.get().longValue()); assertEquals(2, long1.get().longValue()); @@ -82,7 +82,7 @@ public void testReadLocalValueOnInactiveGrid() throws Exception { ignite0.cluster().state(ClusterState.ACTIVE); - DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); long0.propagate(0L); @@ -94,7 +94,7 @@ public void testReadLocalValueOnInactiveGrid() throws Exception { ignite0 = startGrid(0); - long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); + long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); assertEquals(2, long0.get().longValue()); } @@ -108,7 +108,7 @@ public void testPropagateValueOnInactiveGridShouldNotThrowException() throws Exc IgniteEx ignite0 = (IgniteEx)startGrids(2); - DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); long0.propagate(2L); } @@ -125,7 +125,7 @@ public void testRegisterPropertyBeforeOnReadyForReadHappened() throws Exception ignite0.cluster().state(ClusterState.ACTIVE); - DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long0 = distr(ignite0).registerProperty(detachedLongProperty(TEST_PROP, "")); long0.propagate(0L); @@ -139,14 +139,14 @@ public void testRegisterPropertyBeforeOnReadyForReadHappened() throws Exception TestDistibutedConfigurationPlugin.supplier = (ctx) -> { if (holder.get() == null) - holder.set(ctx.distributedConfiguration().registerProperty(detachedLongProperty(TEST_PROP))); + holder.set(ctx.distributedConfiguration().registerProperty(detachedLongProperty(TEST_PROP, ""))); }; ignite0 = startGrid(0); ignite1 = startGrid(1); long0 = holder.get(); - DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP)); + DistributedProperty long1 = distr(ignite1).registerProperty(detachedLongProperty(TEST_PROP, "")); //After start it should read from local storage. assertEquals(2, long0.get().longValue()); diff --git a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output index b58c36e67e7e1..6be8a41e0e9bc 100644 --- a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output +++ b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output @@ -339,7 +339,10 @@ If the file name isn't specified the output file name is: '.bin': control.(sh|bat) --property help Print list of available properties: - control.(sh|bat) --property list + control.(sh|bat) --property list [--info] + + Parameters: + --info - Print detailed information: name, value, description. Get the property value: control.(sh|bat) --property get --name diff --git a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output index b58c36e67e7e1..15ea52c27ceff 100644 --- a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output +++ b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output @@ -339,7 +339,10 @@ If the file name isn't specified the output file name is: '.bin': control.(sh|bat) --property help Print list of available properties: - control.(sh|bat) --property list + control.(sh|bat) --property list [--info] + + Parameters: + --info - Print detailed information: name, value, description. Get the property value: control.(sh|bat) --property get --name diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DistributedIndexingConfiguration.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DistributedIndexingConfiguration.java index 45c3f51cd97ab..1b51ca947be14 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DistributedIndexingConfiguration.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DistributedIndexingConfiguration.java @@ -57,7 +57,8 @@ public class DistributedIndexingConfiguration extends DistributedSqlConfiguratio /** Disabled SQL functions. */ private final SimpleDistributedProperty> disabledSqlFuncs = new SimpleDistributedProperty<>( "sql.disabledFunctions", - SimpleDistributedProperty::parseStringSet + SimpleDistributedProperty::parseStringSet, + "List of disabled SQL functions. Specify comma-separated functions to set a value." ); /** @@ -65,7 +66,8 @@ public class DistributedIndexingConfiguration extends DistributedSqlConfiguratio * See: 'H2TableDescriptor#luceneIdx'. */ private final DistributedBooleanProperty disableCreateLuceneIndexForStringValueType = - DistributedBooleanProperty.detachedBooleanProperty("sql.disableCreateLuceneIndexForStringValueType"); + DistributedBooleanProperty.detachedBooleanProperty("sql.disableCreateLuceneIndexForStringValueType", + "Flag to disable creation Lucene index for String value type by default."); /** * @param ctx Kernal context