-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IGNITE-15629 Cache contention command implemented (#10744)
- Loading branch information
Showing
12 changed files
with
175 additions
and
243 deletions.
There are no files selected for viewing
145 changes: 0 additions & 145 deletions
145
...l-utility/src/main/java/org/apache/ignite/internal/commandline/cache/CacheContention.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ore/src/main/java/org/apache/ignite/internal/management/cache/CacheContentionCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* 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.cache; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
import java.util.function.Consumer; | ||
import org.apache.ignite.internal.management.api.CommandUtils; | ||
import org.apache.ignite.internal.management.api.ComputeCommand; | ||
import org.apache.ignite.internal.processors.cache.verify.ContentionInfo; | ||
import org.apache.ignite.internal.util.typedef.T3; | ||
import org.apache.ignite.internal.visor.verify.VisorContentionTask; | ||
import org.apache.ignite.internal.visor.verify.VisorContentionTaskResult; | ||
|
||
/** */ | ||
public class CacheContentionCommand implements ComputeCommand<CacheContentionCommandArg, VisorContentionTaskResult> { | ||
/** {@inheritDoc} */ | ||
@Override public String description() { | ||
return "Show the keys that are point of contention for multiple transactions"; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Class<CacheContentionCommandArg> argClass() { | ||
return CacheContentionCommandArg.class; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Class<VisorContentionTask> taskClass() { | ||
return VisorContentionTask.class; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public Collection<UUID> nodes(Map<UUID, T3<Boolean, Object, Long>> nodes, CacheContentionCommandArg arg) { | ||
return arg.nodeId() == null ? nodes.keySet() : Collections.singleton(arg.nodeId()); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public void printResult(CacheContentionCommandArg arg, VisorContentionTaskResult res, Consumer<String> printer) { | ||
CommandUtils.printErrors(res.exceptions(), "Contention check failed on nodes:", printer); | ||
|
||
for (ContentionInfo info : res.getInfos()) | ||
info.print(); | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
.../src/main/java/org/apache/ignite/internal/management/cache/CacheContentionCommandArg.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* 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.cache; | ||
|
||
import java.io.IOException; | ||
import java.io.ObjectInput; | ||
import java.io.ObjectOutput; | ||
import java.util.UUID; | ||
import org.apache.ignite.internal.dto.IgniteDataTransferObject; | ||
import org.apache.ignite.internal.management.api.Argument; | ||
import org.apache.ignite.internal.management.api.Positional; | ||
import org.apache.ignite.internal.util.typedef.internal.U; | ||
|
||
/** */ | ||
public class CacheContentionCommandArg extends IgniteDataTransferObject { | ||
/** */ | ||
private static final long serialVersionUID = 0; | ||
|
||
/** Min queue size. */ | ||
@Positional | ||
@Argument(example = "minQueueSize") | ||
private int minQueueSize; | ||
|
||
/** Node id. */ | ||
@Positional | ||
@Argument(optional = true, example = "nodeId") | ||
private UUID nodeId; | ||
|
||
/** Max print. */ | ||
@Positional | ||
@Argument(optional = true, example = "maxPrint") | ||
private int maxPrint = 10; | ||
|
||
/** {@inheritDoc} */ | ||
@Override protected void writeExternalData(ObjectOutput out) throws IOException { | ||
U.writeUuid(out, nodeId); | ||
out.writeInt(minQueueSize); | ||
out.writeInt(maxPrint); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { | ||
nodeId = U.readUuid(in); | ||
minQueueSize = in.readInt(); | ||
maxPrint = in.readInt(); | ||
} | ||
|
||
/** */ | ||
public UUID nodeId() { | ||
return nodeId; | ||
} | ||
|
||
/** */ | ||
public void nodeId(UUID nodeId) { | ||
this.nodeId = nodeId; | ||
} | ||
|
||
/** */ | ||
public int minQueueSize() { | ||
return minQueueSize; | ||
} | ||
|
||
/** */ | ||
public void minQueueSize(int minQueueSize) { | ||
this.minQueueSize = minQueueSize; | ||
} | ||
|
||
/** */ | ||
public int maxPrint() { | ||
return maxPrint; | ||
} | ||
|
||
/** */ | ||
public void maxPrint(int maxPrint) { | ||
this.maxPrint = maxPrint; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.