You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "David Capwell (Jira)" <ji...@apache.org> on 2021/11/19 21:15:00 UTC

[jira] [Commented] (CASSANDRA-15254) Allow UPDATE on settings virtual table to change running configurations

    [ https://issues.apache.org/jira/browse/CASSANDRA-15254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17446662#comment-17446662 ] 

David Capwell commented on CASSANDRA-15254:
-------------------------------------------

Just looked at SettingsTable and see that it is trying to replicate the behavior in config, but doesn't actually match

{code}
static final Map<String, Field> FIELDS =
        Arrays.stream(Config.class.getFields())
              .filter(f -> !Modifier.isStatic(f.getModifiers()))
              .collect(Collectors.toMap(Field::getName, Functions.identity()));
{code}

Where as SnakeYaml does

{code}
c.getDeclaredFields()
...
if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && !properties.containsKey(field.getName())) {
{code}

This is a small difference, and doesn't currently impact Config, but its a difference that could eventually (ignoring the @Replaces logic as well).

It would be good to refactor so config loader and SettingsTable use the same logic.  For example, if we pulled out the getProperties logic then this class can just walk the list provided and call .get to get the value.  If we do this, its also rather trivial to add flatten names

{code}
flatProperties = []
for property in propertiesQueue: // assume .add will be seen in this iterator
  if !property.type.isPrimitive && !property.getProperties().isEmpty():
    // nested, add to queue for processing
    property.getProperties().foreach(p -> propertiesQueue.add(andThen(property, p, ".")); // . is the separator in this example
  else:
    flatProperties.add(property)
{code}

Doing such a refactor would be great, as I would also like to switch how we define property (see CASSANDRA-17166; 0 rush with this patch) to include non-fields, and non-standard get/set (we output snake style, but code is camel); ideally this vtable doesn't care about how we define properties, just wants a flatten list.

> Allow UPDATE on settings virtual table to change running configurations
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-15254
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15254
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Feature/Virtual Tables
>            Reporter: Chris Lohfink
>            Assignee: Benjamin Lerer
>            Priority: Normal
>
> Allow using UPDATE on the system_views.settings virtual table to update configs at runtime for the equivalent of the dispersed JMX attributes/operations.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org