Skip to content

Commit 8fb916b

Browse files
committed
Merge remote-tracking branch 'origin/master' into db2_change_blob_type_mapping
# Conflicts: # core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitAdminIntegrationTestWithJdbcDatabase.java # core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminCaseSensitivityIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/jdbc/SingleCrudOperationTransactionAdminIntegrationTestWithJdbcDatabase.java # core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionAdminIntegrationTest.java # core/src/main/java/com/scalar/db/common/CoreError.java
2 parents b199319 + ec38d15 commit 8fb916b

File tree

59 files changed

+2946
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2946
-62
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "com.diffplug.spotless" version "6.13.0"
3-
id "org.jreleaser" version "1.19.0"
3+
id "org.jreleaser" version "1.20.0"
44
}
55

66
ext {
@@ -27,7 +27,7 @@ subprojects {
2727
guavaVersion = '32.1.3-jre'
2828
slf4jVersion = '1.7.36'
2929
cassandraDriverVersion = '3.11.5'
30-
azureCosmosVersion = '4.73.1'
30+
azureCosmosVersion = '4.74.0'
3131
jooqVersion = '3.14.16'
3232
awssdkVersion = '2.33.0'
3333
commonsDbcp2Version = '2.13.0'
@@ -38,7 +38,7 @@ subprojects {
3838
sqliteDriverVersion = '3.50.3.0'
3939
yugabyteDriverVersion = '42.7.3-yb-4'
4040
db2DriverVersion = '12.1.2.0'
41-
mariadDbDriverVersion = '3.5.5'
41+
mariadDbDriverVersion = '3.5.6'
4242
picocliVersion = '4.7.7'
4343
commonsTextVersion = '1.14.0'
4444
junitVersion = '5.13.4'
@@ -48,7 +48,7 @@ subprojects {
4848
spotbugsVersion = '4.8.6'
4949
errorproneVersion = '2.10.0'
5050
errorproneJavacVersion = '9+181-r4173-1'
51-
gsonVersion = '2.13.1'
51+
gsonVersion = '2.13.2'
5252
stefanbirknerSystemLambdaVersion = '1.2.1'
5353
spotbugsPluginVersion = '5.2.5'
5454
errorpronePluginVersion = '3.1.0'

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import com.scalar.db.api.DistributedStorageAdminCaseSensitivityIntegrationTestBase;
6+
import com.scalar.db.api.TableMetadata;
7+
import com.scalar.db.exception.storage.ExecutionException;
8+
import com.scalar.db.io.DataType;
49
import com.scalar.db.util.AdminTestUtils;
510
import java.util.Collections;
611
import java.util.Map;
712
import java.util.Properties;
13+
import org.junit.jupiter.api.Disabled;
814

915
public class CassandraAdminCaseSensitivityIntegrationTest
1016
extends DistributedStorageAdminCaseSensitivityIntegrationTestBase {
@@ -27,4 +33,47 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2733
protected boolean isTimestampTypeSupported() {
2834
return false;
2935
}
36+
37+
@Override
38+
@Disabled("Renaming non-primary key columns is not supported in Cassandra")
39+
public void renameColumn_ShouldRenameColumnCorrectly() {}
40+
41+
@Override
42+
public void renameColumn_ForIndexKeyColumn_ShouldRenameColumnAndIndexCorrectly()
43+
throws ExecutionException {
44+
try {
45+
// Arrange
46+
Map<String, String> options = getCreationOptions();
47+
TableMetadata currentTableMetadata =
48+
TableMetadata.newBuilder()
49+
.addColumn(getColumnName1(), DataType.INT)
50+
.addColumn(getColumnName2(), DataType.INT)
51+
.addColumn(getColumnName3(), DataType.TEXT)
52+
.addPartitionKey(getColumnName1())
53+
.addClusteringKey(getColumnName2())
54+
.addSecondaryIndex(getColumnName1())
55+
.build();
56+
admin.createTable(getNamespace1(), getTable4(), currentTableMetadata, options);
57+
58+
// Act
59+
admin.renameColumn(getNamespace1(), getTable4(), getColumnName1(), getColumnName4());
60+
61+
// Assert
62+
TableMetadata expectedTableMetadata =
63+
TableMetadata.newBuilder()
64+
.addColumn(getColumnName4(), DataType.INT)
65+
.addColumn(getColumnName2(), DataType.INT)
66+
.addColumn(getColumnName3(), DataType.TEXT)
67+
.addPartitionKey(getColumnName4())
68+
.addClusteringKey(getColumnName2())
69+
.addSecondaryIndex(getColumnName4())
70+
.build();
71+
assertThat(admin.getTableMetadata(getNamespace1(), getTable4()))
72+
.isEqualTo(expectedTableMetadata);
73+
assertThat(admin.indexExists(getNamespace1(), getTable4(), getColumnName1())).isFalse();
74+
assertThat(admin.indexExists(getNamespace1(), getTable4(), getColumnName4())).isTrue();
75+
} finally {
76+
admin.dropTable(getNamespace1(), getTable4(), true);
77+
}
78+
}
3079
}

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import com.scalar.db.api.DistributedStorageAdminIntegrationTestBase;
6+
import com.scalar.db.api.TableMetadata;
7+
import com.scalar.db.exception.storage.ExecutionException;
8+
import com.scalar.db.io.DataType;
49
import com.scalar.db.util.AdminTestUtils;
510
import java.util.Collections;
611
import java.util.Map;
712
import java.util.Properties;
13+
import org.junit.jupiter.api.Disabled;
814

915
public class CassandraAdminIntegrationTest extends DistributedStorageAdminIntegrationTestBase {
1016
@Override
@@ -26,4 +32,47 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2632
protected boolean isTimestampTypeSupported() {
2733
return false;
2834
}
35+
36+
@Override
37+
@Disabled("Renaming non-primary key columns is not supported in Cassandra")
38+
public void renameColumn_ShouldRenameColumnCorrectly() {}
39+
40+
@Override
41+
public void renameColumn_ForIndexKeyColumn_ShouldRenameColumnAndIndexCorrectly()
42+
throws ExecutionException {
43+
try {
44+
// Arrange
45+
Map<String, String> options = getCreationOptions();
46+
TableMetadata currentTableMetadata =
47+
TableMetadata.newBuilder()
48+
.addColumn(getColumnName1(), DataType.INT)
49+
.addColumn(getColumnName2(), DataType.INT)
50+
.addColumn(getColumnName3(), DataType.TEXT)
51+
.addPartitionKey(getColumnName1())
52+
.addClusteringKey(getColumnName2())
53+
.addSecondaryIndex(getColumnName1())
54+
.build();
55+
admin.createTable(getNamespace1(), getTable4(), currentTableMetadata, options);
56+
57+
// Act
58+
admin.renameColumn(getNamespace1(), getTable4(), getColumnName1(), getColumnName4());
59+
60+
// Assert
61+
TableMetadata expectedTableMetadata =
62+
TableMetadata.newBuilder()
63+
.addColumn(getColumnName4(), DataType.INT)
64+
.addColumn(getColumnName2(), DataType.INT)
65+
.addColumn(getColumnName3(), DataType.TEXT)
66+
.addPartitionKey(getColumnName4())
67+
.addClusteringKey(getColumnName2())
68+
.addSecondaryIndex(getColumnName4())
69+
.build();
70+
assertThat(admin.getTableMetadata(getNamespace1(), getTable4()))
71+
.isEqualTo(expectedTableMetadata);
72+
assertThat(admin.indexExists(getNamespace1(), getTable4(), getColumnName1())).isFalse();
73+
assertThat(admin.indexExists(getNamespace1(), getTable4(), getColumnName4())).isTrue();
74+
} finally {
75+
admin.dropTable(getNamespace1(), getTable4(), true);
76+
}
77+
}
2978
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.MAX_RETRY_COUNT;
44
import static com.scalar.db.storage.cassandra.CassandraPermissionTestUtils.SLEEP_BETWEEN_RETRIES_SECONDS;
5+
import static org.assertj.core.api.Assertions.assertThatCode;
56

67
import com.google.common.util.concurrent.Uninterruptibles;
78
import com.scalar.db.api.DistributedStorageAdminPermissionIntegrationTestBase;
9+
import com.scalar.db.exception.storage.ExecutionException;
810
import com.scalar.db.util.AdminTestUtils;
911
import com.scalar.db.util.PermissionTestUtils;
1012
import java.util.Collections;
@@ -138,4 +140,17 @@ public void addRawColumnToTable_WithSufficientPermission_ShouldSucceed() {}
138140
@Override
139141
@Disabled("Import-related functionality is not supported in Cassandra")
140142
public void importTable_WithSufficientPermission_ShouldSucceed() {}
143+
144+
@Test
145+
@Override
146+
public void renameColumn_WithSufficientPermission_ShouldSucceed() throws ExecutionException {
147+
// Arrange
148+
createNamespaceByRoot();
149+
createTableByRoot();
150+
151+
// Act Assert
152+
// Cassandra does not support renaming non-primary key columns
153+
assertThatCode(() -> adminForNormalUser.renameColumn(NAMESPACE, TABLE, COL_NAME1, NEW_COL_NAME))
154+
.doesNotThrowAnyException();
155+
}
141156
}

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import com.scalar.db.api.TableMetadata;
6+
import com.scalar.db.exception.storage.ExecutionException;
7+
import com.scalar.db.io.DataType;
38
import com.scalar.db.transaction.consensuscommit.ConsensusCommitAdminIntegrationTestBase;
49
import com.scalar.db.util.AdminTestUtils;
510
import java.util.Collections;
611
import java.util.Map;
712
import java.util.Properties;
13+
import org.junit.jupiter.api.Disabled;
814

915
public class ConsensusCommitAdminIntegrationTestWithCassandra
1016
extends ConsensusCommitAdminIntegrationTestBase {
@@ -27,4 +33,46 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2733
protected boolean isTimestampTypeSupported() {
2834
return false;
2935
}
36+
37+
@Override
38+
@Disabled("Renaming non-primary key columns is not supported in Cassandra")
39+
public void renameColumn_ShouldRenameColumnCorrectly() {}
40+
41+
@Override
42+
public void renameColumn_ForIndexKeyColumn_ShouldRenameColumnAndIndexCorrectly()
43+
throws ExecutionException {
44+
try {
45+
// Arrange
46+
Map<String, String> options = getCreationOptions();
47+
TableMetadata currentTableMetadata =
48+
TableMetadata.newBuilder()
49+
.addColumn("c1", DataType.INT)
50+
.addColumn("c2", DataType.INT)
51+
.addColumn("c3", DataType.TEXT)
52+
.addPartitionKey("c1")
53+
.addClusteringKey("c2")
54+
.addSecondaryIndex("c1")
55+
.build();
56+
admin.createTable(namespace1, TABLE4, currentTableMetadata, options);
57+
58+
// Act
59+
admin.renameColumn(namespace1, TABLE4, "c1", "c4");
60+
61+
// Assert
62+
TableMetadata expectedTableMetadata =
63+
TableMetadata.newBuilder()
64+
.addColumn("c4", DataType.INT)
65+
.addColumn("c2", DataType.INT)
66+
.addColumn("c3", DataType.TEXT)
67+
.addPartitionKey("c4")
68+
.addClusteringKey("c2")
69+
.addSecondaryIndex("c4")
70+
.build();
71+
assertThat(admin.getTableMetadata(namespace1, TABLE4)).isEqualTo(expectedTableMetadata);
72+
assertThat(admin.indexExists(namespace1, TABLE4, "c1")).isFalse();
73+
assertThat(admin.indexExists(namespace1, TABLE4, "c4")).isTrue();
74+
} finally {
75+
admin.dropTable(namespace1, TABLE4, true);
76+
}
77+
}
3078
}

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
package com.scalar.db.storage.cassandra;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import com.scalar.db.api.TableMetadata;
6+
import com.scalar.db.exception.storage.ExecutionException;
7+
import com.scalar.db.io.DataType;
38
import com.scalar.db.transaction.singlecrudoperation.SingleCrudOperationTransactionAdminIntegrationTestBase;
49
import java.util.Collections;
510
import java.util.Map;
611
import java.util.Properties;
12+
import org.junit.jupiter.api.Disabled;
713

814
public class SingleCrudOperationTransactionAdminIntegrationTestWithCassandra
915
extends SingleCrudOperationTransactionAdminIntegrationTestBase {
@@ -22,4 +28,46 @@ protected Map<String, String> getCreationOptions() {
2228
protected boolean isTimestampTypeSupported() {
2329
return false;
2430
}
31+
32+
@Override
33+
@Disabled("Renaming non-primary key columns is not supported in Cassandra")
34+
public void renameColumn_ShouldRenameColumnCorrectly() {}
35+
36+
@Override
37+
public void renameColumn_ForIndexKeyColumn_ShouldRenameColumnAndIndexCorrectly()
38+
throws ExecutionException {
39+
try {
40+
// Arrange
41+
Map<String, String> options = getCreationOptions();
42+
TableMetadata currentTableMetadata =
43+
TableMetadata.newBuilder()
44+
.addColumn("c1", DataType.INT)
45+
.addColumn("c2", DataType.INT)
46+
.addColumn("c3", DataType.TEXT)
47+
.addPartitionKey("c1")
48+
.addClusteringKey("c2")
49+
.addSecondaryIndex("c1")
50+
.build();
51+
admin.createTable(namespace1, TABLE4, currentTableMetadata, options);
52+
53+
// Act
54+
admin.renameColumn(namespace1, TABLE4, "c1", "c4");
55+
56+
// Assert
57+
TableMetadata expectedTableMetadata =
58+
TableMetadata.newBuilder()
59+
.addColumn("c4", DataType.INT)
60+
.addColumn("c2", DataType.INT)
61+
.addColumn("c3", DataType.TEXT)
62+
.addPartitionKey("c4")
63+
.addClusteringKey("c2")
64+
.addSecondaryIndex("c4")
65+
.build();
66+
assertThat(admin.getTableMetadata(namespace1, TABLE4)).isEqualTo(expectedTableMetadata);
67+
assertThat(admin.indexExists(namespace1, TABLE4, "c1")).isFalse();
68+
assertThat(admin.indexExists(namespace1, TABLE4, "c4")).isTrue();
69+
} finally {
70+
admin.dropTable(namespace1, TABLE4, true);
71+
}
72+
}
2573
}

core/src/integration-test/java/com/scalar/db/storage/cosmos/ConsensusCommitAdminIntegrationTestWithCosmos.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.scalar.db.util.AdminTestUtils;
55
import java.util.Map;
66
import java.util.Properties;
7+
import org.junit.jupiter.api.Disabled;
78

89
public class ConsensusCommitAdminIntegrationTestWithCosmos
910
extends ConsensusCommitAdminIntegrationTestBase {
@@ -22,4 +23,48 @@ protected Map<String, String> getCreationOptions() {
2223
protected AdminTestUtils getAdminTestUtils(String testName) {
2324
return new CosmosAdminTestUtils(getProperties(testName));
2425
}
26+
27+
@Override
28+
@Disabled("Cosmos DB does not support dropping columns")
29+
public void dropColumnFromTable_DropColumnForEachExistingDataType_ShouldDropColumnsCorrectly() {}
30+
31+
@Override
32+
@Disabled("Cosmos DB does not support dropping columns")
33+
public void dropColumnFromTable_ForNonExistingTable_ShouldThrowIllegalArgumentException() {}
34+
35+
@Override
36+
@Disabled("Cosmos DB does not support dropping columns")
37+
public void dropColumnFromTable_ForNonExistingColumn_ShouldThrowIllegalArgumentException() {}
38+
39+
@Override
40+
@Disabled("Cosmos DB does not support dropping columns")
41+
public void dropColumnFromTable_ForPrimaryKeyColumn_ShouldThrowIllegalArgumentException() {}
42+
43+
@Override
44+
@Disabled("Cosmos DB does not support dropping columns")
45+
public void dropColumnFromTable_ForIndexedColumn_ShouldDropColumnAndIndexCorrectly() {}
46+
47+
@Override
48+
@Disabled("Cosmos DB does not support dropping columns")
49+
public void dropColumnFromTable_IfNotExists_ForNonExistingColumn_ShouldNotThrowAnyException() {}
50+
51+
@Override
52+
@Disabled("Cosmos DB does not support renaming columns")
53+
public void renameColumn_ShouldRenameColumnCorrectly() {}
54+
55+
@Override
56+
@Disabled("Cosmos DB does not support renaming columns")
57+
public void renameColumn_ForNonExistingTable_ShouldThrowIllegalArgumentException() {}
58+
59+
@Override
60+
@Disabled("Cosmos DB does not support renaming columns")
61+
public void renameColumn_ForNonExistingColumn_ShouldThrowIllegalArgumentException() {}
62+
63+
@Override
64+
@Disabled("Cosmos DB does not support renaming columns")
65+
public void renameColumn_ForPrimaryKeyColumn_ShouldRenameColumnCorrectly() {}
66+
67+
@Override
68+
@Disabled("Cosmos DB does not support renaming columns")
69+
public void renameColumn_ForIndexKeyColumn_ShouldRenameColumnAndIndexCorrectly() {}
2570
}

0 commit comments

Comments
 (0)