-
Notifications
You must be signed in to change notification settings - Fork 37
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
Introduce system namespace #1345
Conversation
@@ -53,6 +54,9 @@ public class DatabaseConfig { | |||
public static final String CROSS_PARTITION_SCAN = SCAN_PREFIX + "enabled"; | |||
public static final String CROSS_PARTITION_SCAN_FILTERING = SCAN_PREFIX + "filtering.enabled"; | |||
public static final String CROSS_PARTITION_SCAN_ORDERING = SCAN_PREFIX + "ordering.enabled"; | |||
public static final String SYSTEM_NAMESPACE_NAME = PREFIX + "system_namespace_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.
Added a new config for the system namespace name. The default is scalardb
.
|
||
public CassandraConfig(DatabaseConfig databaseConfig) { | ||
String storage = databaseConfig.getStorage(); | ||
if (!storage.equals(STORAGE_NAME)) { | ||
throw new IllegalArgumentException( | ||
DatabaseConfig.STORAGE + " should be '" + STORAGE_NAME + "'"); | ||
} | ||
metadataKeyspace = getString(databaseConfig.getProperties(), METADATA_KEYSPACE, null); | ||
metadataKeyspace = databaseConfig.getSystemNamespaceName(); |
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.
Use the system namespace for metadata tables in each adapter.
.addPartitionKey(NAMESPACES_NAME_COL, com.datastax.driver.core.DataType.text()) | ||
.getQueryString(); | ||
clusterManager.getSession().execute(createTableQuery); | ||
|
||
// Insert the system namespace to the namespaces table | ||
upsertIntoNamespacesTable(metadataKeyspace); |
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.
Also, insert the system namespace to the namespaces metadata table. So we can see the system namespace when we call admin.getNamespaceNames()
.
@@ -45,7 +45,8 @@ public static Properties getProperties(String testName) { | |||
|
|||
// Add testName as a metadata namespace suffix | |||
props.setProperty( | |||
DynamoConfig.METADATA_NAMESPACE, DynamoAdmin.METADATA_NAMESPACE + "_" + testName); | |||
DatabaseConfig.SYSTEM_NAMESPACE_NAME, | |||
DatabaseConfig.DEFAULT_NAMESPACE_NAME + "_" + testName); |
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.
DatabaseConfig.DEFAULT_NAMESPACE_NAME + "_" + testName); | |
DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME + "_" + testName); |
I guess you didn't intend to set scalar.db.system_namespace_name
property to scalar.db.default_namespace_name_${testName}
.
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.
Good catch! Fixed in efd4c49. Thanks.
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.
LGTM! 👍
@brfrn169 Seems like some of the CIs failed. Can you check? |
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.
Left one question. PTAL!
props.setProperty(DatabaseConfig.CROSS_PARTITION_SCAN_FILTERING, "false"); | ||
props.setProperty(DatabaseConfig.CROSS_PARTITION_SCAN_ORDERING, "false"); | ||
return props; | ||
Properties properties = new Properties(); |
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.
I'm just wondering why props
is renamed to properties
.
It's fine, but other XXXEnv
don't do the same, I feel it's a bit inconsistent.
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.
Yeah, that's true. Let me make things consistent. Thanks.
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.
Fixed in 7b053c5. Please take a look again when you have time!
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.
LGTM! Thank you!🙇♂️
246d487
to
c83c95d
Compare
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.
LGTM! Thank you!
@Torch3333 It's merged, but please take a look when you are back! |
Description
This PR introduces a system namespace that's for internal use, for example the namespace for metadata tables. The default system namespace name is
scalardb
, but users can change the system namespace name by changing the configurationscalar.db.system_namespace_name
.Related issues and/or PRs
N/A
Changes made
scalar.db.system_namespace_name
Checklist
Additional notes (optional)
N/A
Release notes
N/A