Skip to content

Commit aac0d47

Browse files
authored
Revisit importTable() in Consensus Commit (#3102)
1 parent af08d73 commit aac0d47

File tree

25 files changed

+100
-478
lines changed

25 files changed

+100
-478
lines changed

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraAdminPermissionIntegrationTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,6 @@ protected void waitForTableDeletion() {
126126
}
127127
}
128128

129-
@Test
130-
@Override
131-
@Disabled("Import-related functionality is not supported in Cassandra")
132-
public void getImportTableMetadata_WithSufficientPermission_ShouldSucceed() {}
133-
134-
@Test
135-
@Override
136-
@Disabled("Import-related functionality is not supported in Cassandra")
137-
public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed() {}
138-
139129
@Test
140130
@Override
141131
@Disabled("Import-related functionality is not supported in Cassandra")

core/src/integration-test/java/com/scalar/db/storage/dynamo/DynamoAdminPermissionIntegrationTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ protected void sleepBetweenTests() {
4545
Uninterruptibles.sleepUninterruptibly(SLEEP_BETWEEN_TESTS_SECONDS, TimeUnit.SECONDS);
4646
}
4747

48-
@Test
49-
@Override
50-
@Disabled("Import-related functionality is not supported in DynamoDB")
51-
public void getImportTableMetadata_WithSufficientPermission_ShouldSucceed() {}
52-
53-
@Test
54-
@Override
55-
@Disabled("Import-related functionality is not supported in DynamoDB")
56-
public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed() {}
57-
5848
@Test
5949
@Override
6050
@Disabled("Import-related functionality is not supported in DynamoDB")

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcSchemaLoaderImportIntegrationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.Map;
1111
import java.util.Properties;
1212
import java.util.concurrent.TimeUnit;
13+
import org.junit.jupiter.api.AfterAll;
1314
import org.junit.jupiter.api.Test;
1415
import org.junit.jupiter.api.condition.DisabledIf;
1516
import org.slf4j.Logger;
@@ -191,6 +192,7 @@ public void importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldI
191192
super.importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldImportProperly();
192193
}
193194

