Merge branch 'cassandra-4.0' into cassandra-4.1

This commit is contained in:
Stefan Miklosovic 2023-11-29 18:33:39 +01:00
commit df64a5aa0d
No known key found for this signature in database
GPG Key ID: 32F35CB2F546D93E
3 changed files with 27 additions and 3 deletions

View File

@ -6,6 +6,7 @@
* Allow empty keystore_password in encryption_options (CASSANDRA-18778)
* Skip ColumnFamilyStore#topPartitions initialization when client or tool mode (CASSANDRA-18697)
Merged from 4.0:
* Fix nodetool repair_admin summarize-pending command to not throw exception (CASSANDRA-19014)
* Fix cassandra-stress in simplenative mode with prepared statements (CASSANDRA-18744)
* Fix filtering system ks sstables for relocation on startup (CASSANDRA-18963)
* Remove completed coordinator sessions (CASSANDRA-18903)

View File

@ -78,9 +78,10 @@ public class PendingStats
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);

View File

@ -42,6 +42,7 @@ import org.apache.cassandra.service.ActiveRepairService;
import org.apache.cassandra.streaming.PreviewKind;
import org.apache.cassandra.utils.TimeUUID;
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;
@ -51,6 +52,27 @@ 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
{