Skip to content

Commit fcd6662

Browse files
Backport to branch(3) : Revisit importTable() in Consensus Commit (#3114)
Co-authored-by: Toshihiro Suzuki <[email protected]>
1 parent 90efedc commit fcd6662

25 files changed

+129
-535
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
@@ -11,6 +11,7 @@
1111
import java.util.Map;
1212
import java.util.Properties;
1313
import java.util.concurrent.TimeUnit;
14+
import org.junit.jupiter.api.AfterAll;
1415
import org.junit.jupiter.api.Test;
1516
import org.junit.jupiter.api.condition.DisabledIf;
1617
import org.slf4j.Logger;
@@ -202,6 +203,7 @@ public void importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldI
202203
super.importTables_ImportableTablesAndNonRelatedSameNameTableGiven_ShouldImportProperly();
203204
}
204205

206+
@AfterAll
205207
@Override
206208
public void afterAll() {
207209
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
@@ -424,20 +424,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
424424
}
425425
}
426426

427-
@Override
428-
public TableMetadata getImportTableMetadata(
429-
String namespace, String table, Map<String, DataType> overrideColumnsType)
430-
throws ExecutionException {
431-
try {
432-
return admin.getImportTableMetadata(namespace, table, overrideColumnsType);
433-
} catch (ExecutionException e) {
434-
throw new ExecutionException(
435-
CoreError.GETTING_IMPORT_TABLE_METADATA_FAILED.buildMessage(
436-
ScalarDbUtils.getFullTableName(namespace, table)),
437-
e);
438-
}
439-
}
440-
441427
@Override
442428
public void importTable(
443429
String namespace,
@@ -462,20 +448,6 @@ public void importTable(
462448
}
463449
}
464450

465-
@Override
466-
public void addRawColumnToTable(
467-
String namespace, String table, String columnName, DataType columnType)
468-
throws ExecutionException {
469-
try {
470-
admin.addRawColumnToTable(namespace, table, columnName, columnType);
471-
} catch (ExecutionException e) {
472-
throw new ExecutionException(
473-
CoreError.ADDING_RAW_COLUMN_TO_TABLE_FAILED.buildMessage(
474-
ScalarDbUtils.getFullTableName(namespace, table), columnName, columnType),
475-
e);
476-
}
477-
}
478-
479451
@Override
480452
public Set<String> getNamespaceNames() throws ExecutionException {
481453
logger.warn(

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
@@ -232,20 +232,6 @@ private TableMetadata createTableMetadata(com.datastax.driver.core.TableMetadata
232232
return builder.build();
233233
}
234234

235-
@Override
236-
public TableMetadata getImportTableMetadata(
237-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
238-
throw new UnsupportedOperationException(
239-
CoreError.CASSANDRA_IMPORT_NOT_SUPPORTED.buildMessage());
240-
}
241-
242-
@Override
243-
public void addRawColumnToTable(
244-
String namespace, String table, String columnName, DataType columnType) {
245-
throw new UnsupportedOperationException(
246-
CoreError.CASSANDRA_IMPORT_NOT_SUPPORTED.buildMessage());
247-
}
248-
249235
@Override
250236
public void importTable(
251237
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
@@ -614,18 +614,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
614614
CoreError.COSMOS_RENAME_TABLE_NOT_SUPPORTED.buildMessage());
615615
}
616616

617-
@Override
618-
public TableMetadata getImportTableMetadata(
619-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
620-
throw new UnsupportedOperationException(CoreError.COSMOS_IMPORT_NOT_SUPPORTED.buildMessage());
621-
}
622-
623-
@Override
624-
public void addRawColumnToTable(
625-
String namespace, String table, String columnName, DataType columnType) {
626-
throw new UnsupportedOperationException(CoreError.COSMOS_IMPORT_NOT_SUPPORTED.buildMessage());
627-
}
628-
629617
@Override
630618
public void importTable(
631619
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
@@ -1265,18 +1265,6 @@ public void renameTable(String namespace, String oldTableName, String newTableNa
12651265
CoreError.DYNAMO_RENAME_TABLE_NOT_SUPPORTED.buildMessage());
12661266
}
12671267

1268-
@Override
1269-
public TableMetadata getImportTableMetadata(
1270-
String namespace, String table, Map<String, DataType> overrideColumnsType) {
1271-
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
1272-
}
1273-
1274-
@Override
1275-
public void addRawColumnToTable(
1276-
String namespace, String table, String columnName, DataType columnType) {
1277-
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
1278-
}
1279-
12801268
@Override
12811269
public void importTable(
12821270
String namespace,

0 commit comments

Comments
 (0)