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

CASSANDRA-19014 Resolved repair_admin summarize-pending command issue #2942

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public CompositeData toComposite()
Map<String, Object> values = new HashMap<>();
values.put(COMPOSITE_NAMES[0], keyspace);
values.put(COMPOSITE_NAMES[1], table);
values.put(COMPOSITE_NAMES[2], pending.toComposite());
values.put(COMPOSITE_NAMES[3], finalized.toComposite());
values.put(COMPOSITE_NAMES[4], failed.toComposite());
values.put(COMPOSITE_NAMES[2], total.toComposite());
values.put(COMPOSITE_NAMES[3], pending.toComposite());
values.put(COMPOSITE_NAMES[4], finalized.toComposite());
values.put(COMPOSITE_NAMES[5], failed.toComposite());
try
{
return new CompositeDataSupport(COMPOSITE_TYPE, values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,35 @@
import org.apache.cassandra.streaming.PreviewKind;
import org.apache.cassandra.utils.UUIDGen;

import static java.util.Arrays.stream;
import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
import static org.apache.cassandra.distributed.api.Feature.NETWORK;
import static org.apache.cassandra.repair.consistent.ConsistentSession.State.REPAIRING;
import static org.junit.Assert.assertTrue;

public class IncRepairAdminTest extends TestBaseImpl
{
@Test
public void testRepairAdminSummarizePending() throws IOException
{
try (Cluster cluster = init(Cluster.build(1)
.withConfig(config -> config.with(GOSSIP).with(NETWORK))
.start()))
{
// given a cluster with a table
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (k INT PRIMARY KEY, v INT)");
// when running repair_admin summarize-pending
NodeToolResult res = cluster.get(1).nodetoolResult("repair_admin", "summarize-pending");
// then the table info should be present in the output
res.asserts().success();
String outputLine = stream(res.getStdout().split("\n"))
.filter(l -> l.contains(KEYSPACE) && l.contains("tbl"))
.findFirst()
.orElseThrow(() -> new AssertionError("should find tbl table in output of repair_admin summarize-pending"));
assertTrue("should contain information about zero pending bytes", outputLine.contains("0 bytes (0 sstables / 0 sessions)"));
}
}

@Test
public void testManualSessionFail() throws IOException
{
Expand Down