-
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
Implementation of Dynamo Admin module #301
Conversation
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! I did the first review for this and left some comments/suggestions. Please check them when you have time!
I will review it again later. Thanks.
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
Thank you. I'll mark this PR as ready when I finish the tests. |
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! I took a look at this again and left some comments/suggestions. Please take a look!
Maybe, I think I will take a look at it once again later. Thanks.
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
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!
Let me start off by leaving comments on the superficial parts of the code.
I will look into it later.
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
for (String column : metadata.getClusteringKeyNames()) { | ||
if (metadata.getColumnDataType(column) == DataType.BOOLEAN) { | ||
throw new ExecutionException( | ||
"BOOLEAN type is not supported for a clustering key or a secondary index in DynamoDB"); |
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.
This limitation is still there? I did a quick search but I can't find it.
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.
It still is a limitation. There is no attribute type likes ScalarAttributeType.BOOL
came from SDK.
throw new UnsupportedOperationException("implement later"); | ||
public void createNamespace(String namespace, Map<String, String> options) { | ||
// In Dynamo DB storage, namespace will be added to table name as prefix along with dot | ||
// separator. | ||
} | ||
|
||
@Override | ||
public void createTable( |
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 think this method is too big.
The code seems to have several logical units (for each component to build), so can you make them turn to methods and call them to make this method slim?
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.
@thongdk8 Somehow it is resolved without checked but was it done (doesn't look like it though) or was it difficult/giving much benefit so not done or it was unintentionally resolved by another change?
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 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 meant, please reply back to all the comments respectively. Otherwise, it's pretty hard to identify since there are many comments.
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 see. I'll do it from now on. Sorry about that.
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! Just left some comments. Please take a look when you have time!
I found one different behavior from the original schema loader. Just in case, can you please re-check if there are any other different behaviors in this new implementation? And if you find them, please correct them. Thank you.
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
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! I left one question and some minor suggestions. Please check them when you have time!
BTW, did you re-check if there are any other different behaviors from the original schema loader in this new implementation? And was it good?
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
Thank you. I did check the behaviors, they are fine. |
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 except what I commented. Thank you!
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Toshihiro Suzuki <[email protected]>
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!
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 additional comments and suggestions.
core/src/main/java/com/scalar/db/storage/dynamo/DynamoTableMetadataManager.java
Outdated
Show resolved
Hide resolved
throw new StorageRuntimeException("creating meta data table failed"); | ||
} | ||
|
||
while (true) { |
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.
This block is redundant with the block in Admin.
(CREATING_WAITING_TIME is also redundantly defined)
It would be great if the redundancy is removed.
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.
Yes, indeed. I created a static function for waiting table creation. Applied in 391f30b
private static final String PARTITION_KEY = "concatenatedPartitionKey"; | ||
private static final String CLUSTERING_KEY = "concatenatedClusteringKey"; | ||
private static final String GLOBAL_INDEX_NAME_PREFIX = "global_index"; | ||
private static final int CREATING_WAITING_TIME = 3000; |
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 variable names are not consistent.
It is is ms
then should it end with _MS
or something to be consistent with _SEC
?
I would suggest to have the same time unit and adjust for each case like below.
CREATE_WAIT_DURATION_MILLIS
COOL_DOWN_DURATION_MILLIS
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.
Cause the cooldown time is accepted in seconds so I change variables' name with postfix _SECS
. Apply in 391f30b
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.
@thongdk8 Sorry, I missed one thing. Just left some suggestions. Please check them!
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Outdated
Show resolved
Hide resolved
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 for your patience.
.build(); | ||
} | ||
|
||
protected static void waitForTableCreation(DynamoDbClient client, String tableFullName) { |
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.
Can it be package private instead of protected
?
(Any reason for protected?)
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.
It was used in DynamoTableMetadataManager
when creating the metadata table so I made it protected
.
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.
So, it can be package-private, right?
I've checked the code and DynamoTableMetadataManager
in the same package is the only one that uses this method except for this Admin class, so please make it package-private.
Restricted scope is usually better.
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. I removed the protected
identifier 90037fd
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.
Looking good except for the comments I additionally made.
Thank you!
.build(); | ||
} | ||
|
||
protected static void waitForTableCreation(DynamoDbClient client, String tableFullName) { |
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.
So, it can be package-private, right?
I've checked the code and DynamoTableMetadataManager
in the same package is the only one that uses this method except for this Admin class, so please make it package-private.
Restricted scope is usually better.
@@ -1,22 +1,44 @@ | |||
package com.scalar.db.storage.dynamo; | |||
|
|||
import static com.scalar.db.storage.dynamo.DynamoAdmin.waitForTableCreation; |
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.
Let's not use static import for this.
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.
Updated in 90037fd
@@ -25,11 +47,14 @@ | |||
*/ |
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.
It's basically rewritten, so please put your name on it!
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.
Updated in 90037fd
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!
This PR contains the implementation of the Dynamo Admin module and tests for it.