-
Notifications
You must be signed in to change notification settings - Fork 3.7k
CASSANDRA-15254 Support updates on the virtuabl table SettingsTable (use annotations for property updates validation) #2334
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
base: trunk
Are you sure you want to change the base?
Conversation
@@ -204,6 +205,8 @@ public MemtableOptions() | |||
// Limit the maximum depth of repair session merkle trees | |||
@Deprecated | |||
public volatile Integer repair_session_max_tree_depth = null; | |||
@Mutable | |||
@Validate(useClass = DATABASE_DESCRIPTOR_CLASS, useClassMethod = "validateRepairSessionSpace") |
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.
do you do string because Class<DatabaseDescriptor>
would cause a circular ref?
* a custom validator class and its method. | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.FIELD) |
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 now this is fine, if we need to can allow in method later, just need to update the loader
src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
Outdated
Show resolved
Hide resolved
src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
Outdated
Show resolved
Hide resolved
src/java/org/apache/cassandra/config/YamlConfigurationLoader.java
Outdated
Show resolved
Hide resolved
@smiklosovic Thank you for the comments. |
@Mmuzaf I think you did a good job and David already saw it too so ... I may go through it next days again but seems robust enough to me! It would be nice to have yet another pair of eyes on this, if you happen to get somebody to take a look, that would be great! |
try | ||
{ | ||
Object value = getPropertyAsString(getKeyAndWarnIfObsolete(name)); | ||
result.row(name).column(VALUE, value).column(MUTABLE, DatabaseDescriptor.isMutableProperty(name)); |
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.
@Mmuzaf I was thinking about this some time ago and I found some time to go over this again ... I think that isMutableProperty
is too much here in such sense that it might be "cached". We are not going to introduce a new property while a node is running - it is a static set of keys and values. You can populate a map in a constructor of vtable. So it would be just a simple map lookup, or even easier, names of all mutable properties would be in a set. So if it is not in s set it is not mutable. You do not need to do reflection every single query for every single property all over again.
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.
@smiklosovic agree, this makes sense to me. I'll try to figure out the best way to avoid using reflection every time we need to get the mutability state.
Sorry, been away from this patch for a very long time. If 2 committers are +1 to this patch please don't wait for me and feel free to merge. I don't know when I will have time to review again. |
.build()); | ||
this.config = config; | ||
for (String name : BACKWARDS_COMPATABLE_NAMES.keySet()) |
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.
@Mmuzaf COMPATIBLE, not COMPATABLE
private void handleResizeIntervalInMinutes(DurationSpec.IntMinutesBound oldValue, DurationSpec.IntMinutesBound newValue) | ||
{ | ||
int oldInterval = getDurationInMinutes(oldValue); | ||
int resizeIntervalInMinutes = getDurationInMinutes(newValue); |
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.
@Mmuzaf where was this property taken from before? I see it is already used in this method further down bellow ...
@@ -296,6 +318,7 @@ public void shutdownAndWait(long timeout, TimeUnit unit) throws InterruptedExcep | |||
future.cancel(false); | |||
future = null; | |||
} | |||
shutdownTasks.forEach(Runnable::run); |
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.
what if Runnable#run
throws? Then it will never get to ExecutorUtils.shutdownAndWait on the next line?
} | ||
|
||
@Test | ||
public void testBactchUpdateSettings() throws Throwable |
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.
testBatch...
protected static final Map<String, Property> PROPERTIES = ImmutableMap.copyOf(getProperties()); | ||
|
||
private final Config config; | ||
private static final String MUTABLE = "is_mutable"; |
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.
@Mmuzaf can be this renamed just to mutable
? I think that is just enough ... no need to put there is_
.
validatedByArray = new ValidatedBy[]{ field.getAnnotation(ValidatedBy.class) }; | ||
} | ||
else | ||
validatedByArray = validatedByList.value(); |
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.
@Mmuzaf could it happen that validatedByList would not be null but the array would be null? Then the next for
would loop over null?
df3eb40
to
54e39a9
Compare
Thanks for sending a pull request! Here are some tips if you're new here:
Commit messages should follow the following format:
The Cassandra Jira