This is an automated email from the ASF dual-hosted git repository.

bbotella pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e9452980d1 Nodetool profile start rejects a comma-separated list of 
events
e9452980d1 is described below

commit e9452980d11eb6fee0b0e0e3684f87d52c91aff3
Author: Arvind Kandpal <[email protected]>
AuthorDate: Tue Oct 27 12:21:09 2026 +0530

    Nodetool profile start rejects a comma-separated list of events
    
    patch by Arvind Kandpal; reviewed by Bernardo Botella, Štefan Miklošovič 
for CASSANDRA-21816
---
 .../tools/nodetool/AsyncProfileCommandGroup.java   |  2 +-
 .../nodetool/AsyncProfileCommandGroupTest.java     | 51 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git 
a/src/java/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroup.java 
b/src/java/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroup.java
index 091069c44c..ce1d3504fa 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroup.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroup.java
@@ -106,7 +106,7 @@ public class AsyncProfileCommandGroup extends 
AbstractCommand
     @Command(name = "start", description = "Run Async-Profiler on a Cassandra 
process")
     public static class AsyncProfileStartCommand extends AbstractCommand
     {
-        @Option(names = { "-e", "--event" },
+        @Option(names = { "-e", "--event" }, split = ",",
         description = "Event(s) to profile, one of or combination of 'cpu', 
'alloc', " +
                       "'lock', 'wall', 'nativemem', 'cache_misses', delimited 
by comma, defaults to 'cpu'")
         public List<AsyncProfilerEvent> event = 
List.of(AsyncProfilerEvent.cpu);
diff --git 
a/test/unit/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroupTest.java
 
b/test/unit/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroupTest.java
new file mode 100644
index 0000000000..a71c68acd7
--- /dev/null
+++ 
b/test/unit/org/apache/cassandra/tools/nodetool/AsyncProfileCommandGroupTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.cassandra.tools.nodetool;
+
+import org.junit.Test;
+
+import 
org.apache.cassandra.tools.nodetool.AsyncProfileCommandGroup.AsyncProfileStartCommand;
+
+import picocli.CommandLine;
+
+import static 
org.apache.cassandra.service.AsyncProfilerService.AsyncProfilerEvent.alloc;
+import static 
org.apache.cassandra.service.AsyncProfilerService.AsyncProfilerEvent.cpu;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class AsyncProfileCommandGroupTest
+{
+    @Test
+    public void testEventsSeparatedByComma()
+    {
+        assertThat(parseStart("-e", "cpu,alloc").event).containsExactly(cpu, 
alloc);
+    }
+
+    @Test
+    public void testEventOptionRepeated()
+    {
+        assertThat(parseStart("-e", "cpu", "-e", 
"alloc").event).containsExactly(cpu, alloc);
+    }
+
+    private static AsyncProfileStartCommand parseStart(String... args)
+    {
+        AsyncProfileStartCommand command = new AsyncProfileStartCommand();
+        new CommandLine(command).parseArgs(args);
+        return command;
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to