Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions core/src/main/java/com/scalar/db/api/ReplicationAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.scalar.db.common.error.CoreError;
import com.scalar.db.exception.storage.ExecutionException;
import java.util.Collections;
import java.util.Map;

/** An administrative interface for the replication feature. */
Expand Down Expand Up @@ -31,10 +30,7 @@ default void createReplicationTables(Map<String, String> options) throws Executi
*/
default void createReplicationTables(boolean ifNotExist, Map<String, String> options)
throws ExecutionException {
if (ifNotExist && replicationTablesExist()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced confusing logics with simply throwing an exception.

return;
}
createReplicationTables(options);
throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t we revise the error message itself now that we’ve determined the license type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed it in 68751db

}

/**
Expand All @@ -48,10 +44,7 @@ default void createReplicationTables(boolean ifNotExist, Map<String, String> opt
* @throws ExecutionException if the operation fails
*/
default void createReplicationTables(boolean ifNotExist) throws ExecutionException {
if (ifNotExist && replicationTablesExist()) {
return;
}
createReplicationTables(Collections.emptyMap());
throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -60,7 +53,7 @@ default void createReplicationTables(boolean ifNotExist) throws ExecutionExcepti
* @throws ExecutionException if the operation fails
*/
default void createReplicationTables() throws ExecutionException {
createReplicationTables(Collections.emptyMap());
throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -83,10 +76,7 @@ default void dropReplicationTables() throws ExecutionException {
* @throws ExecutionException if the operation fails
*/
default void dropReplicationTables(boolean ifExist) throws ExecutionException {
if (ifExist && !replicationTablesExist()) {
return;
}
dropReplicationTables();
throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage());
}

/**
Expand Down
1 change: 1 addition & 0 deletions schema-loader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation "com.google.code.gson:gson:${gsonVersion}"
implementation "info.picocli:picocli:${picocliVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.assertj:assertj-core:${assertjVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
Expand Down
Loading