-
Notifications
You must be signed in to change notification settings - Fork 52
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
Reaper endpoints: Async Repair Endpoint #358
Conversation
No linked issues found. Please add the corresponding issues in the pull request description. |
@emerkle826 this is draft still, but I have a few questions and thought we might best collaborate with some concrete code to look at. Questions:
The only place this matters is in the definition of the ranges, since the existing function just takes a start and end token, while the new function needs to take a list of start and end tokens (which is realised as a RingRange, but we could potentially use a |
975be5d
to
ecb59f1
Compare
The RPC calls don't handle polymorphism (see here). RPC Methods have to have a unique RPC name, so we can't even register the same method with 2 different RPC names to handle a polymorphic situation. |
I think we can, but I'm not sure. To do so may require enhancements to some of the RPC serialization code. |
Yes, but I think in this case it might be better to have the API side of things determine which Range type is being requested and then build a specific RPC call for a RingRange or a start/end token. Unless I'm missing something, it seems like we will have 2 RPC methods on the Agent side, and the API/server side will handle the request and determine which of the RPC methods to call. |
private final BigInteger start; | ||
private final BigInteger end; | ||
|
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.
Issue:
Something @olim7t just figured out is that model objects on the Agent side of things likely have to have their attributes as public
in order for the Object serialization to work. See the code here:
https://github.com/k8ssandra/management-api-for-apache-cassandra/blob/feature/get-tables/management-api-agent-3.x/src/main/java/com/datastax/mgmtapi/rpc/ObjectSerializer3x.java#L61
management-api-agent-common/src/main/java/com/datastax/mgmtapi/NodeOpsProvider.java
Outdated
Show resolved
Hide resolved
ecb59f1
to
30e2606
Compare
Got confused about where the beginToken/endToken vs RingRange thing was happening. It was in Reaper, not mgmt API. So we can stick with having a single repair method. That solves one problem. I've revamped the existing RPC method, and I have the old Resource calling it now. |
…aper). Get the old NodeOpsResources class calling the new RPC method correctly.
30e2606
to
3c9aa74
Compare
3c9aa74
to
d82219b
Compare
@emerkle826 can you give me a hand with this when you're in? I'm getting the below statement about illegally formatted files from CI:
But when I run the suggested command it doesn't appear to change any files, or come up with any further information about what is wrong with the formatting. Do you know what I'm supposed to do with this? |
a59b202
to
d631cf6
Compare
282f382
to
b1bd97f
Compare
b1bd97f
to
da8b860
Compare
91a928a
to
17d298f
Compare
…ment-api-for-apache-cassandra into feature/repair-endpoint
@olim7t can Erik and I get some feedback from you on the topic of Optionals? The context is that in the NodeOpsProvider, we want to avoid adding keys to the repair options map under several circumstances:
This is because we want the NodeOpsProvider logic to service v0-v3 endpoints, and some options are unavailable in the v0/v1 endpoints. We want to avoid adding entries with null values, empty collections, etc. into the options map in this case since we don't know how Cassandra will interpret them. To facilitate this, I have the new options being passed as But Erik has rightly noted that the calls over the RPC channel aren't type checked, so wrapping things in Neither of us have a strong feeling on this - do you have any thoughts? |
f47f74a
to
ce1b848
Compare
ce1b848
to
f29c16b
Compare
cd6fce7
to
16f701a
Compare
@RpcParam(name = "full") Boolean full, | ||
@RpcParam(name = "notifications") boolean notifications) | ||
@RpcParam(name = "notifications") boolean notifications, | ||
@RpcParam(name = "repairParallelism") Optional<RepairParallelism> repairParallelism, |
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.
Issue:
There are 2 issues here:
RepairParallelism
andOptional
are not included in the variouscom.datastax.mgmtapi.rpc.GenericSerializer
classesRepairParallelism
is a class that exists in Cassandra (org.apache.cassandra.repair.RepairParallelism
) and in the Management API server code (com.datastax.mgmtapi.resources.v2.models.RepairParallelism
)
We could add the classes to the GenericSerializers, but that's a slippery slope. Right now, it supports Java primitives and basic collection types.
The second issue is more of a confusing thing. The v2 model object looks a lot like the Cassandra object, but they are not the same. And in the Resource code, we are not sending the Cassandra object, we are sending the V2 model object. So this will never deserialize correctly since we are expecting the Cassandra object in this method.
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.
The second issue is more of a confusing thing. The v2 model object looks a lot like the Cassandra object, but they are not the same. And in the Resource code, we are not sending the Cassandra object, we are sending the V2 model object. So this will never deserialize correctly since we are expecting the Cassandra object in this method.
Woops... Sorry, I should have spotted that one :(
Wouldn't we be better off adding a generic serializer for the collections interface to make things more generic? I have to be honest, I do not like the way management API is not using the type system very much throughout. I understand some of that is unavoidable due to the way the RPC calls work, but if we can't even serialise our own types, that is unfortunate.
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.
Actually, I need to understand why we aren't just serializing straight to json or using some off the shelf serialization here - was there a reason for writing our own serializer?
@RpcParam(name = "notifications") boolean notifications, | ||
@RpcParam(name = "repairParallelism") Optional<RepairParallelism> repairParallelism, | ||
@RpcParam(name = "datacenters") Optional<Collection<String>> datacenters, | ||
@RpcParam(name = "associatedTokens") Optional<List<RingRange>> associatedTokens, |
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.
Issue:
We likely have the same GenericSerialization issue for RingRanges
as we do for RepairParallelism
above
management-api-agent-common/src/main/java/com/datastax/mgmtapi/NodeOpsProvider.java
Outdated
Show resolved
Hide resolved
I haven't checked every implementation, but looking at 3.x's |
4aef006
to
1c018cc
Compare
It isn't so much about unknown options, it is more about setting the option values to null or empty collections. @olim7t |
1c018cc
to
16f701a
Compare
… serialization (#366) * Remove Optional and other objects not handled by RPC serialization --------- Co-authored-by: Erik Merkle <[email protected]>
* Add cancelAllRepairs endpoint and requisite NodeOps. --------- Co-authored-by: Erik Merkle <[email protected]>
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.
Ready for merge
* Allow `repair()` RPC method to take more arguments (as required by Reaper). Get the old NodeOpsResources class calling the new RPC method signature. --------- Co-authored-by: Erik Merkle <[email protected]> * Cancel repairs endpoint (#368) * Add cancelAllRepairs endpoint and requisite NodeOps.
* Allow `repair()` RPC method to take more arguments (as required by Reaper). Get the old NodeOpsResources class calling the new RPC method signature. --------- Co-authored-by: Erik Merkle <[email protected]> * Cancel repairs endpoint (#368) * Add cancelAllRepairs endpoint and requisite NodeOps.
This fixed #405 |
* Allow `repair()` RPC method to take more arguments (as required by Reaper). Get the old NodeOpsResources class calling the new RPC method signature. --------- Co-authored-by: Erik Merkle <[email protected]> * Cancel repairs endpoint (#368) * Add cancelAllRepairs endpoint and requisite NodeOps.
* Allow `repair()` RPC method to take more arguments (as required by Reaper). Get the old NodeOpsResources class calling the new RPC method signature. --------- Co-authored-by: Erik Merkle <[email protected]> * Cancel repairs endpoint (#368) * Add cancelAllRepairs endpoint and requisite NodeOps.
This PR modifies the existing
repair
method inNodeOpsProvider
to accept arguments suitable for Reaper. When complete, it should also create a new v2 endpoint to accept new repairs and return a repairID which can later be queried for status updates.Fixes issue
https://github.com/riptano/mission-control/issues/506