-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-18722 Support Dynamic Port Allocation for in-jvm dtest framework #2546
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method was unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another option is to provide a new interface PortAllocationStrategy and we'd have default implementations as well as the DynamicPortAllocationStrategy. I didn't go with this approach because I don't foresee a different port allocation strategy other than the default and dynamic in the near future.
dineshjoshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking for nodeNum == 1 in storagePort, you could just define default methods on the interface for seedIP() and seedPort(), just calling ipAddress(1) and storagePort(1) respectively and reduce the amount of methods and make the portMap more regular with entries for storagePort for all.
"nativeTransportPort:2" -> {Integer@17131} 63721
"nativeTransportPort:1" -> {Integer@17107} 63719
"jmxPort:2" -> {Integer@17133} 63722
"jmxPort:1" -> {Integer@17109} 63720
"storagePort:2" -> {Integer@16549} 63709
"seedPort" -> {Integer@16550} 63708```
…ework Currently, `INodeProvisionStrategy` supports two strategies `OneNetworkInterface` and `MultipleNetworkInterfaces`. However the `seedPort`, `storagePorts`, `nativeTransportPorts`, and `jmxPorts` are always fixed or a function of the node number. In order to better support parallel test runs, this commit introduces support for dynamic port allocation for the `seedPort`, `storagePorts`, `nativeTransportPorts`, and `jmxPorts`. When enabled, the port allocation will be dynamic, an available port for the given bind address will be used instead of the previously statically allocated port number. This would allow us to run multiple clusters within the same test, or it will enable us to run in-jvm dtests in parallel given that the tests do not have other inter-test dependencies. A new option in the cluster builder is introduced `.withDynamicPortAllocation(boolean)`. To enable the new feature one must request dynamic port allocation while building the cluster. [CASSANDRA-18722](https://issues.apache.org/jira/browse/CASSANDRA-18722)
yifan-c
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one nit.
+1 on the patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This key does not contain ":", while all the others contain ":".
Are the keys going to be printed. If so, we can go a bit for verbose to have node1 instead of 1 and probably @ suits better than :.
e0e3196 to
f5c3e58
Compare
|
Closed via 6ffa43f |
Currently,
INodeProvisionStrategysupports two strategiesOneNetworkInterfaceandMultipleNetworkInterfaces. However theseedPort,storagePorts,nativeTransportPorts, andjmxPortsare always fixed or a function of the node number.In order to better support parallel test runs, this commit introduces support for dynamic port allocation for the
seedPort,storagePorts,nativeTransportPorts, andjmxPorts.When enabled, the port allocation will be dynamic, an available port for the given bind address will be used instead of the previously statically allocated port number. This would allow us to run multiple clusters within the same test, or it will enable us to run in-jvm dtests in parallel given that the tests do not have other inter-test dependencies.
A new option in the cluster builder is introduced
.withDynamicPortAllocation(boolean). To enable the new feature one must request dynamic port allocation while building the cluster.CASSANDRA-18722