-
Notifications
You must be signed in to change notification settings - Fork 36
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
CASSSIDECAR-179: Added additional dirs required for live migration #163
base: trunk
Are you sure you want to change the base?
CASSSIDECAR-179: Added additional dirs required for live migration #163
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.
Just a couple of nits. Otherwise, LGTM.
Thanks for the patch!
+1 (nb)
@@ -92,9 +112,13 @@ public InstanceConfigurationImpl(int id, | |||
this.id = id; | |||
this.host = host; | |||
this.port = port; | |||
this.dataDirs = Collections.unmodifiableList(dataDirs); | |||
this.dataDirs = dataDirs == null ? null : Collections.unmodifiableList(dataDirs); |
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 looks like an unrelated bug fix?
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.
Not trying to fix anything actually :). Trying to initialize the member variables in a single constructor. Earlier constructor initialized dataDirs with null, but this constructor is wrapping dataDirs with Collections.unmodifiableList
which doesn't accept null. So checking for null before wrapping it.
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.
when would data dirs be null (or empty)? Maybe this needs to be validated instead of accepting null
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.
when would data dirs be null (or empty)? Maybe this needs to be validated instead of accepting null
It is set to null if the data_dirs is not configured in sidecar.yaml. I was not sure why it was allowed to be null earlier. So did not change the behavior. I can make changes now though.
@@ -39,6 +39,10 @@ class InstanceMetadataImplTest | |||
private static final String DATA_DIR_2 = "test/data/data2"; | |||
private static final String CDC_DIR = "cdc_dir"; | |||
private static final String STAGING_DIR = "staging_dir"; | |||
private static final String COMMITLOG_DIR = "commitlog"; |
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.
Nit: Should we append _dir
to keep consistency? (both cdc and staging append it)
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 used the names used in cassandra.yaml for newly introduced directories. Wanted to use default names used in Cassandra, but I don't mind changing the names if required.
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.
we should not, this is the default directory name for the commit log in Cassandra, so it would be incorrect to add _dir
. See https://github.com/apache/cassandra/blob/trunk/conf/cassandra.yaml#L411
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.
so it would be incorrect to add _dir.
Wondering why CDC_DIR has "_dir" postfix. As per cassandra.yaml, cdc_raw_directory is cdc_raw
.
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.
maybe because it's test code, but it feels we should align with Cassandra directories
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 ended up with setting these values to non default values in order to test that InstanceMetaImpl is not using default values when these directories are set explicitly. Using "_dir" like in previous constants.
(I wrote this test class a few days back with the same intention, could not recollect it earlier, my apologies!)
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.
@bbotella Thanks for the review. Addressed the comments.
@@ -92,9 +112,13 @@ public InstanceConfigurationImpl(int id, | |||
this.id = id; | |||
this.host = host; | |||
this.port = port; | |||
this.dataDirs = Collections.unmodifiableList(dataDirs); | |||
this.dataDirs = dataDirs == null ? null : Collections.unmodifiableList(dataDirs); |
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.
Not trying to fix anything actually :). Trying to initialize the member variables in a single constructor. Earlier constructor initialized dataDirs with null, but this constructor is wrapping dataDirs with Collections.unmodifiableList
which doesn't accept null. So checking for null before wrapping it.
@@ -39,6 +39,10 @@ class InstanceMetadataImplTest | |||
private static final String DATA_DIR_2 = "test/data/data2"; | |||
private static final String CDC_DIR = "cdc_dir"; | |||
private static final String STAGING_DIR = "staging_dir"; | |||
private static final String COMMITLOG_DIR = "commitlog"; |
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 used the names used in cassandra.yaml for newly introduced directories. Wanted to use default names used in Cassandra, but I don't mind changing the names if required.
null, | ||
null, | ||
null, | ||
null, |
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.
For commit log, hints and saved caches, can we build it if it is not set. Like we do in Cassandra, by taking in CASSANDRA_HOME
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 agree that we should simplify Sidecar configuration, where we follow Cassandra's configuration. Ideally, we will only have to configure the cassandra_home
configuration per instance. And then we resolve the directory files in Cassandra unless explicitly provided.
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 some suggestions to simplify configuration and make operability simpler
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.
Just a general comment. We should update the sidecar.yaml configuration file under conf/sidecar.yaml
with configuration parameters. Ideally I think we want to only have to specify the cassandra_home_dir
, and optionally specify Cassandra directories. The exception are data directories
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.
Ideally I think we want to only have to specify the cassandra_home_dir , and optionally specify Cassandra directories. The exception are data directories
As per the documentation comment in cassandra.yaml, the default data directory is$CASSANDRA_HOME/data/data
. Is there any reason to take exception for data directories?
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.
Followed the footsteps of existing code. I would be happy to adopt cassandra_home_dir
as part of this pr.
Patch by Venkata Harikrishna Nukala; reviewed by <TBD> for CASSANDRASC-179
172239a
to
cc203a3
Compare
cc203a3
to
b698822
Compare
protected final String jmxRolePassword; | ||
|
||
public InstanceConfigurationImpl() |
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.
Removed this in order to reduce the confusion with what can be null and what cannot be null.
|
||
/** | ||
* Encapsulates the basic configuration needed to connect to a single Cassandra instance | ||
*/ | ||
public class InstanceConfigurationImpl implements InstanceConfiguration | ||
{ | ||
@JsonProperty("id") |
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.
Using constructor for this.
String jmxRolePassword) | ||
@JsonCreator | ||
public InstanceConfigurationImpl(@JsonProperty("id") int id, | ||
@NotNull @JsonProperty("host") String host, |
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.
@frankgh I guessing a bit for NotNull
and Nullable
of these fields. Please suggest changes if my interpretation is incorrect.
@@ -52,15 +65,42 @@ protected InstanceMetadataImpl(Builder builder) | |||
id = builder.id; | |||
host = builder.host; | |||
port = builder.port; | |||
cassandraHomeDir = FileUtils.maybeResolveHomeDirectory(builder.cassandraHomeDir); | |||
Path cassandraHomeDirPath = cassandraHomeDir == null ? null : Paths.get(cassandraHomeDir); |
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.
Okay with having cassandraHomeDir as a mandatory configuration? If yes, then I can push changes to make it mandatory. Assuming it is not mandatory for now.
Making this change as part of CEP-40.
Adding commitlog, hints, saved caches and local system data file directories to InstanceMetadata so that they migrated as part of CEP-40.
For CASSSIDECAR-179