@SetYamlConfiguration

Documentation

VoltDB Home » Documentation » Using VoltDB

@SetYamlConfiguration

@SetYamlConfiguration — changes configuration settings for one or more properties

Synopsis

@SetYamlConfiguration String yaml, String dot-notation

Description

The @SetYamlConfiguration system procedure sets new values for one or more configuration properties. You specify the properties to change in either YAML or dot notation. You provide a YAML definition as the first argument and one or more property assignments in dot notation as the second argument. If either argument is an empty string or null it is ignored.

YAML natively supports defining multiple properties. To specify multiple values in dot notation, place each property name and value on a separate line.

The @SetYamlConfiguration procedure only changes the specified properties, all other configuration options remain unchanged. It is also important to note that only certain properties can be changed while the database is running. See Table E.1, “Complete List of Volt Configuration Properties” for a list of all configuration options. Those properties with a checkmark next to their names can be changed "on the fly". All other options are static and will generate an error if you try to change them with this system procedure.

Return Values

Returns one VoltTable with one row.

NameDatatypeDescription
STATUSBIGINTReturns a value zero (0) indicating success or two (2) indicating success but no changes required

.Examples

The following program example uses @SetYamlConfiguration and YAML to enable automatic snapshots and set the retention limit to 2 snapshots.

String yaml = """---
deployment:
  snapshot:
    enabled: true
    retain: 2""";
String dots = """deployment.snapshot.frequency=60m
deployment.snapshot.prefix=backup"""; 

try {
    VoltTable[] results = client.callProcedure("@SetYamlConfiguration",
        yaml,""
    ).getResults();
}
catch (Exception e) {
    e.printStackTrace();
}

To set the snapshot frequency and prefix using dot notation, you can change the procedure call in the preceding example to the following:

try {
    VoltTable[] results = client.callProcedure("@SetYamlConfiguration",
        "",dots
]   ).getResults();
}

Or you can specify both YAML and dot notation at the same time to set all four properties:

try {
    VoltTable[] results = client.callProcedure("@SetYamlConfiguration",
        yaml,dots
]   ).getResults();
}

For interactive use, the voltadmin set command performs the same function as @SetYamlConfiguration, except you separate multiple property names in dot notation with spaces instead of line breaks. The following is the interactive equivalent of the second program example:

$ voltadmin set \
    deployment.snapshot.frequency=60m \
    deployment.snapshot.prefix=backup