-
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
Add upgrade()
to Admin API
#1204
Conversation
42e8912
to
59c9033
Compare
/** | ||
* Upgrades the Scalar DB environment to support the latest version of the Scalar DB API. | ||
* Typically, you will be requested, as indicated on the release notes, to run this method after | ||
* updating the Scalar DB version of your application environment. | ||
* | ||
* @param options options to upgrade | ||
* @throws ExecutionException if the operation fails | ||
*/ | ||
void upgrade(Map<String, String> options) throws ExecutionException; |
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.
The new upgrade()
Admin API.
@@ -406,6 +406,26 @@ public Set<String> getNamespaceNames() throws ExecutionException { | |||
} | |||
} | |||
|
|||
@Override | |||
public void upgrade(Map<String, String> options) throws ExecutionException { |
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.
The upgrade()
implementation of the CassandraAdmin
@@ -647,6 +647,33 @@ public Set<String> getNamespaceNames() throws ExecutionException { | |||
} | |||
} | |||
|
|||
@Override | |||
public void upgrade(Map<String, String> options) throws ExecutionException { |
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.
The upgrade()
implementation of the CosmosAdmin
@@ -1363,6 +1363,50 @@ public Set<String> getNamespaceNames() throws ExecutionException { | |||
} | |||
} | |||
|
|||
@Override | |||
public void upgrade(Map<String, String> options) throws ExecutionException { |
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.
The upgrade()
implementation of the DynamoAdmin
@@ -1008,4 +1013,39 @@ private boolean isNamespacesTableEmpty(Connection connection) throws SQLExceptio | |||
return !results.next(); | |||
} | |||
} | |||
|
|||
@Override | |||
public void upgrade(Map<String, String> options) throws ExecutionException { |
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.
The upgrade()
implementation of the JdbcAdmin
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!
core/src/main/java/com/scalar/db/storage/cassandra/CassandraAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
public void upgrade(Map<String, String> options) throws ExecutionException { | ||
try { | ||
if (!tableMetadataContainerExists()) { | ||
return; |
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.
Just quick silly questions.
- It's impossible to create the table metadata container if not exists?
- If not possible, don't need to throw an exception?
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.
There may be a misunderstanding here.
This check verifies if the table metadata container does not exist, if true this means there is no table installed, so there is no namespace to import to the namespaces metadata table.
A limitation is that if there was a namespace that did not contain a ScalarDB-managed table, we wouldn't import it to the namespace table. It's because we assume such namespace are the storage system namespaces or are user-one but not used for ScalarDB.
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.
Does this answer your question ?
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.
Thank you! Understood 👍
@Override | ||
public void upgrade(Map<String, String> options) throws ExecutionException { | ||
if (!metadataTableExists()) { | ||
return; |
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.
Similar question to the above one
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.
My answer is the same as #1204 (comment)
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! 👍
public void upgrade(Map<String, String> options) throws ExecutionException { | ||
try { | ||
if (!tableMetadataContainerExists()) { | ||
return; |
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.
Thank you! Understood 👍
I pushed a fix for missing |
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!
Description
Considering we have the two following requirement:
To address story
2
while also being able to address the more general story1
for future work, we choose a generic API name,upgrade()
. Currently, this method will only address the need to upgrade the environment because of the namespace management feature, but we can append new behaviors anytime to handle new features that break the backward compatibility of the environment.Related issues and/or PRs
Changes made
Add a new
void upgrade(Map<String, String> options)
method to the Admin API, which will create the namespace metadata table and create metadata for the existing namespace.Checklist
Additional notes (optional)
--upgrade
command will be added to the Schema Loader in another PRupgrade()
is not supported in the ScalarDB Server and JDBC Transaction Admin since these two components will be deleted before the 4.0.0 release.Release notes
Added a new method,
void upgrade(Map<String,String> options)
, to the Admin API. Running this method when updating an existing environment to ScalarDB 4.X is necessary to support backward incompatible changes introduced by the new "namespaces management" feature.