Skip to content

Adds expected file to import config command#6342

Open
keith-turner wants to merge 4 commits intoapache:mainfrom
keith-turner:import-expected
Open

Adds expected file to import config command#6342
keith-turner wants to merge 4 commits intoapache:mainfrom
keith-turner:import-expected

Conversation

@keith-turner
Copy link
Copy Markdown
Contributor

Adds a new option to the import config command to provide an optional expected file. If the expected file is provided, then updates are only made if the expected file equals the current properties in zookeeper. The expected check is done atomically.

accumulo conf export > export.yaml
cp export.yaml copy.yaml
vim copy.yaml // edit config
accumulo conf import --input copy.yaml --expected export.yaml

The import would fail if any config changes were made after the export. Added this new option as a safer way to do what zoo-prop-editor does, plan to deprecate or remove zoo-prop-editor after this is merged.

Another use case this new option supports is detecting changes between pushing updates from CM. For example if a new config update needs to applied from CM, can check if the previous update from CM is still as is. This would make the import command fail if any changes were made outside of CM.

accumulo conf import --input new-from-cm.yaml --expected prev-from-cm.yaml

Adds a new option to the import config command to provide an optional
expected file. If the expected file is provided, then updates are only
made if the expected file equals the current properties in zookeeper.
The expected check is done atomically.

```bash
accumulo conf export > export.yaml
cp export.yaml copy.yaml
vim copy.yaml // edit config
accumulo conf import --input copy.yaml --expected export.yaml
```

The import would fail if any config changes were made after the export.
Added this new option as a safer way to do what zoo-prop-editor does,
plan to deprecate or remove zoo-prop-editor after this is merged.

Another use case this new option supports is detecting changes between
pushing updates from CM.  For example if a new config update needs to
applied from CM, can check if the previous update from CM is still as
is.  This would make the import command fail if any changes were made
outside of CM.

```bash
accumulo conf import --input new-from-cm.yaml --expected prev-from-cm.yaml
```
// validate all scope+name before attempting to update any scope+name
for (var scopedProps : allProps) {
var propStoreKey = getKey(scopedProps.scope(), scopedProps.name(), serverContext);
PropUtil.validateProperties(serverContext, propStoreKey, scopedProps.props());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realized the --dryrun option is not checking expected, need to add that here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant