You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "EdColeman (via GitHub)" <gi...@apache.org> on 2023/06/30 22:17:34 UTC
[GitHub] [accumulo] EdColeman opened a new pull request, #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
EdColeman opened a new pull request, #3562:
URL: https://github.com/apache/accumulo/pull/3562
Current the copy-configuration option copies the entire effective configuration into the target. This PR adds a copy-properties option that only copies the specific namespace or table properties that are in effect. This prevents the copied properties from masking properties higher in the hierarchy (see issue #3233)
- adds -cp, --copy-properties as an option to createnamespace and createtable shell commands
- adds IT tests
- uses NewTableConfiguration in create table command
- minor checkstyle fixes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1256302304
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ Map<String,String> propsToSet = null;
+
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ propsToSet = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
}
}
- if (configuration != null) {
- final Map<String,String> config = configuration;
+
+ if (cl.hasOption(createNamespaceOptCopyProperties.getOpt())) {
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyProperties.getOpt());
+ if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
Review Comment:
Addressed with c05206a036
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1274149466
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -32,42 +32,55 @@
import org.apache.accumulo.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamesapceOptExcludeParentProps;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
+ // validate that copy config and copy properties options are mutually exclusive.
Review Comment:
This comment is out of date with the current code and refers to a previous iteration of this change.
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java:
##########
@@ -292,7 +310,9 @@ public Options getOptions() {
final Options o = new Options();
createTableOptCopyConfig =
- new Option("cc", "copy-config", true, "table to copy configuration from");
+ new Option("cc", "copy-config", true, "table to copy effective configuration from");
+ createTableOptExcludeParentProps = new Option(null, "exclude-parent", false,
+ "exclude parent(s) properties when copying configuration");
Review Comment:
s/parent(s)/parent's/
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -89,10 +102,11 @@ public Options getOptions() {
new Option("cc", "copy-config", true, "namespace to copy configuration from");
createNamespaceOptCopyConfig.setArgName("namespace");
- OptionGroup ogp = new OptionGroup();
- ogp.addOption(createNamespaceOptCopyConfig);
+ createNamesapceOptExcludeParentProps = new Option(null, "exclude-parent", false,
+ "exclude parent(s) properties when copying configuration");
Review Comment:
s/parent(s)/parent's/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#issuecomment-1615277533
The difference between copy-config and copy-properties using a shell
```
> config -s table.custom.sys_prop=sys_v1
> createnamespace nsSrc
> config -s table.custom.ns_prop=ns_v1 -ns nsSrc
> createtable nsSrc.table1
# copy configuration
> createtable -cc nsSrc.table1 nsSrc.dest1
# copy properties
> createtable -cp nsSrc.table1 nsSrc.dest2
# modify sys and namesapce props
> config -s table.custom.sys_prop=sys_v2
> config -s table.custom.ns_prop=ns_v2 -ns nsSrc
Results:
> config -f table.custom -t nsSrc.table1
-----------+--------------------------+-------------------------------------------------------------
SCOPE | NAME | VALUE
-----------+--------------------------+-------------------------------------------------------------
namespace | table.custom.ns_prop ... | ns_v2
site | table.custom.sys_prop .. |
system | @override ........... | sys_v2
-----------+--------------------------+-------------------------------------------------------------
# show copy-properties does not override sys and namesapce (not in local properties) - matches source
> config -f table.custom -t nsSrc.dest2
-----------+--------------------------+-------------------------------------------------------------
SCOPE | NAME | VALUE
-----------+--------------------------+-------------------------------------------------------------
namespace | table.custom.ns_prop ... | ns_v2
site | table.custom.sys_prop .. |
system | @override ........... | sys_v2
-----------+--------------------------+--------------------------------------------------------------
# show copy-config is overriding sys and namespace values (copied local to table)
> config -f table.custom -t nsSrc.dest1
-----------+--------------------------+-----------------------------------------------------------
SCOPE | NAME | VALUE
-----------+--------------------------+-----------------------------------------------------------
namespace | table.custom.ns_prop ... | ns_v2
table | @override ........... | ns_v1
site | table.custom.sys_prop .. |
system | @override ........... | sys_v2
table | @override ........... | sys_v1
-----------+--------------------------+-----------------------------------------------------------
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1256286448
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -87,11 +96,13 @@ public Options getOptions() {
createNamespaceOptCopyConfig =
new Option("cc", "copy-config", true, "namespace to copy configuration from");
+ createNamespaceOptCopyProperties = new Option("cp", "copy-properties", true,
+ "namespace to copy properties from (only namespace properties are copied)");
Review Comment:
c05206a036 changed to use --exclude-parent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1248329933
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
Review Comment:
I'm not sure what this is doing at all. `getOptions()` will be called by the framework later. It should also be idempotent and lightweight, so it doesn't matter if the private members are set or not yet. But by the time this method is called, they certainly will be... so unless I'm mistaken, this line is redundant and useless.
I looked around and no other shell commands do this. The only other two that are "weird" in some way is the GrantCommand and RevokeCommand. In those, their getOptions() calls super.getOptions(), but just ignores the returned object, it for some reason. So, they are either depending on side-effects, are pointlessly calling super.getOptions() that does nothing, or they are broken and not correctly inheriting options from their super class. Regardless, those are a separate issue from here.
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ Map<String,String> propsToSet = null;
+
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ propsToSet = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
}
}
- if (configuration != null) {
- final Map<String,String> config = configuration;
+
+ if (cl.hasOption(createNamespaceOptCopyProperties.getOpt())) {
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyProperties.getOpt());
+ if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
+ propsToSet =
+ shellState.getAccumuloClient().namespaceOperations().getNamespaceProperties(srcNs);
+ }
+ }
+
+ if (propsToSet != null) {
+ final Map<String,String> props = propsToSet;
shellState.getAccumuloClient().namespaceOperations().modifyProperties(namespace,
Review Comment:
It'd be nice if we didn't have to mutate the properties, but could set them at creation time, similar to NewTableConfiguration. This could fail after the namespace is created, but without modifying the properties.
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -87,11 +96,13 @@ public Options getOptions() {
createNamespaceOptCopyConfig =
new Option("cc", "copy-config", true, "namespace to copy configuration from");
+ createNamespaceOptCopyProperties = new Option("cp", "copy-properties", true,
+ "namespace to copy properties from (only namespace properties are copied)");
Review Comment:
This is so similarly named. Although the naming similarity affects the Java API also, the Java API has the benefit of a decent Javadoc. This could use a better name to avoid getting too verbose help documentation.
For example, instead of creating a separate property (and allowing them both to be used, which could get confusing), just add a `--copy-config-exclude-parent` or just `--exclude-parent` that's used in conjunction with `--copy-config`.
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ Map<String,String> propsToSet = null;
+
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ propsToSet = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
}
}
- if (configuration != null) {
- final Map<String,String> config = configuration;
+
+ if (cl.hasOption(createNamespaceOptCopyProperties.getOpt())) {
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyProperties.getOpt());
+ if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
+ propsToSet =
+ shellState.getAccumuloClient().namespaceOperations().getNamespaceProperties(srcNs);
+ }
+ }
Review Comment:
I didn't realize we already had an API that got only the namespace properties. I thought the new API showed the effective properties, just like the old API.
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ Map<String,String> propsToSet = null;
+
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ propsToSet = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
}
}
- if (configuration != null) {
- final Map<String,String> config = configuration;
+
+ if (cl.hasOption(createNamespaceOptCopyProperties.getOpt())) {
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyProperties.getOpt());
+ if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
Review Comment:
This existence check will hide the errors if the table doesn't exist. That looks like it's a pre-existing problem. If the user specifies to copy from a namespace that doesn't exist (probably most often from a typo), I'd expect a NamespaceNotFoundException, not silent success without copying anything. Even though it's a pre-existing problem, it shouldn't be carried forward into this new implementation, and the old implementation should be fixed, too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ivakegg commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "ivakegg (via GitHub)" <gi...@apache.org>.
ivakegg commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1254641316
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -32,42 +32,55 @@
import org.apache.accumulo.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamesapceOptExcludeParentProps;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
+ // validate that copy config and copy properties options are mutually exclusive.
+ if (cl.hasOption(createNamesapceOptExcludeParentProps.getLongOpt())
+ && !cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
+ throw new IllegalArgumentException(createNamesapceOptExcludeParentProps.getLongOpt()
+ + " only valid when using " + createNamespaceOptCopyConfig.getLongOpt());
}
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
+ if (!shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
+ throw new IllegalArgumentException("Could not create namespace `" + namespace + "`");
+ }
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
- if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ if (!srcNs.isEmpty() && !shellState.getAccumuloClient().namespaceOperations().exists(srcNs)) {
+ throw new NamespaceNotFoundException(null, srcNs, null);
+ }
+ Map<String,String> userProps;
+ if (cl.hasOption(createNamesapceOptExcludeParentProps.getLongOpt())) {
+ // use namespace props - excludes parents in configuration
+ userProps =
+ shellState.getAccumuloClient().namespaceOperations().getNamespaceProperties(srcNs);
+ } else {
+ // use namespace config - include parents in configuration hierarchy
+ userProps = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
+ }
+ if (userProps != null) {
Review Comment:
can userProps actually be null here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ivakegg commented on pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "ivakegg (via GitHub)" <gi...@apache.org>.
ivakegg commented on PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#issuecomment-1623843420
Great, now can we ensure that the "clonetable" command only copies properties and not the entire hierarchy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#issuecomment-1624150468
BLUF - I am not seeing clone copy the configuration hierarchy - it seems to copy the appropiate properties, and upgrade from 1.10 -> 2.1 seems okay too,
I checked clonetable and what happens during an upgrade. Basically, set custom system and namespace props, cloned the table and then upgraded from 1.10 to 2.1-SNAPSHOT. The resulting properties of the clone in 2.1 look as expected. The clone does not have properties inherited from the configuration stored as table properties.
In 2.1, after the upgrade - the shell shows:
```
root@uno> config -f custom -t ns1.tbl1_clone1
-----------+--------------------------+---------------------------------------
SCOPE | NAME | VALUE
-----------+--------------------------+---------------------------------------
namespace | table.custom.ns_prop ... | ns1_v1
site | table.custom.sys_prop .. |
system | @override ........... | sys_v1
-----------+--------------------------+---------------------------------------
```
And this is confirmed by looking at the properties stored in the ZooKeeper node
```
> accumulo zoo-info-viewer -t ns1.tbl1_clone1 --print-props
Tables:
Name: ns1.tbl1_clone1, Data Version:0, Data Timestamp: 2023-07-06T18:25:17.356529Z:
table.constraint.1=org.apache.accumulo.core.constraints.DefaultKeySizeConstraint
table.iterator.majc.vers=20,org.apache.accumulo.core.iterators.user.VersioningIterator
table.iterator.majc.vers.opt.maxVersions=1
table.iterator.minc.vers=20,org.apache.accumulo.core.iterators.user.VersioningIterator
table.iterator.minc.vers.opt.maxVersions=1
table.iterator.scan.vers=20,org.apache.accumulo.core.iterators.user.VersioningIterator
table.iterator.scan.vers.opt.maxVersions=1
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#issuecomment-1615283459
Also, a note about GitHub: When you put `Fixes NNNN` in the title, GitHub does not automatically link the PR with the open issue. However, I believe it will automatically link them (or offer a suggestion to do so), if you put `Fixes #NNNN` in the body. That also makes a clickable link in the body (must include `#` for that), whereas the title is never clickable, so you have to manually navigate to the issue from the PR by re-typing the issue number in the address bar manually. There's also the additional benefit of being able to save on valuable real estate in the title by omitting the "Fixes NNNN" there. There's plenty of room in the body, and it's much more useful there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1256303490
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -37,33 +37,42 @@
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamespaceOptCopyProperties;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
- }
+ getOptions();
Review Comment:
removed in c05206a036
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a diff in pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #3562:
URL: https://github.com/apache/accumulo/pull/3562#discussion_r1265431728
##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -32,42 +32,55 @@
import org.apache.accumulo.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
public class CreateNamespaceCommand extends Command {
private Option createNamespaceOptCopyConfig;
+ private Option createNamesapceOptExcludeParentProps;
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
NamespaceNotFoundException {
- if (createNamespaceOptCopyConfig == null) {
- getOptions();
+ // validate that copy config and copy properties options are mutually exclusive.
+ if (cl.hasOption(createNamesapceOptExcludeParentProps.getLongOpt())
+ && !cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
+ throw new IllegalArgumentException(createNamesapceOptExcludeParentProps.getLongOpt()
+ + " only valid when using " + createNamespaceOptCopyConfig.getLongOpt());
}
String namespace = cl.getArgs()[0];
shellState.getAccumuloClient().namespaceOperations().create(namespace);
+ if (!shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
+ throw new IllegalArgumentException("Could not create namespace `" + namespace + "`");
+ }
- // Copy options if flag was set
- Map<String,String> configuration = null;
+ // Copy configuration options if flag was set
if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
- String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
- if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
- configuration = shellState.getAccumuloClient().namespaceOperations().getConfiguration(copy);
+ String srcNs = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
+ if (!srcNs.isEmpty() && !shellState.getAccumuloClient().namespaceOperations().exists(srcNs)) {
+ throw new NamespaceNotFoundException(null, srcNs, null);
+ }
+ Map<String,String> userProps;
+ if (cl.hasOption(createNamesapceOptExcludeParentProps.getLongOpt())) {
+ // use namespace props - excludes parents in configuration
+ userProps =
+ shellState.getAccumuloClient().namespaceOperations().getNamespaceProperties(srcNs);
+ } else {
+ // use namespace config - include parents in configuration hierarchy
+ userProps = shellState.getAccumuloClient().namespaceOperations().getConfiguration(srcNs);
+ }
+ if (userProps != null) {
Review Comment:
Currently, probably not, but unless we use a not null annotation, that is not guaranteed to always be the case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman merged pull request #3562: Fixes 3233. Add copy-properties option for createnamespace and createtable shell commands
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman merged PR #3562:
URL: https://github.com/apache/accumulo/pull/3562
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org