diff --git a/core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java b/core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java similarity index 57% rename from core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java rename to core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java index c6d2d31133..87e4cacbe9 100644 --- a/core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java +++ b/core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java @@ -1,10 +1,10 @@ package com.scalar.db.storage.jdbc; -import com.scalar.db.transaction.consensuscommit.ConsensusCommitRelationalScanIntegrationTestBase; +import com.scalar.db.transaction.consensuscommit.ConsensusCommitCrossPartitionScanIntegrationTestBase; import java.util.Properties; -public class ConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase - extends ConsensusCommitRelationalScanIntegrationTestBase { +public class ConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase + extends ConsensusCommitCrossPartitionScanIntegrationTestBase { @Override protected Properties getProps(String testName) { diff --git a/core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseRelationalScanIntegrationTest.java b/core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseCrossPartitionScanIntegrationTest.java similarity index 84% rename from core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseRelationalScanIntegrationTest.java rename to core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseCrossPartitionScanIntegrationTest.java index 75ea4656b6..19bdc0cb01 100644 --- a/core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseRelationalScanIntegrationTest.java +++ b/core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseCrossPartitionScanIntegrationTest.java @@ -1,6 +1,6 @@ package com.scalar.db.storage.jdbc; -import com.scalar.db.api.DistributedStorageRelationalScanIntegrationTestBase; +import com.scalar.db.api.DistributedStorageCrossPartitionScanIntegrationTestBase; import com.scalar.db.config.DatabaseConfig; import com.scalar.db.io.Column; import com.scalar.db.io.DataType; @@ -8,8 +8,8 @@ import java.util.Properties; import java.util.Random; -public class JdbcDatabaseRelationalScanIntegrationTest - extends DistributedStorageRelationalScanIntegrationTestBase { +public class JdbcDatabaseCrossPartitionScanIntegrationTest + extends DistributedStorageCrossPartitionScanIntegrationTestBase { private RdbEngineStrategy rdbEngine; diff --git a/core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java b/core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java similarity index 54% rename from core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java rename to core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java index 96d61eb36e..6cd5c95e25 100644 --- a/core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase.java +++ b/core/src/integration-test/java/com/scalar/db/storage/jdbc/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase.java @@ -1,10 +1,10 @@ package com.scalar.db.storage.jdbc; -import com.scalar.db.transaction.consensuscommit.TwoPhaseConsensusCommitRelationalScanIntegrationTestBase; +import com.scalar.db.transaction.consensuscommit.TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase; import java.util.Properties; -public class TwoPhaseConsensusCommitRelationalScanIntegrationTestWithJdbcDatabase - extends TwoPhaseConsensusCommitRelationalScanIntegrationTestBase { +public class TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestWithJdbcDatabase + extends TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase { @Override protected Properties getProps1(String testName) { diff --git a/core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionRelationalScanIntegrationTest.java b/core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionCrossPartitionScanIntegrationTest.java similarity index 69% rename from core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionRelationalScanIntegrationTest.java rename to core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionCrossPartitionScanIntegrationTest.java index fa0379cbee..6f056d534e 100644 --- a/core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionRelationalScanIntegrationTest.java +++ b/core/src/integration-test/java/com/scalar/db/transaction/jdbc/JdbcTransactionCrossPartitionScanIntegrationTest.java @@ -1,12 +1,12 @@ package com.scalar.db.transaction.jdbc; -import com.scalar.db.api.DistributedTransactionRelationalScanIntegrationTestBase; +import com.scalar.db.api.DistributedTransactionCrossPartitionScanIntegrationTestBase; import com.scalar.db.config.DatabaseConfig; import com.scalar.db.storage.jdbc.JdbcEnv; import java.util.Properties; -public class JdbcTransactionRelationalScanIntegrationTest - extends DistributedTransactionRelationalScanIntegrationTestBase { +public class JdbcTransactionCrossPartitionScanIntegrationTest + extends DistributedTransactionCrossPartitionScanIntegrationTestBase { @Override protected String getTestName() { diff --git a/core/src/main/java/com/scalar/db/storage/jdbc/query/SelectQuery.java b/core/src/main/java/com/scalar/db/storage/jdbc/query/SelectQuery.java index 4191ecbfbe..4ebe986d29 100644 --- a/core/src/main/java/com/scalar/db/storage/jdbc/query/SelectQuery.java +++ b/core/src/main/java/com/scalar/db/storage/jdbc/query/SelectQuery.java @@ -33,7 +33,7 @@ class Builder { boolean isRangeQuery; Optional indexedColumn = Optional.empty(); boolean isConditionalQuery; - boolean isRelationalQuery; + boolean isCrossPartitionQuery; Set conjunctions = Collections.emptySet(); Builder(RdbEngineStrategy rdbEngine, List projections) { @@ -124,10 +124,10 @@ private void setIndexInfoIfUsed(Key partitionKey) { } /* - * Assumes this is called by relational scan operations + * Assumes this is called by cross-partition scan operations */ public Builder where(Set conjunctions) { - isRelationalQuery = true; + isCrossPartitionQuery = true; this.conjunctions = ImmutableSet.copyOf(conjunctions); return this; } diff --git a/core/src/main/java/com/scalar/db/storage/jdbc/query/SimpleSelectQuery.java b/core/src/main/java/com/scalar/db/storage/jdbc/query/SimpleSelectQuery.java index 6285bbaca7..f7caf677b2 100644 --- a/core/src/main/java/com/scalar/db/storage/jdbc/query/SimpleSelectQuery.java +++ b/core/src/main/java/com/scalar/db/storage/jdbc/query/SimpleSelectQuery.java @@ -37,7 +37,7 @@ public class SimpleSelectQuery implements SelectQuery { private final boolean isRangeQuery; private final Optional indexedColumn; private final boolean isConditionalQuery; - private final boolean isRelationalQuery; + private final boolean isCrossPartitionQuery; private final Set conjunctions; SimpleSelectQuery(Builder builder) { @@ -57,7 +57,7 @@ public class SimpleSelectQuery implements SelectQuery { isRangeQuery = builder.isRangeQuery; indexedColumn = builder.indexedColumn; isConditionalQuery = builder.isConditionalQuery; - isRelationalQuery = builder.isRelationalQuery; + isCrossPartitionQuery = builder.isCrossPartitionQuery; conjunctions = builder.conjunctions; } @@ -68,12 +68,12 @@ public String sql() { .append(projectionSqlString()) .append(" FROM ") .append(rdbEngine.encloseFullTableName(schema, table)); - if (isRelationalQuery) { - // for relational abstraction - builder.append(relationalConditionSqlString()); - builder.append(relationalOrderBySqlString()); + if (isCrossPartitionQuery) { + // for cross-partition scan + builder.append(crossPartitionConditionSqlString()); + builder.append(crossPartitionOrderBySqlString()); } else { - // for multi-dimensional map abstraction + // for multi-dimensional map scan if (isConditionalQuery) { builder.append(" WHERE "); builder.append(conditionSqlString()); @@ -106,7 +106,7 @@ private String conditionSqlString() { return String.join(" AND ", conditions); } - private String relationalConditionSqlString() { + private String crossPartitionConditionSqlString() { if (conjunctions.isEmpty()) { return ""; } @@ -200,7 +200,7 @@ private String orderBySqlString() { .collect(Collectors.joining(",")); } - private String relationalOrderBySqlString() { + private String crossPartitionOrderBySqlString() { if (orderings.isEmpty()) { return ""; } diff --git a/core/src/main/java/com/scalar/db/transaction/consensuscommit/CrudHandler.java b/core/src/main/java/com/scalar/db/transaction/consensuscommit/CrudHandler.java index 817901cef2..b6af569547 100644 --- a/core/src/main/java/com/scalar/db/transaction/consensuscommit/CrudHandler.java +++ b/core/src/main/java/com/scalar/db/transaction/consensuscommit/CrudHandler.java @@ -104,11 +104,12 @@ public List scan(Scan scan) throws CrudException { List results = scanInternal(scan); // We verify if this scan does not overlap previous writes after the actual scan. For a - // relational scan, this must be done here, using the obtained keys in the scan set and scan - // condition. This is because the condition (i.e., where clause) is arbitrary in the relational - // scan, and thus, the write command may not have columns used in the condition, which are - // necessary to determine overlaps. For a scan with clustering keys, we can determine overlaps - // without the actual scan, but we also check it here for consistent logic and readability. + // cross-partition scan, this must be done here, using the obtained keys in the scan set and + // scan condition. This is because the condition (i.e., where clause) is arbitrary in the + // cross-partition scan, and thus, the write command may not have columns used in the condition, + // which are necessary to determine overlaps. For a scan with clustering keys, we can determine + // overlaps without the actual scan, but we also check it here for consistent logic and + // readability. snapshot.verify(scan); return results; diff --git a/core/src/test/java/com/scalar/db/storage/jdbc/JdbcServiceTest.java b/core/src/test/java/com/scalar/db/storage/jdbc/JdbcServiceTest.java index 6f58d61f3c..a58b68852b 100644 --- a/core/src/test/java/com/scalar/db/storage/jdbc/JdbcServiceTest.java +++ b/core/src/test/java/com/scalar/db/storage/jdbc/JdbcServiceTest.java @@ -160,7 +160,8 @@ public void whenGetScannerExecuted_withScanAll_shouldCallQueryBuilder() throws E } @Test - public void whenGetScannerExecuted_withRelationalScan_shouldCallQueryBuilder() throws Exception { + public void whenGetScannerExecuted_withCrossPartitionScan_shouldCallQueryBuilder() + throws Exception { // Arrange when(queryBuilder.select(any())).thenReturn(selectQueryBuilder); @@ -243,7 +244,7 @@ public void whenScanExecuted_withScanAll_shouldCallQueryBuilder() throws Excepti } @Test - public void whenScanExecuted_withRelationalScan_shouldCallQueryBuilder() throws Exception { + public void whenScanExecuted_withCrossPartitionScan_shouldCallQueryBuilder() throws Exception { // Arrange when(queryBuilder.select(any())).thenReturn(selectQueryBuilder); when(selectQueryBuilder.from(any(), any(), any())).thenReturn(selectQueryBuilder); diff --git a/core/src/test/java/com/scalar/db/storage/jdbc/query/QueryBuilderTest.java b/core/src/test/java/com/scalar/db/storage/jdbc/query/QueryBuilderTest.java index c4f27fa92b..375de10279 100644 --- a/core/src/test/java/com/scalar/db/storage/jdbc/query/QueryBuilderTest.java +++ b/core/src/test/java/com/scalar/db/storage/jdbc/query/QueryBuilderTest.java @@ -51,7 +51,7 @@ public class QueryBuilderTest { .addSecondaryIndex("v2") .build(); - private static final TableMetadata RELATIONAL_TABLE_METADATA = + private static final TableMetadata CROSS_PARTITION_TABLE_METADATA = TableMetadata.newBuilder() .addColumn("p1", DataType.TEXT) .addColumn("p2", DataType.INT) @@ -346,7 +346,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where(ImmutableSet.of()) .build(); assertThat(query.sql()).isEqualTo(encloseSql("SELECT * FROM n1.t1", rdbEngine)); @@ -354,7 +354,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where(ImmutableSet.of()) .orderBy( Arrays.asList( @@ -367,7 +367,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Arrays.asList("v1", "v2")) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where(ImmutableSet.of()) .build(); assertThat(query.sql()).isEqualTo(encloseSql("SELECT v1,v2 FROM n1.t1", rdbEngine)); @@ -376,7 +376,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of(Scan.Conjunction.of(ConditionBuilder.column("v1").isEqualToInt(1)))) .build(); @@ -388,7 +388,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -405,7 +405,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of(ConditionBuilder.column("v1").isEqualToInt(1)), @@ -421,7 +421,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -444,7 +444,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -469,7 +469,7 @@ public void selectQueryWithConjunctionsTest(RdbEngine rdbEngineType) throws SQLE query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -498,7 +498,7 @@ public void selectQueryWithLikeConditionsTestForMySql(RdbEngine rdbEngineType) query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -548,7 +548,7 @@ public void selectQueryWithLikeConditionsTestForPostgres(RdbEngine rdbEngineType query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -598,7 +598,7 @@ public void selectQueryWithLikeConditionsTestForOracleAndSqlLite(RdbEngine rdbEn query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( @@ -646,7 +646,7 @@ public void selectQueryWithLikeConditionsTestForSQLServer(RdbEngine rdbEngineTyp query = queryBuilder .select(Collections.emptyList()) - .from(NAMESPACE, TABLE, RELATIONAL_TABLE_METADATA) + .from(NAMESPACE, TABLE, CROSS_PARTITION_TABLE_METADATA) .where( ImmutableSet.of( Scan.Conjunction.of( diff --git a/core/src/test/java/com/scalar/db/transaction/consensuscommit/CrudHandlerTest.java b/core/src/test/java/com/scalar/db/transaction/consensuscommit/CrudHandlerTest.java index f564f91e86..079828e2cc 100644 --- a/core/src/test/java/com/scalar/db/transaction/consensuscommit/CrudHandlerTest.java +++ b/core/src/test/java/com/scalar/db/transaction/consensuscommit/CrudHandlerTest.java @@ -108,7 +108,7 @@ private Scan prepareScan() { return new Scan(partitionKey).forNamespace(ANY_NAMESPACE_NAME).forTable(ANY_TABLE_NAME); } - private Scan prepareRelationalScan() { + private Scan prepareCrossPartitionScan() { return Scan.newBuilder() .namespace(ANY_NAMESPACE_NAME) .table(ANY_TABLE_NAME) @@ -440,10 +440,10 @@ public void scan_CalledAfterDeleteUnderRealSnapshot_ShouldReturnResultsWithoutDe @Test public void - scan_RelationalScanAndResultFromStorageGiven_ShouldUpdateSnapshotAndValidateThenReturn() + scan_CrossPartitionScanndResultFromStorageGiven_ShouldUpdateSnapshotAndValidateThenReturn() throws ExecutionException, CrudException { // Arrange - Scan scan = prepareRelationalScan(); + Scan scan = prepareCrossPartitionScan(); result = prepareResult(TransactionState.COMMITTED); Snapshot.Key key = new Snapshot.Key(scan, result); when(snapshot.get(key)).thenReturn(Optional.of((TransactionResult) result)); @@ -467,10 +467,10 @@ public void scan_CalledAfterDeleteUnderRealSnapshot_ShouldReturnResultsWithoutDe @Test public void - scan_RelationalScanAndPreparedResultFromStorageGiven_ShouldNeverUpdateSnapshotNorValidateButThrowUncommittedRecordException() + scan_CrossPartitionScanAndPreparedResultFromStorageGiven_ShouldNeverUpdateSnapshotNorValidateButThrowUncommittedRecordException() throws ExecutionException { // Arrange - Scan scan = prepareRelationalScan(); + Scan scan = prepareCrossPartitionScan(); result = prepareResult(TransactionState.PREPARED); when(scanner.iterator()).thenReturn(Collections.singletonList(result).iterator()); when(storage.scan(any(ScanAll.class))).thenReturn(scanner); diff --git a/core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java b/core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java index ce97f48500..6712066e90 100644 --- a/core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java +++ b/core/src/test/java/com/scalar/db/transaction/consensuscommit/SnapshotTest.java @@ -192,11 +192,11 @@ private Scan prepareScan() { .forTable(ANY_TABLE_NAME); } - private Scan prepareRelationalScan() { - return prepareRelationalScan(ANY_NAMESPACE_NAME, ANY_TABLE_NAME); + private Scan prepareCrossPartitionScan() { + return prepareCrossPartitionScan(ANY_NAMESPACE_NAME, ANY_TABLE_NAME); } - private Scan prepareRelationalScan(String namespace, String table) { + private Scan prepareCrossPartitionScan(String namespace, String table) { return Scan.newBuilder() .namespace(namespace) .table(table) @@ -1382,13 +1382,13 @@ public void get_ScanAllGivenAndAlreadyPresentInScanSet_ShouldReturnKeys() { } @Test - public void verify_RelationalScanGivenAndPutInSameTable_ShouldThrowException() { + public void verify_CrossPartitionScanGivenAndPutInSameTable_ShouldThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); - Scan scan = prepareRelationalScan(); + Scan scan = prepareCrossPartitionScan(); Snapshot.Key key = new Snapshot.Key(scan, prepareResult(ANY_ID)); snapshot.put(scan, Collections.singletonList(key)); @@ -1400,13 +1400,13 @@ public void verify_RelationalScanGivenAndPutInSameTable_ShouldThrowException() { } @Test - public void verify_RelationalScanGivenAndPutInDifferentNamespace_ShouldNotThrowException() { + public void verify_CrossPartitionScanGivenAndPutInDifferentNamespace_ShouldNotThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); - Scan scan = prepareRelationalScan(ANY_NAMESPACE_NAME_2, ANY_TABLE_NAME); + Scan scan = prepareCrossPartitionScan(ANY_NAMESPACE_NAME_2, ANY_TABLE_NAME); Snapshot.Key key = new Snapshot.Key(scan, prepareResult(ANY_ID)); snapshot.put(scan, Collections.singletonList(key)); @@ -1418,13 +1418,13 @@ public void verify_RelationalScanGivenAndPutInDifferentNamespace_ShouldNotThrowE } @Test - public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowException() { + public void verify_CrossPartitionScanGivenAndPutInDifferentTable_ShouldNotThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); - Scan scan = prepareRelationalScan(ANY_NAMESPACE_NAME, ANY_TABLE_NAME_2); + Scan scan = prepareCrossPartitionScan(ANY_NAMESPACE_NAME, ANY_TABLE_NAME_2); Snapshot.Key key = new Snapshot.Key(scan, prepareResult(ANY_ID)); snapshot.put(scan, Collections.singletonList(key)); @@ -1437,14 +1437,14 @@ public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowExcep @Test public void - verify_RelationalScanGivenAndNewPutInSameTableAndAllConditionsMatch_ShouldThrowException() { + verify_CrossPartitionScanGivenAndNewPutInSameTableAndAllConditionsMatch_ShouldThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePutWithIntColumns(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); Scan scan = - Scan.newBuilder(prepareRelationalScan()) + Scan.newBuilder(prepareCrossPartitionScan()) .clearConditions() .where( ConditionSetBuilder.andConditionSet( @@ -1471,14 +1471,14 @@ public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowExcep @Test public void - verify_RelationalScanGivenAndNewPutInSameTableAndAnyConjunctionMatch_ShouldThrowException() { + verify_CrossPartitionScanGivenAndNewPutInSameTableAndAnyConjunctionMatch_ShouldThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); Scan scan = - Scan.newBuilder(prepareRelationalScan()) + Scan.newBuilder(prepareCrossPartitionScan()) .clearConditions() .where(ConditionBuilder.column(ANY_NAME_3).isEqualToText(ANY_TEXT_1)) .or(ConditionBuilder.column(ANY_NAME_4).isEqualToText(ANY_TEXT_4)) @@ -1494,14 +1494,14 @@ public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowExcep @Test public void - validate_RelationalScanGivenAndNewPutInSameTableAndLikeConditionsMatch_ShouldThrowException() { + validate_CrossPartitionScanGivenAndNewPutInSameTableAndLikeConditionsMatch_ShouldThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); Scan scan = - Scan.newBuilder(prepareRelationalScan()) + Scan.newBuilder(prepareCrossPartitionScan()) .clearConditions() .where(ConditionBuilder.column(ANY_NAME_3).isLikeText("text%")) .and(ConditionBuilder.column(ANY_NAME_4).isNotLikeText("text")) @@ -1517,14 +1517,14 @@ public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowExcep @Test public void - verify_RelationalScanGivenAndNewPutInSameTableButConditionNotMatch_ShouldNotThrowException() { + verify_CrossPartitionScanGivenAndNewPutInSameTableButConditionNotMatch_ShouldNotThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePut(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); Scan scan = - Scan.newBuilder(prepareRelationalScan()) + Scan.newBuilder(prepareCrossPartitionScan()) .clearConditions() .where(ConditionBuilder.column(ANY_NAME_4).isEqualToText(ANY_TEXT_1)) .or(ConditionBuilder.column(ANY_NAME_5).isEqualToText(ANY_TEXT_1)) @@ -1540,13 +1540,13 @@ public void verify_RelationalScanGivenAndPutInDifferentTable_ShouldNotThrowExcep @Test public void - verify_RelationalScanWithoutConjunctionGivenAndNewPutInSameTable_ShouldThrowException() { + verify_CrossPartitionScanWithoutConjunctionGivenAndNewPutInSameTable_ShouldThrowException() { // Arrange snapshot = prepareSnapshot(Isolation.SERIALIZABLE, SerializableStrategy.EXTRA_READ); Put put = preparePutWithIntColumns(); Snapshot.Key putKey = new Snapshot.Key(put); snapshot.put(putKey, put); - Scan scan = Scan.newBuilder(prepareRelationalScan()).clearConditions().build(); + Scan scan = Scan.newBuilder(prepareCrossPartitionScan()).clearConditions().build(); snapshot.put(scan, Collections.emptyList()); // Act diff --git a/integration-test/src/main/java/com/scalar/db/api/DistributedStorageRelationalScanIntegrationTestBase.java b/integration-test/src/main/java/com/scalar/db/api/DistributedStorageCrossPartitionScanIntegrationTestBase.java similarity index 99% rename from integration-test/src/main/java/com/scalar/db/api/DistributedStorageRelationalScanIntegrationTestBase.java rename to integration-test/src/main/java/com/scalar/db/api/DistributedStorageCrossPartitionScanIntegrationTestBase.java index 13991e53b0..1e8dab9eb5 100644 --- a/integration-test/src/main/java/com/scalar/db/api/DistributedStorageRelationalScanIntegrationTestBase.java +++ b/integration-test/src/main/java/com/scalar/db/api/DistributedStorageCrossPartitionScanIntegrationTestBase.java @@ -56,9 +56,9 @@ import org.junit.jupiter.api.TestInstance; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public abstract class DistributedStorageRelationalScanIntegrationTestBase { +public abstract class DistributedStorageCrossPartitionScanIntegrationTestBase { - private static final String TEST_NAME = "storage_relational_scan"; + private static final String TEST_NAME = "storage_cross_partition_scan"; private static final String NAMESPACE_BASE_NAME = "int_test_" + TEST_NAME + "_"; private static final String CONDITION_TEST_TABLE = "condition_test_table"; private static final String PARTITION_KEY_NAME = "pk"; @@ -98,7 +98,7 @@ public void beforeAll() throws Exception { createTableForConditionTests(); createTablesForOrderingTests(); seed = System.currentTimeMillis(); - System.out.println("The seed used in the relational scan integration test is " + seed); + System.out.println("The seed used in the cross-partition scan integration test is " + seed); random = ThreadLocal.withInitial(Random::new); } diff --git a/integration-test/src/main/java/com/scalar/db/api/DistributedTransactionRelationalScanIntegrationTestBase.java b/integration-test/src/main/java/com/scalar/db/api/DistributedTransactionCrossPartitionScanIntegrationTestBase.java similarity index 90% rename from integration-test/src/main/java/com/scalar/db/api/DistributedTransactionRelationalScanIntegrationTestBase.java rename to integration-test/src/main/java/com/scalar/db/api/DistributedTransactionCrossPartitionScanIntegrationTestBase.java index 34fdf991ab..0da4c2df66 100644 --- a/integration-test/src/main/java/com/scalar/db/api/DistributedTransactionRelationalScanIntegrationTestBase.java +++ b/integration-test/src/main/java/com/scalar/db/api/DistributedTransactionCrossPartitionScanIntegrationTestBase.java @@ -32,9 +32,9 @@ import org.junit.jupiter.api.TestInstance; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public abstract class DistributedTransactionRelationalScanIntegrationTestBase { +public abstract class DistributedTransactionCrossPartitionScanIntegrationTestBase { - protected static final String NAMESPACE_BASE_NAME = "int_rscan_tx_test_"; + protected static final String NAMESPACE_BASE_NAME = "int_cpscan_tx_test_"; protected static final String TABLE = "test_table"; protected static final String TABLE_WITH_TEXT = "test_table_with_text"; protected static final String ACCOUNT_ID = "account_id"; @@ -120,12 +120,12 @@ private void dropTables() throws ExecutionException { } @Test - public void scan_RelationalScanGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); - Scan scan = prepareRelationalScan(1, 0, 2); + Scan scan = prepareCrossPartitionScan(1, 0, 2); // Act List results = transaction.scan(scan); @@ -137,13 +137,13 @@ public void scan_RelationalScanGivenForCommittedRecord_ShouldReturnRecords() } @Test - public void scan_RelationalScanWithProjectionsGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanWithProjectionsGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); Scan scan = - Scan.newBuilder(prepareRelationalScan(1, 0, 2)) + Scan.newBuilder(prepareCrossPartitionScan(1, 0, 2)) .projection(ACCOUNT_ID) .projection(ACCOUNT_TYPE) .projection(BALANCE) @@ -166,13 +166,13 @@ public void scan_RelationalScanWithProjectionsGivenForCommittedRecord_ShouldRetu } @Test - public void scan_RelationalScanWithOrderingGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanWithOrderingGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); Scan scan = - Scan.newBuilder(prepareRelationalScan(1, 0, 2)) + Scan.newBuilder(prepareCrossPartitionScan(1, 0, 2)) .ordering(Ordering.desc(ACCOUNT_TYPE)) .build(); @@ -199,13 +199,13 @@ public void scan_RelationalScanWithOrderingGivenForCommittedRecord_ShouldReturnR } @Test - public void scan_RelationalScanWithLimitGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanWithLimitGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); Scan scan = - Scan.newBuilder(prepareRelationalScan(1, 0, 2)) + Scan.newBuilder(prepareCrossPartitionScan(1, 0, 2)) .ordering(Ordering.asc(ACCOUNT_TYPE)) .limit(2) .build(); @@ -228,12 +228,12 @@ public void scan_RelationalScanWithLimitGivenForCommittedRecord_ShouldReturnReco } @Test - public void scan_RelationalScanGivenForNonExisting_ShouldReturnEmpty() + public void scan_CrossPartitionScanGivenForNonExisting_ShouldReturnEmpty() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); - Scan scan = prepareRelationalScan(0, 4, 6); + Scan scan = prepareCrossPartitionScan(0, 4, 6); // Act List results = transaction.scan(scan); @@ -245,13 +245,13 @@ public void scan_RelationalScanGivenForNonExisting_ShouldReturnEmpty() @Test public void - scan_RelationalScanWithProjectionsGivenOnNonPrimaryKeyColumnsForCommittedRecord_ShouldReturnOnlyProjectedColumns() + scan_CrossPartitionScanWithProjectionsGivenOnNonPrimaryKeyColumnsForCommittedRecord_ShouldReturnOnlyProjectedColumns() throws TransactionException { // Arrange DistributedTransaction transaction = manager.begin(); populateSingleRecord(); Scan scan = - Scan.newBuilder(prepareRelationalScan(0, 0, 0)) + Scan.newBuilder(prepareCrossPartitionScan(0, 0, 0)) .projections(Arrays.asList(BALANCE, SOME_COLUMN)) .build(); @@ -269,14 +269,14 @@ public void scan_RelationalScanGivenForNonExisting_ShouldReturnEmpty() } @Test - public void scan_RelationalScanWithLikeGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanWithLikeGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecordsForLike(); DistributedTransaction transaction = manager.start(); - Scan scan1 = prepareRelationalScanWithLike(true, "%scalar[$]"); - Scan scan2 = prepareRelationalScanWithLike(true, "+_scalar[$]", "+"); - Scan scan3 = prepareRelationalScanWithLike(false, "\\_scalar[$]"); + Scan scan1 = prepareCrossPartitionScanWithLike(true, "%scalar[$]"); + Scan scan2 = prepareCrossPartitionScanWithLike(true, "+_scalar[$]", "+"); + Scan scan3 = prepareCrossPartitionScanWithLike(false, "\\_scalar[$]"); // Act List actual1 = transaction.scan(scan1); @@ -385,7 +385,7 @@ protected Put preparePut(int id, String name) throws TransactionException { .build(); } - protected Scan prepareRelationalScan(int offset, int fromType, int toType) { + protected Scan prepareCrossPartitionScan(int offset, int fromType, int toType) { return Scan.newBuilder() .namespace(namespace) .table(TABLE) @@ -398,7 +398,7 @@ protected Scan prepareRelationalScan(int offset, int fromType, int toType) { .build(); } - protected Scan prepareRelationalScanWithLike(boolean isLike, String pattern) { + protected Scan prepareCrossPartitionScanWithLike(boolean isLike, String pattern) { LikeExpression condition = isLike ? ConditionBuilder.column(ACCOUNT_NAME).isLikeText(pattern) @@ -413,7 +413,7 @@ protected Scan prepareRelationalScanWithLike(boolean isLike, String pattern) { .build(); } - protected Scan prepareRelationalScanWithLike(boolean isLike, String pattern, String escape) { + protected Scan prepareCrossPartitionScanWithLike(boolean isLike, String pattern, String escape) { LikeExpression condition = isLike ? ConditionBuilder.column(ACCOUNT_NAME).isLikeText(pattern, escape) diff --git a/integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionRelationalScanIntegrationTestBase.java b/integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase.java similarity index 94% rename from integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionRelationalScanIntegrationTestBase.java rename to integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase.java index 63c44376ca..9389a85ed8 100644 --- a/integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionRelationalScanIntegrationTestBase.java +++ b/integration-test/src/main/java/com/scalar/db/api/TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.TestInstance; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public abstract class TwoPhaseCommitTransactionRelationalScanIntegrationTestBase { +public abstract class TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase { protected static final String NAMESPACE_BASE_NAME = "int_rscan_2pc_test_"; protected static final String TABLE_1 = "test_table1"; @@ -137,7 +137,7 @@ public void scan_ScanGivenForCommittedRecord_ShouldReturnRecords() throws Transa // Arrange populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); - Scan scan = prepareRelationalScan(namespace1, TABLE_1, 1, 0, 2); + Scan scan = prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, 2); // Act List results = transaction.scan(scan); @@ -157,7 +157,7 @@ public void scan_ScanWithProjectionsGivenForCommittedRecord_ShouldReturnRecords( populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); Scan scan = - Scan.newBuilder(prepareRelationalScan(namespace1, TABLE_1, 1, 0, 2)) + Scan.newBuilder(prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, 2)) .projection(ACCOUNT_ID) .projection(ACCOUNT_TYPE) .projection(BALANCE) @@ -181,7 +181,7 @@ public void scan_ScanWithOrderingGivenForCommittedRecord_ShouldReturnRecords() populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); Scan scan = - Scan.newBuilder(prepareRelationalScan(namespace1, TABLE_1, 1, 0, 2)) + Scan.newBuilder(prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, 2)) .ordering(Ordering.desc(ACCOUNT_TYPE)) .build(); @@ -214,7 +214,7 @@ public void scan_ScanGivenForNonExisting_ShouldReturnEmpty() throws TransactionE // Arrange populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); - Scan scan = prepareRelationalScan(namespace1, TABLE_1, 0, 4, 4); + Scan scan = prepareCrossPartitionScan(namespace1, TABLE_1, 0, 4, 4); // Act List results = transaction.scan(scan); @@ -227,14 +227,14 @@ public void scan_ScanGivenForNonExisting_ShouldReturnEmpty() throws TransactionE } @Test - public void scan_RelationalScanWithLikeGivenForCommittedRecord_ShouldReturnRecords() + public void scan_CrossPartitionScanWithLikeGivenForCommittedRecord_ShouldReturnRecords() throws TransactionException { // Arrange populateRecordsForLike(manager2, namespace2, TABLE_2); TwoPhaseCommitTransaction transaction = manager2.start(); - Scan scan1 = prepareRelationalScanWithLike(namespace2, TABLE_2, true, "%scalar[$]"); - Scan scan2 = prepareRelationalScanWithLike(namespace2, TABLE_2, true, "+_scalar[$]", "+"); - Scan scan3 = prepareRelationalScanWithLike(namespace2, TABLE_2, false, "\\_scalar[$]"); + Scan scan1 = prepareCrossPartitionScanWithLike(namespace2, TABLE_2, true, "%scalar[$]"); + Scan scan2 = prepareCrossPartitionScanWithLike(namespace2, TABLE_2, true, "+_scalar[$]", "+"); + Scan scan3 = prepareCrossPartitionScanWithLike(namespace2, TABLE_2, false, "\\_scalar[$]"); // Act List actual1 = transaction.scan(scan1); @@ -342,7 +342,7 @@ protected Put preparePut(String namespaceName, String tableNam, int id, String n .build(); } - protected Scan prepareRelationalScan( + protected Scan prepareCrossPartitionScan( String namespaceName, String tableName, int offset, int fromType, int toType) { return Scan.newBuilder() .namespace(namespaceName) @@ -356,7 +356,7 @@ protected Scan prepareRelationalScan( .build(); } - protected Scan prepareRelationalScanWithLike( + protected Scan prepareCrossPartitionScanWithLike( String namespaceName, String tableName, boolean isLike, String pattern) { LikeExpression condition = isLike @@ -372,7 +372,7 @@ protected Scan prepareRelationalScanWithLike( .build(); } - protected Scan prepareRelationalScanWithLike( + protected Scan prepareCrossPartitionScanWithLike( String namespaceName, String tableName, boolean isLike, String pattern, String escape) { LikeExpression condition = isLike diff --git a/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitRelationalScanIntegrationTestBase.java b/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitCrossPartitionScanIntegrationTestBase.java similarity index 87% rename from integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitRelationalScanIntegrationTestBase.java rename to integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitCrossPartitionScanIntegrationTestBase.java index 03058d9ed7..ac411842e2 100644 --- a/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitRelationalScanIntegrationTestBase.java +++ b/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitCrossPartitionScanIntegrationTestBase.java @@ -8,8 +8,8 @@ import com.scalar.db.api.ConditionBuilder; import com.scalar.db.api.Consistency; import com.scalar.db.api.DistributedTransaction; +import com.scalar.db.api.DistributedTransactionCrossPartitionScanIntegrationTestBase; import com.scalar.db.api.DistributedTransactionManager; -import com.scalar.db.api.DistributedTransactionRelationalScanIntegrationTestBase; import com.scalar.db.api.Put; import com.scalar.db.api.Result; import com.scalar.db.api.Scan; @@ -27,8 +27,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public abstract class ConsensusCommitRelationalScanIntegrationTestBase - extends DistributedTransactionRelationalScanIntegrationTestBase { +public abstract class ConsensusCommitCrossPartitionScanIntegrationTestBase + extends DistributedTransactionCrossPartitionScanIntegrationTestBase { private DistributedTransactionManager managerWithIncludeMetadataEnabled; @BeforeAll @@ -80,7 +80,7 @@ protected Properties getPropsWithIncludeMetadataEnabled(String testName) { } @Test - public void scan_PutAndOverlappedRelationalScanGiven_ShouldThrowException() + public void scan_PutAndOverlappedCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(); @@ -109,13 +109,13 @@ public void scan_PutAndOverlappedRelationalScanGiven_ShouldThrowException() } @Test - public void scan_PutResultNonOverlappedWithRelationalScanGiven_ShouldThrowException() + public void scan_PutResultNonOverlappedWithCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); Put put = preparePut(10, NUM_TYPES); - Scan scan = prepareRelationalScan(1, 0, NUM_TYPES - 1); + Scan scan = prepareCrossPartitionScan(1, 0, NUM_TYPES - 1); // Act Throwable thrown = @@ -131,13 +131,13 @@ public void scan_PutResultNonOverlappedWithRelationalScanGiven_ShouldThrowExcept } @Test - public void scan_PutResultOverlappedWithRelationalScanGiven_ShouldThrowException() + public void scan_PutResultOverlappedWithCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(); DistributedTransaction transaction = manager.start(); Put put = preparePut(10, NUM_TYPES); - Scan scan = prepareRelationalScan(1, NUM_TYPES, NUM_TYPES); + Scan scan = prepareCrossPartitionScan(1, NUM_TYPES, NUM_TYPES); // Act Throwable thrown = @@ -153,13 +153,13 @@ public void scan_PutResultOverlappedWithRelationalScanGiven_ShouldThrowException } @Test - public void scan_PutNonOverlappedWithRelationalScanWithLikeGiven_ShouldNotThrowAnyException() + public void scan_PutNonOverlappedWithCrossPartitionScanWithLikeGiven_ShouldNotThrowAnyException() throws TransactionException { // Arrange populateRecordsForLike(); DistributedTransaction transaction = manager.start(); Put put = preparePut(999, "\\scalar[$]"); - Scan scan = prepareRelationalScanWithLike(true, "\\_scalar[$]", ""); + Scan scan = prepareCrossPartitionScanWithLike(true, "\\_scalar[$]", ""); // Act Assert assertDoesNotThrow( @@ -171,13 +171,13 @@ public void scan_PutNonOverlappedWithRelationalScanWithLikeGiven_ShouldNotThrowA } @Test - public void scan_PutResultOverlappedWithRelationalScanWithLikeGiven_ShouldThrowException() + public void scan_PutResultOverlappedWithCrossPartitionScanWithLikeGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecordsForLike(); DistributedTransaction transaction = manager.start(); Put put = preparePut(999, "\\scalar[$]"); - Scan scan = prepareRelationalScanWithLike(true, "\\%scalar[$]", ""); + Scan scan = prepareCrossPartitionScanWithLike(true, "\\%scalar[$]", ""); // Act Throwable thrown = @@ -224,7 +224,7 @@ private void scan_WithIncludeMetadataEnabled_ShouldReturnCorrectColumns(boolean // Act Assert BuildableScanOrScanAllFromExisting scanBuilder = - Scan.newBuilder(prepareRelationalScan(0, 0, 1)); + Scan.newBuilder(prepareCrossPartitionScan(0, 0, 1)); if (hasProjections) { scanBuilder.projections(projections); } diff --git a/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitRelationalScanIntegrationTestBase.java b/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase.java similarity index 86% rename from integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitRelationalScanIntegrationTestBase.java rename to integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase.java index 20da8b3582..af46e59408 100644 --- a/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitRelationalScanIntegrationTestBase.java +++ b/integration-test/src/main/java/com/scalar/db/transaction/consensuscommit/TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase.java @@ -13,8 +13,8 @@ import com.scalar.db.api.ScanBuilder.BuildableScanOrScanAllFromExisting; import com.scalar.db.api.TableMetadata; import com.scalar.db.api.TwoPhaseCommitTransaction; +import com.scalar.db.api.TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase; import com.scalar.db.api.TwoPhaseCommitTransactionManager; -import com.scalar.db.api.TwoPhaseCommitTransactionRelationalScanIntegrationTestBase; import com.scalar.db.config.DatabaseConfig; import com.scalar.db.exception.transaction.TransactionException; import com.scalar.db.io.Column; @@ -27,8 +27,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public abstract class TwoPhaseConsensusCommitRelationalScanIntegrationTestBase - extends TwoPhaseCommitTransactionRelationalScanIntegrationTestBase { +public abstract class TwoPhaseConsensusCommitCrossPartitionScanIntegrationTestBase + extends TwoPhaseCommitTransactionCrossPartitionScanIntegrationTestBase { private TwoPhaseCommitTransactionManager managerWithWithIncludeMetadataEnabled; @BeforeAll @@ -98,7 +98,7 @@ protected Properties getPropsWithIncludeMetadataEnabled(String testName) { } @Test - public void scan_PutAndOverlappedRelationalScanGiven_ShouldThrowException() + public void scan_PutAndOverlappedCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(manager1, namespace1, TABLE_1); @@ -127,13 +127,13 @@ public void scan_PutAndOverlappedRelationalScanGiven_ShouldThrowException() } @Test - public void scan_PutResultNonOverlappedWithRelationalScanGiven_ShouldThrowException() + public void scan_PutResultNonOverlappedWithCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); Put put = preparePut(namespace1, TABLE_1, 10, NUM_TYPES); - Scan scan = prepareRelationalScan(namespace1, TABLE_1, 1, 0, NUM_TYPES - 1); + Scan scan = prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, NUM_TYPES - 1); // Act Throwable thrown = @@ -149,13 +149,13 @@ public void scan_PutResultNonOverlappedWithRelationalScanGiven_ShouldThrowExcept } @Test - public void scan_PutResultOverlappedWithRelationalScanGiven_ShouldThrowException() + public void scan_PutResultOverlappedWithCrossPartitionScanGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(manager1, namespace1, TABLE_1); TwoPhaseCommitTransaction transaction = manager1.start(); Put put = preparePut(namespace1, TABLE_1, 10, NUM_TYPES); - Scan scan = prepareRelationalScan(namespace1, TABLE_1, 1, NUM_TYPES, NUM_TYPES); + Scan scan = prepareCrossPartitionScan(namespace1, TABLE_1, 1, NUM_TYPES, NUM_TYPES); // Act Throwable thrown = @@ -171,13 +171,13 @@ public void scan_PutResultOverlappedWithRelationalScanGiven_ShouldThrowException } @Test - public void scan_PutNonOverlappedWithRelationalScanWithLikeGiven_ShouldNotThrowAnyException() + public void scan_PutNonOverlappedWithCrossPartitionScanWithLikeGiven_ShouldNotThrowAnyException() throws TransactionException { // Arrange populateRecords(manager1, namespace1, TABLE_1); populateRecordsForLike(manager2, namespace2, TABLE_2); - Scan scan1 = Scan.newBuilder(prepareRelationalScan(namespace1, TABLE_1, 1, 0, 2)).build(); - Scan scan2 = prepareRelationalScanWithLike(namespace2, TABLE_2, true, "\\_scalar[$]", ""); + Scan scan1 = Scan.newBuilder(prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, 2)).build(); + Scan scan2 = prepareCrossPartitionScanWithLike(namespace2, TABLE_2, true, "\\_scalar[$]", ""); Put put = preparePut(namespace2, TABLE_2, 999, "\\scalar[$]"); TwoPhaseCommitTransaction transaction1 = manager1.start(); @@ -206,13 +206,13 @@ public void scan_PutNonOverlappedWithRelationalScanWithLikeGiven_ShouldNotThrowA } @Test - public void scan_PutResultOverlappedWithRelationalScanWithLikeGiven_ShouldThrowException() + public void scan_PutResultOverlappedWithCrossPartitionScanWithLikeGiven_ShouldThrowException() throws TransactionException { // Arrange populateRecords(manager1, namespace1, TABLE_1); populateRecordsForLike(manager2, namespace2, TABLE_2); - Scan scan1 = Scan.newBuilder(prepareRelationalScan(namespace1, TABLE_1, 1, 0, 2)).build(); - Scan scan2 = prepareRelationalScanWithLike(namespace2, TABLE_2, true, "\\scalar[$]", ""); + Scan scan1 = Scan.newBuilder(prepareCrossPartitionScan(namespace1, TABLE_1, 1, 0, 2)).build(); + Scan scan2 = prepareCrossPartitionScanWithLike(namespace2, TABLE_2, true, "\\scalar[$]", ""); Put put = preparePut(namespace2, TABLE_2, 999, "\\scalar[$]"); TwoPhaseCommitTransaction transaction1 = manager1.start(); @@ -267,7 +267,7 @@ private void scan_WithIncludeMetadataEnabled_ShouldReturnCorrectColumns(boolean // Act Assert BuildableScanOrScanAllFromExisting scanBuilder = - Scan.newBuilder(prepareRelationalScan(namespace1, TABLE_1, 0, 0, 1)); + Scan.newBuilder(prepareCrossPartitionScan(namespace1, TABLE_1, 0, 0, 1)); if (hasProjections) { scanBuilder.projections(projections); }