195+
@AfterAll
194196
@Override
195197
public void afterAll() {
196198
try {

core/src/main/java/com/scalar/db/api/DistributedStorageAdmin.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.scalar.db.api;
22

33
import com.scalar.db.exception.storage.ExecutionException;
4-
import com.scalar.db.io.DataType;
5-
import java.util.Collections;
6-
import java.util.Map;
74

85
/**
96
* An administrative interface for distributed storage implementations. The user can execute
@@ -44,50 +41,6 @@
4441
*/
4542
public interface DistributedStorageAdmin extends Admin, AutoCloseable {
4643

47-
/**
48-
* Get import table metadata in the ScalarDB format.
49-
*
50-
* @param namespace namespace name of import table
51-
* @param table import table name
52-
* @throws IllegalArgumentException if the table does not exist
53-
* @throws IllegalStateException if the table does not meet the requirement of ScalarDB table
54-
* @throws ExecutionException if the operation fails
55-
* @return import table metadata in the ScalarDB format
56-
*/
57-
default TableMetadata getImportTableMetadata(String namespace, String table)
58-
throws ExecutionException {
59-
return getImportTableMetadata(namespace, table, Collections.emptyMap());
60-
}
61-
62-
/**
63-
* Get import table metadata in the ScalarDB format.
64-
*
65-
* @param namespace namespace name of import table
66-
* @param table import table name
67-
* @param overrideColumnsType a map of column data type by column name. Only set the column for
68-
* which you want to override the default data type mapping.
69-
* @throws IllegalArgumentException if the table does not exist
70-
* @throws IllegalStateException if the table does not meet the requirement of ScalarDB table
71-
* @throws ExecutionException if the operation fails
72-
* @return import table metadata in the ScalarDB format
73-
*/
74-
TableMetadata getImportTableMetadata(
75-
String namespace, String table, Map<String, DataType> overrideColumnsType)
76-
throws ExecutionException;
77-
78-
/**
79-
* Add a column in the table without updating the metadata table in ScalarDB.
80-
*
81-
* @param namespace namespace name of import table
82-
* @param table import table name
83-
* @param columnName name of the column to be added
84-
* @param columnType type of the column to be added
85-
* @throws IllegalArgumentException if the table does not exist
86-
* @throws ExecutionException if the operation fails
87-
*/
88-
void addRawColumnToTable(String namespace, String table, String columnName, DataType columnType)
89-
throws ExecutionException;
90-
9144
/**
9245
* Returns the storage information.
9346
*

core/src/main/java/com/scalar/db/common/CommonDistributedStorageAdmin.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -451,20 +451,6 @@ public Set<String> getNamespaceNames() throws ExecutionException {
451451
}
452452
}
453453

454-
@Override
455-
public TableMetadata getImportTableMetadata(
456-
String namespace, String table, Map<String, DataType> overrideColumnsType)
457-
throws ExecutionException {
458-
try {
459-
return admin.getImportTableMetadata(namespace, table, overrideColumnsType);
460-
} catch (ExecutionException e) {
461-
throw new ExecutionException(
462-
CoreError.GETTING_IMPORT_TABLE_METADATA_FAILED.buildMessage(
463-
ScalarDbUtils.getFullTableName(namespace, table)),
464-
e);
465-
}
466-
}
467-
468454
@Override
469455
public void importTable(
470456
String namespace,
@@ -489,20 +475,6 @@ public void importTable(
489475
}
490476
}
491477

492-
@Override
493-
public void addRawColumnToTable(
494-
String namespace, String table, String columnName, DataType columnType)
495-
throws ExecutionException {
496-
try {
497-
admin.addRawColumnToTable(namespace, table, columnName, columnType);
498-
} catch (ExecutionException e) {
499-
throw new ExecutionException(
500-
CoreError.ADDING_RAW_COLUMN_TO_TABLE_FAILED.buildMessage(
501-
ScalarDbUtils.getFullTableName(namespace, table), columnName, columnType),
502-
e);
503-
}
504-
}
505-
506478
@Override
507479
public void upgrade(Map<String, String> options) throws ExecutionException {
508480
try {

core/src/main/java/com/scalar/db/common/CoreError.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,16 @@ public enum CoreError implements ScalarDbError {
377377
""),
378378
MULTI_STORAGE_STORAGE_NOT_FOUND(
379379
Category.USER_ERROR, "0084", "Storage not found. Storage: %s", "", ""),
380-
JDBC_NAMESPACE_NAME_NOT_ACCEPTABLE(
381-
Category.USER_ERROR, "0085", "The namespace name is not acceptable. Namespace: %s", "", ""),
382-
JDBC_TABLE_NAME_NOT_ACCEPTABLE(
383-
Category.USER_ERROR, "0086", "The table name is not acceptable. Table: %s", "", ""),
384-
JDBC_IMPORT_NOT_SUPPORTED(
380+
JDBC_SQLITE_NAMESPACE_NAME_NOT_ACCEPTABLE(
385381
Category.USER_ERROR,
386-
"0087",
387-
"Importing tables is not allowed in the RDB engine. RDB engine: %s",
382+
"0085",
383+
"The namespace name is not acceptable in SQLite. Namespace: %s",
388384
"",
389385
""),
386+
JDBC_SQLITE_TABLE_NAME_NOT_ACCEPTABLE(
387+
Category.USER_ERROR, "0086", "The table name is not acceptable in SQLite. Table: %s", "", ""),
388+
JDBC_SQLITE_IMPORT_NOT_SUPPORTED(
389+
Category.USER_ERROR, "0087", "Importing tables is not allowed in SQLite", "", ""),
390390
JDBC_IMPORT_TABLE_WITHOUT_PRIMARY_KEY(
391391
Category.USER_ERROR, "0088", "The %s table must have a primary key", "", ""),
392392
JDBC_RDB_ENGINE_NOT_SUPPORTED(

core/src/main/java/com/scalar/db/service/AdminService.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
120120
admin.renameTable(namespace, oldTableName, newTableName);
121121
}
122122

123-
@Override
124-
public TableMetadata getImportTableMetadata(
125-
String namespace, String table, Map<String, DataType> overrideColumnsType)
126-
throws ExecutionException {
127-
return admin.getImportTableMetadata(namespace, table, overrideColumnsType);
128-
}
129-
130-
@Override
131-
public void addRawColumnToTable(
132-
String namespace, String table, String columnName, DataType columnType)
133-
throws ExecutionException {
134-
admin.addRawColumnToTable(namespace, table, columnName, columnType);
135-
}
136-
137123
@Override
138124
public void importTable(
139125
String namespace,

core/src/main/java/com/scalar/db/storage/cassandra/CassandraAdmin.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,6 @@ private TableMetadata createTableMetadata(com.datastax.driver.core.TableMetadata
285285
return builder.build();
286286
}
287287

288-
@Override
289-
public TableMetadata getImportTableMetadata(
290-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
291-
throw new UnsupportedOperationException(
292-
CoreError.CASSANDRA_IMPORT_NOT_SUPPORTED.buildMessage());
293-
}
294-
295-
@Override
296-
public void addRawColumnToTable(
297-
String namespace, String table, String columnName, DataType columnType) {
298-
throw new UnsupportedOperationException(
299-
CoreError.CASSANDRA_IMPORT_NOT_SUPPORTED.buildMessage());
300-
}
301-
302288
@Override
303289
public void importTable(
304290
String namespace,

core/src/main/java/com/scalar/db/storage/cosmos/CosmosAdmin.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -682,18 +682,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
682682
CoreError.COSMOS_RENAME_TABLE_NOT_SUPPORTED.buildMessage());
683683
}
684684

685-
@Override
686-
public TableMetadata getImportTableMetadata(
687-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
688-
throw new UnsupportedOperationException(CoreError.COSMOS_IMPORT_NOT_SUPPORTED.buildMessage());
689-
}
690-
691-
@Override
692-
public void addRawColumnToTable(
693-
String namespace, String table, String columnName, DataType columnType) {
694-
throw new UnsupportedOperationException(CoreError.COSMOS_IMPORT_NOT_SUPPORTED.buildMessage());
695-
}
696-
697685
@Override
698686
public void importTable(
699687
String namespace,

core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,18 +1466,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
14661466
CoreError.DYNAMO_RENAME_TABLE_NOT_SUPPORTED.buildMessage());
14671467
}
14681468

1469-
@Override
1470-
public TableMetadata getImportTableMetadata(
1471-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
1472-
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
1473-
}
1474-
1475-
@Override
1476-
public void addRawColumnToTable(
1477-
String namespace, String table, String columnName, DataType columnType) {
1478-
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
1479-
}
1480-
14811469
@Override
14821470
public void importTable(
14831471
String namespace,

0 commit comments

Comments
 (0)