Skip to content

Commit

Permalink
revise
Browse files Browse the repository at this point in the history
  • Loading branch information
thongdk8 committed Sep 16, 2021
1 parent 1d82dc8 commit 90037fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
import software.amazon.awssdk.services.dynamodb.model.TableStatus;
import software.amazon.awssdk.services.dynamodb.model.UpdateContinuousBackupsRequest;

/**
* Manages table creating, dropping and truncating in Dynamo DB
*
* @author Pham Ba Thong
*/
@ThreadSafe
public class DynamoAdmin implements DistributedStorageAdmin {
private static final Logger LOGGER = LoggerFactory.getLogger(DynamoAdmin.class);
Expand Down Expand Up @@ -603,7 +608,7 @@ private DeleteScalingPolicyRequest buildDeleteScalingPolicyRequest(
.build();
}

protected static void waitForTableCreation(DynamoDbClient client, String tableFullName) {
static void waitForTableCreation(DynamoDbClient client, String tableFullName) {
while (true) {
Uninterruptibles.sleepUninterruptibly(CREATE_WAIT_DURATION_SECS, TimeUnit.SECONDS);
DescribeTableRequest describeTableRequest =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalar.db.storage.dynamo;

import static com.scalar.db.storage.dynamo.DynamoAdmin.waitForTableCreation;
import static com.scalar.db.util.Utility.getFullNamespaceName;
import static com.scalar.db.util.Utility.getFullTableName;

Expand Down Expand Up @@ -43,7 +42,7 @@
/**
* A manager to read and cache {@link TableMetadata} to know the type of each column
*
* @author Yuji Ito
* @author Yuji Ito, Pham Ba Thong
*/
@ThreadSafe
public class DynamoTableMetadataManager implements TableMetadataManager {
Expand Down Expand Up @@ -289,7 +288,7 @@ private void createMetadataTableIfNotExist() throws StorageRuntimeException {
}

try {
waitForTableCreation(
DynamoAdmin.waitForTableCreation(
client, getFullTableName(namespacePrefix, METADATA_NAMESPACE, METADATA_TABLE));
} catch (DynamoDbException e) {
throw new StorageRuntimeException("getting table description failed", e);
Expand Down

0 comments on commit 90037fd

Please sign in to comment.