Skip to content

Commit ba20b01

Browse files
authored
Add support for data manipulation operations in Blob Storage adapter (#3124)
1 parent acfb238 commit ba20b01

File tree

63 files changed

+7109
-59
lines changed

Some content is hidden

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

63 files changed

+7109
-59
lines changed

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ConsensusCommitAdminIntegrationTestWithObjectStorage.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2727
return new ObjectStorageAdminTestUtils(getProperties(testName));
2828
}
2929

30-
@Override
31-
@Disabled("Temporarily disabled because it includes DML operations")
32-
public void truncateTable_ShouldTruncateProperly() {}
33-
3430
@Override
3531
@Disabled("Object Storage does not support index-related operations")
3632
public void createIndex_ForAllDataTypesWithExistingData_ShouldCreateIndexesCorrectly() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitConfig;
4+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitCrossPartitionScanIntegrationTestBase;
5+
import java.util.Properties;
6+
import org.junit.jupiter.api.Disabled;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class ConsensusCommitCrossPartitionScanIntegrationTestWithObjectStorage
10+
extends ConsensusCommitCrossPartitionScanIntegrationTestBase {
11+
12+
@Override
13+
protected Properties getProps(String testName) {
14+
Properties properties = ConsensusCommitObjectStorageEnv.getProperties(testName);
15+
properties.setProperty(ConsensusCommitConfig.ISOLATION_LEVEL, "SERIALIZABLE");
16+
return properties;
17+
}
18+
19+
@Test
20+
@Override
21+
@Disabled("Cross-partition scan with ordering is not supported in Object Storage")
22+
public void scan_CrossPartitionScanWithOrderingGivenForCommittedRecord_ShouldReturnRecords() {}
23+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.api.TableMetadata;
4+
import com.scalar.db.io.DataType;
5+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitIntegrationTestBase;
6+
import java.util.Properties;
7+
import org.junit.jupiter.api.Disabled;
8+
9+
public class ConsensusCommitIntegrationTestWithObjectStorage
10+
extends ConsensusCommitIntegrationTestBase {
11+
12+
@Override
13+
protected TableMetadata getTableMetadata() {
14+
return TableMetadata.newBuilder()
15+
.addColumn(ACCOUNT_ID, DataType.INT)
16+
.addColumn(ACCOUNT_TYPE, DataType.INT)
17+
.addColumn(BALANCE, DataType.INT)
18+
.addColumn(SOME_COLUMN, DataType.INT)
19+
.addColumn(BOOLEAN_COL, DataType.BOOLEAN)
20+
.addColumn(BIGINT_COL, DataType.BIGINT)
21+
.addColumn(FLOAT_COL, DataType.FLOAT)
22+
.addColumn(DOUBLE_COL, DataType.DOUBLE)
23+
.addColumn(TEXT_COL, DataType.TEXT)
24+
.addColumn(BLOB_COL, DataType.BLOB)
25+
.addColumn(DATE_COL, DataType.DATE)
26+
.addColumn(TIME_COL, DataType.TIME)
27+
.addColumn(TIMESTAMPTZ_COL, DataType.TIMESTAMPTZ)
28+
.addColumn(TIMESTAMP_COL, DataType.TIMESTAMP)
29+
.addPartitionKey(ACCOUNT_ID)
30+
.addClusteringKey(ACCOUNT_TYPE)
31+
.build();
32+
}
33+
34+
@Override
35+
protected Properties getProps(String testName) {
36+
return ConsensusCommitObjectStorageEnv.getProperties(testName);
37+
}
38+
39+
@Override
40+
@Disabled("Object Storage does not support index-related operations")
41+
public void get_GetGivenForIndexColumn_ShouldReturnRecords() {}
42+
43+
@Override
44+
@Disabled("Object Storage does not support index-related operations")
45+
public void scanOrGetScanner_ScanGivenForIndexColumn_ShouldReturnRecords(ScanType scanType) {}
46+
47+
@Override
48+
@Disabled("Object Storage does not support index-related operations")
49+
public void scanOrGetScanner_ScanGivenForIndexColumnWithConjunctions_ShouldReturnRecords(
50+
ScanType scanType) {}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitNullMetadataIntegrationTestBase;
4+
import java.util.Properties;
5+
6+
public class ConsensusCommitNullMetadataIntegrationTestWithObjectStorage
7+
extends ConsensusCommitNullMetadataIntegrationTestBase {
8+
9+
@Override
10+
protected Properties getProperties(String testName) {
11+
return ConsensusCommitObjectStorageEnv.getProperties(testName);
12+
}
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitTestUtils;
4+
import java.util.Map;
5+
import java.util.Properties;
6+
7+
public class ConsensusCommitObjectStorageEnv {
8+
private ConsensusCommitObjectStorageEnv() {}
9+
10+
public static Properties getProperties(String testName) {
11+
Properties properties = ObjectStorageEnv.getProperties(testName);
12+
13+
// Add testName as a coordinator schema suffix
14+
ConsensusCommitTestUtils.addSuffixToCoordinatorNamespace(properties, testName);
15+
16+
return ConsensusCommitTestUtils.loadConsensusCommitProperties(properties);
17+
}
18+
19+
public static Map<String, String> getCreationOptions() {
20+
return ObjectStorageEnv.getCreationOptions();
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.api.TableMetadata;
4+
import com.scalar.db.io.DataType;
5+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitSpecificIntegrationTestBase;
6+
import com.scalar.db.transaction.consensuscommit.Isolation;
7+
import java.util.Properties;
8+
import org.junit.jupiter.api.Disabled;
9+
10+
public class ConsensusCommitSpecificIntegrationTestWithObjectStorage
11+
extends ConsensusCommitSpecificIntegrationTestBase {
12+
13+
@Override
14+
protected TableMetadata getTableMetadata() {
15+
return TableMetadata.newBuilder()
16+
.addColumn(ACCOUNT_ID, DataType.INT)
17+
.addColumn(ACCOUNT_TYPE, DataType.INT)
18+
.addColumn(BALANCE, DataType.INT)
19+
.addColumn(SOME_COLUMN, DataType.TEXT)
20+
.addPartitionKey(ACCOUNT_ID)
21+
.addClusteringKey(ACCOUNT_TYPE)
22+
.build();
23+
}
24+
25+
@Override
26+
protected Properties getProperties(String testName) {
27+
return ConsensusCommitObjectStorageEnv.getProperties(testName);
28+
}
29+
30+
@Override
31+
@Disabled("Object Storage does not support index-related operations")
32+
public void
33+
scanWithIndex_PutWithOverlappedIndexKeyAndNonOverlappedConjunctionsGivenBefore_ShouldScan(
34+
Isolation isolation) {}
35+
36+
@Override
37+
@Disabled("Object Storage does not support index-related operations")
38+
public void
39+
scanWithIndex_OverlappingPutWithNonIndexedColumnGivenBefore_ShouldThrowIllegalArgumentException(
40+
Isolation isolation) {}
41+
42+
@Override
43+
@Disabled("Object Storage does not support index-related operations")
44+
public void
45+
scanWithIndex_NonOverlappingPutWithIndexedColumnGivenBefore_ShouldThrowIllegalArgumentException(
46+
Isolation isolation) {}
47+
48+
@Override
49+
@Disabled("Object Storage does not support index-related operations")
50+
public void
51+
scanWithIndex_OverlappingPutWithIndexedColumnGivenBefore_ShouldThrowIllegalArgumentException(
52+
Isolation isolation) {}
53+
54+
@Override
55+
@Disabled("Object Storage does not support index-related operations")
56+
public void
57+
scanWithIndex_OverlappingPutWithIndexedColumnAndConjunctionsGivenBefore_ShouldThrowIllegalArgumentException(
58+
Isolation isolation) {}
59+
60+
@Override
61+
@Disabled("Object Storage does not support index-related operations")
62+
public void scan_ScanWithIndexGiven_WithSerializable_ShouldNotThrowAnyException() {}
63+
64+
@Override
65+
@Disabled("Object Storage does not support index-related operations")
66+
public void
67+
scan_ScanWithIndexGiven_RecordUpdatedByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
68+
69+
@Override
70+
@Disabled("Object Storage does not support index-related operations")
71+
public void
72+
scan_ScanWithIndexGiven_RecordUpdatedByMyself_WithSerializable_ShouldNotThrowAnyException() {}
73+
74+
@Override
75+
@Disabled("Object Storage does not support index-related operations")
76+
public void
77+
scan_ScanWithIndexGiven_RecordDeletedByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
78+
79+
@Override
80+
@Disabled("Object Storage does not support index-related operations")
81+
public void
82+
scan_ScanWithIndexGiven_RecordDeletedByMyself_WithSerializable_ShouldNotThrowAnyException() {}
83+
84+
@Override
85+
@Disabled("Object Storage does not support index-related operations")
86+
public void scan_ScanWithIndexWithLimitGiven_WithSerializable_ShouldNotThrowAnyException() {}
87+
88+
@Override
89+
@Disabled("Object Storage does not support index-related operations")
90+
public void get_GetWithIndexGiven_WithSerializable_ShouldNotThrowAnyException() {}
91+
92+
@Override
93+
@Disabled("Object Storage does not support index-related operations")
94+
public void
95+
get_GetWithIndexGiven_RecordUpdatedByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
96+
97+
@Override
98+
@Disabled("Object Storage does not support index-related operations")
99+
public void
100+
get_GetWithIndexGiven_RecordUpdatedByMyself_WithSerializable_ShouldNotThrowAnyException() {}
101+
102+
@Override
103+
@Disabled("Object Storage does not support index-related operations")
104+
public void
105+
get_GetWithIndexGiven_RecordDeletedByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
106+
107+
@Override
108+
@Disabled("Object Storage does not support index-related operations")
109+
public void
110+
get_GetWithIndexGiven_RecordDeletedByMyself_WithSerializable_ShouldNotThrowAnyException() {}
111+
112+
@Override
113+
@Disabled("Object Storage does not support index-related operations")
114+
public void
115+
get_GetWithIndexGiven_NoRecordsInIndexRange_WithSerializable_ShouldNotThrowAnyException() {}
116+
117+
@Override
118+
@Disabled("Object Storage does not support index-related operations")
119+
public void
120+
get_GetWithIndexGiven_RecordInsertedIntoIndexRangeByMyself_WithSerializable_ShouldNotThrowAnyException() {}
121+
122+
@Override
123+
@Disabled("Object Storage does not support index-related operations")
124+
public void
125+
get_GetWithIndexGiven_RecordInsertedIntoIndexRangeByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
126+
127+
@Override
128+
@Disabled("Object Storage does not support index-related operations")
129+
public void
130+
get_GetWithIndexGiven_NoRecordsInIndexRange_RecordInsertedIntoIndexRangeByMyself_WithSerializable_ShouldNotThrowAnyException() {}
131+
132+
@Override
133+
@Disabled("Object Storage does not support index-related operations")
134+
public void
135+
get_GetWithIndexGiven_NoRecordsInIndexRange_RecordInsertedIntoIndexRangeByAnotherTransaction_WithSerializable_ShouldThrowCommitConflictException() {}
136+
137+
@Override
138+
@Disabled("Object Storage does not support index-related operations")
139+
public void getAndUpdate_GetWithIndexGiven_ShouldUpdate(Isolation isolation) {}
140+
141+
@Override
142+
@Disabled("Object Storage does not support index-related operations")
143+
public void scanAndUpdate_ScanWithIndexGiven_ShouldUpdate(Isolation isolation) {}
144+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.transaction.consensuscommit.ConsensusCommitWithIncludeMetadataEnabledIntegrationTestBase;
4+
import java.util.Properties;
5+
6+
public class ConsensusCommitWithIncludeMetadataEnabledIntegrationTestWithObjectStorage
7+
extends ConsensusCommitWithIncludeMetadataEnabledIntegrationTestBase {
8+
9+
@Override
10+
protected Properties getProperties(String testName) {
11+
return ConsensusCommitObjectStorageEnv.getProperties(testName);
12+
}
13+
}

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ObjectStorageAdminCaseSensitivityIntegrationTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
5151
return new ObjectStorageAdminTestUtils(getProperties(testName));
5252
}
5353

54-
@Override
55-
@Disabled("Temporarily disabled because it includes DML operations")
56-
public void truncateTable_ShouldTruncateProperly() {}
57-
5854
@Override
5955
@Disabled("Object Storage does not have a concept of namespaces")
6056
public void

core/src/integration-test/java/com/scalar/db/storage/objectstorage/ObjectStorageAdminIntegrationTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
4949
return new ObjectStorageAdminTestUtils(getProperties(testName));
5050
}
5151

52-
@Override
53-
@Disabled("Temporarily disabled because it includes DML operations")
54-
public void truncateTable_ShouldTruncateProperly() {}
55-
5652
@Override
5753
@Disabled("Object Storage does not have a concept of namespaces")
5854
public void
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.scalar.db.storage.objectstorage;
2+
3+
import com.scalar.db.api.DistributedStorageCaseSensitivityIntegrationTestBase;
4+
import com.scalar.db.api.TableMetadata;
5+
import com.scalar.db.io.DataType;
6+
import java.util.Map;
7+
import java.util.Properties;
8+
import org.junit.jupiter.api.Disabled;
9+
10+
public class ObjectStorageCaseSensitivityIntegrationTest
11+
extends DistributedStorageCaseSensitivityIntegrationTestBase {
12+
13+
@Override
14+
protected TableMetadata getTableMetadata() {
15+
return TableMetadata.newBuilder()
16+
.addColumn(getColumnName1(), DataType.INT)
17+
.addColumn(getColumnName2(), DataType.TEXT)
18+
.addColumn(getColumnName3(), DataType.INT)
19+
.addColumn(getColumnName4(), DataType.INT)
20+
.addColumn(getColumnName5(), DataType.BOOLEAN)
21+
.addColumn(getColumnName6(), DataType.BLOB)
22+
.addPartitionKey(getColumnName1())
23+
.addClusteringKey(getColumnName4())
24+
.build();
25+
}
26+
27+
@Override
28+
protected Properties getProperties(String testName) {
29+
return ObjectStorageEnv.getProperties(testName);
30+
}
31+
32+
@Override
33+
protected Map<String, String> getCreationOptions() {
34+
return ObjectStorageEnv.getCreationOptions();
35+
}
36+
37+
@Override
38+
@Disabled("Object Storage does not support index-related operations")
39+
public void get_GetGivenForIndexedColumn_ShouldGet() {}
40+
41+
@Override
42+
@Disabled("Object Storage does not support index-related operations")
43+
public void get_GetGivenForIndexedColumnWithMatchedConjunctions_ShouldGet() {}
44+
45+
@Override
46+
@Disabled("Object Storage does not support index-related operations")
47+
public void get_GetGivenForIndexedColumnWithUnmatchedConjunctions_ShouldReturnEmpty() {}
48+
49+
@Override
50+
@Disabled("Object Storage does not support index-related operations")
51+
public void
52+
get_GetGivenForIndexedColumnMatchingMultipleRecords_ShouldThrowIllegalArgumentException() {}
53+
54+
@Override
55+
@Disabled("Object Storage does not support index-related operations")
56+
public void scan_ScanGivenForIndexedColumn_ShouldScan() {}
57+
58+
@Override
59+
@Disabled("Object Storage does not support index-related operations")
60+
public void scan_ScanGivenForNonIndexedColumn_ShouldThrowIllegalArgumentException() {}
61+
}

0 commit comments

Comments
 (0)