@@ -25,7 +25,6 @@ import kafka.network.SocketServer
25
25
import kafka .raft .{DefaultExternalKRaftMetrics , KafkaRaftManager , RaftManager }
26
26
import kafka .server .{KafkaConfig , KafkaRequestHandlerPool }
27
27
import kafka .utils .{CoreUtils , Logging }
28
- import org .apache .kafka .common .errors .InvalidConfigurationException
29
28
import org .apache .kafka .common .message .ApiMessageType .ListenerType
30
29
import org .apache .kafka .common .metrics .Metrics
31
30
import org .apache .kafka .common .metrics .stats .Percentiles .BucketSizing
@@ -115,8 +114,8 @@ class TestRaftServer(
115
114
workloadGenerator = new RaftWorkloadGenerator (
116
115
raftManager,
117
116
time,
118
- recordsPerSec = 20000 ,
119
- recordSize = 256
117
+ recordsPerSec = throughput ,
118
+ recordSize = recordSize
120
119
)
121
120
122
121
val requestHandler = new TestRaftRequestHandler (
@@ -428,7 +427,7 @@ object TestRaftServer extends Logging {
428
427
}
429
428
430
429
private class TestRaftServerOptions (args : Array [String ]) extends CommandDefaultOptions (args) {
431
- val configOpt : OptionSpec [String ] = parser.accepts(" config" , " Required configured file" )
430
+ val configOpt : OptionSpec [String ] = parser.accepts(" config" , " REQUIRED: The configured file" )
432
431
.withRequiredArg
433
432
.describedAs(" filename" )
434
433
.ofType(classOf [String ])
@@ -446,29 +445,26 @@ object TestRaftServer extends Logging {
446
445
.ofType(classOf [Int ])
447
446
.defaultsTo(256 )
448
447
449
- val directoryId : OptionSpec [String ] = parser.accepts(" replica-directory-id" , " The directory id of the replica" )
448
+ val directoryId : OptionSpec [String ] = parser.accepts(" replica-directory-id" , " REQUIRED: The directory id of the replica" )
450
449
.withRequiredArg
451
450
.describedAs(" directory id" )
452
451
.ofType(classOf [String ])
453
452
454
453
options = parser.parse(args : _* )
454
+
455
+ def checkArgs (): Unit = CommandLineUtils .checkRequiredArgs(parser, options, configOpt, directoryId)
455
456
}
456
457
457
458
def main (args : Array [String ]): Unit = {
458
459
val opts = new TestRaftServerOptions (args)
459
460
try {
460
461
CommandLineUtils .maybePrintHelpOrVersion(opts,
461
462
" Standalone raft server for performance testing" )
463
+ opts.checkArgs()
462
464
463
465
val configFile = opts.options.valueOf(opts.configOpt)
464
- if (configFile == null ) {
465
- throw new InvalidConfigurationException (" Missing configuration file. Should specify with '--config'" )
466
- }
467
-
468
466
val directoryIdAsString = opts.options.valueOf(opts.directoryId)
469
- if (directoryIdAsString == null ) {
470
- throw new InvalidConfigurationException (" Missing replica directory id. Should specify with --replica-directory-id" )
471
- }
467
+
472
468
val serverProps = Utils .loadProps(configFile)
473
469
474
470
// KafkaConfig requires either `process.roles` or `zookeeper.connect`. Neither are
0 commit comments