[
https://issues.apache.org/jira/browse/CASSANDRA-14821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664997#comment-16664997
]
Benedict commented on CASSANDRA-14821:
--------------------------------------
This patch is looking really good, and I'm looking forward to it landing. I’ve
gone ahead and made a few changes to it, that I’ve pushed
[here|https://github.com/belliottsmith/cassandra/tree/14821]
The main change is around how we mock out the networking. Before we were
registering only very specific handlers, and only for the coordinator. I’ve
removed the special case handling and we’re now able to handle any message
type, and we can deliver them between any nodes (not just from the nominated
coordinator).
Relatedly, I’ve slightly improved the message filtering - there’s now a builder
interface for dropping messages, that also returns a handle that permits
toggling the specific filter. The builder uses instance numbers rather than
{{InetAddressAndPort}} to simplify for authors. This also supports filtering
messages between multiple sender and recipient nodes, for any selection of
verbs.
The filtering is perhaps slightly less efficient, because it’s somewhat of a
simple pattern match, so we must iterate all filters, but I think this is
probably overall more ergonomic.
I’ve also changed the node numbering in TestCluster.get(), to index from 1.
This might seem counterintuitive, but it should make debugging easier, as now
the instance number we use in the test cases will match the low digits of the
broadcast address.
Otherwise, some refactoring:
ConfigUtil: merged into InstanceConfig
InstanceClassLoader: moved all class loading config here, introduced a factory
to abstract their creation
Typo: org.apache.cassandra.disable_mbrean_registration
Coordinator: moved registerCallbacks -> Instance.registerMockMessaging
Shared Class Loader: Removed some (effectively) dead code with the intermediate
class loader that wasn’t actually used (and probably isn’t necessary)
Shutdown: Used a varargs array of lambdas to simplify slightly
runOnAll: Still there, but wasn’t actually necessary for the use cases as the
methods already invoked themselves on the target node, so the I’ve migrated the
callsites to a simple submit of invoking the method. I’ve also standardised
most of the instance methods to transparently forwarding the invocation to the
node. We could consider removing runOnAll.
> Make it possible to run multi-node coordinator/replica tests in a single JVM
> ----------------------------------------------------------------------------
>
> Key: CASSANDRA-14821
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14821
> Project: Cassandra
> Issue Type: Test
> Reporter: Alex Petrov
> Assignee: Alex Petrov
> Priority: Major
>
> This patch proposes an in-JVM Distributed Tester that can help to write
> distributed tests in a single JVM and be able to control node behaviour in a
> fine-grained way and set up nodes exactly how one needs it: configuration
> settings, parameters, which are also controllable in runtime on a per node
> basis, so each node can have its own unique state.
> It fires up multiple Cassandra Instances in a single JVM. It is done through
> having distinct class loaders in order to work around the singleton problem
> in Cassandra. In order to be able to pass some information between the nodes,
> a common class loader is used that loads up java standard library and several
> helper classes. Tests look a lot like CQLTester tests would usually look like.
> Each Cassandra Instance, with its distinct class loader is using
> serialisation and class loading mechanisms in order to run instance-local
> queries and execute node state manipulation code, hooks, callbacks etc.
> First version mocks out Messaging Service and simplifies schema management by
> simply running schema change commands on each of the instances separately.
> Internode communication is mocked by passing ByteBuffers through shared class
> loader.
> |[patch|https://github.com/ifesdjeen/cassandra/tree/in-jvm-distributed-tests-2]|[tests|https://circleci.com/workflow-run/d88a1278-596c-4af1-9a03-998e9f6c78d3]|
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]