Copilot commented on code in PR #8062: URL: https://github.com/apache/incubator-seata/pull/8062#discussion_r3114815707
########## test-suite/seata-benchmark-cli/README.md: ########## @@ -100,6 +100,14 @@ java -jar seata-benchmark-cli.jar \ --duration 60 \ --branches 3 +# TCC mode with real try/confirm/cancel +java -jar seata-benchmark-cli.jar \ + --server 127.0.0.1:8091 \ + --mode TCC \ + --tps 100 \ + --duration 60 \ + --branches 3 Review Comment: This runnable example omits `--threads 1`. With the current config validation (`BenchmarkConfig.validateTpsAndThreads`), `--tps 100` cannot be combined with the default `--threads 10`, so this command will fail unless `--threads 1` is specified (or `--tps` is raised to the unlimited threshold). ########## test-suite/seata-benchmark-cli/src/main/java/org/apache/seata/benchmark/tcc/BenchmarkTccAction.java: ########## @@ -0,0 +1,43 @@ +/* + * 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.seata.benchmark.tcc; + +import org.apache.seata.rm.tcc.api.BusinessActionContext; +import org.apache.seata.rm.tcc.api.LocalTCC; +import org.apache.seata.rm.tcc.api.TwoPhaseBusinessAction; + +/** + * Benchmark TCC action interface. + * + * <p>Used by {@link org.apache.seata.benchmark.executor.TCCModeExecutor} in real mode + * ({@code branches > 0}) to drive the TCC protocol path through the Seata interceptor. + * Each call to {@link #prepare} registers one TCC branch with the TC. On global commit + * the TC invokes {@link #commit}; on global rollback it invokes {@link #rollback}. + * + * <p>All three methods are intentionally no-ops so the benchmark measures only Seata + * protocol overhead, not business logic. + */ +@LocalTCC +public interface BenchmarkTccAction { + + @TwoPhaseBusinessAction(name = "benchmarkTccAction", commitMethod = "commit", rollbackMethod = "rollback") Review Comment: `@TwoPhaseBusinessAction(name = "benchmarkTccAction", ...)` uses a very generic, constant action name. Since TCC resource IDs must be unique within a JVM (see `TCCResourceManager.registerResource` throwing `RepeatRegistrationException` on duplicates), this can collide if the benchmark CLI is embedded/run alongside other TCC participants or multiple benchmark runs in the same JVM. Consider namespacing the action name (e.g., prefix with `seata-benchmark-cli-` or similar) to reduce collision risk. ```suggestion String ACTION_NAME = "seata-benchmark-cli-benchmarkTccAction"; @TwoPhaseBusinessAction(name = ACTION_NAME, commitMethod = "commit", rollbackMethod = "rollback") ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
