[
https://issues.apache.org/jira/browse/CASSANDRA-18438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738623#comment-17738623
]
Stefan Miklosovic edited comment on CASSANDRA-18438 at 6/29/23 3:58 PM:
------------------------------------------------------------------------
This is my idea about the simplification of all snitches
https://github.com/apache/cassandra/pull/2458
[~jlewandowski] what do you think?
Coding Azure snitch as [~xgerman42] wants that would be even easier. For
example, this is refactored Alibaba ([~maxwellguo]) (1)
Google snitch is similar (2).
Ec2 snitches also extends abstract cloud snitch but there is some additional
logic so it is not so straightforward.
I think that this approach is good enough in not repeating the same logic but
flexible enough to implement something custom if necessary.
We could also have some "DefaultCloudMetadataServiceSnitch" where the only
variables would be service url and endpoint. Alibaba and Google could extend
that.
For all other cases, if a snitch is super simple - just calling an endpoint and
datacenter / rack format in the response would be something standard - a user
might reference it in cassandra.yaml and configure endpoint and service url in
cassandra-rackdc.properties.
That way we are backward compatible with Alibaba and GoogleSnitch etc ... then
we are also generic enough if somebody wants to integrate their own metadata
service and DefaultCloudMetadataServiceSnitch is enough for them and it is also
very easy to implement something very custom which needs to be committed into
the repository.
(1)
https://github.com/apache/cassandra/blob/56ad1ffa2921530b44bcdfab4ffdcf0c375c2448/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java
(2)
https://github.com/apache/cassandra/blob/56ad1ffa2921530b44bcdfab4ffdcf0c375c2448/src/java/org/apache/cassandra/locator/GoogleCloudSnitch.java
was (Author: smiklosovic):
This is my idea about the simplification of all snitches
https://github.com/apache/cassandra/pull/2458
[~jlewandowski] what do you think?
Coding Azure snitch as [~xgerman42] wants that would be even easier. For
example, this is refactored Alibaba ([~maxwellguo]) (1)
Google snitch is similar (2).
Ec2 snitches also extends abstract cloud snitch but there is some additional
logic so it is not so straightforward.
I think that this approach is good enough in not repeating the same logic but
flexible enough to implement something custom if necessary.
(1)
https://github.com/apache/cassandra/blob/56ad1ffa2921530b44bcdfab4ffdcf0c375c2448/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java
(2)
https://github.com/apache/cassandra/blob/56ad1ffa2921530b44bcdfab4ffdcf0c375c2448/src/java/org/apache/cassandra/locator/GoogleCloudSnitch.java
> Refactor the code for public cloud platform snitch to be configurable
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-18438
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18438
> Project: Cassandra
> Issue Type: Improvement
> Components: Local/Other
> Reporter: Maxwell Guo
> Assignee: Maxwell Guo
> Priority: Normal
> Fix For: 5.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Nowadays we have got about four public cloud platform snitchs : EC2 snitch
> for aws, google cloud snitch for google cloud, alibaba cloud snitch for
> alibaba cloud and multi region snitch for ec2. And the common place for the
> first three is that we just need to query the zone center to get the ec2 /
> ecs id , so I think we can refactor the code , and if some new public cloud
> platform want to add one more snitch for himself, there is no need to pull a
> pr for him and configure some options in yaml is enough .
> Besides it would be even better that we may reuse the multic region snitch
> for ec2 for other public cloud platform.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]