You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by vj...@apache.org on 2026/05/26 22:47:53 UTC
(phoenix-adapters) branch main updated: Eventually Consistent Global Secondary Indexes
This is an automated email from the ASF dual-hosted git repository.
virajjasani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/phoenix-adapters.git
The following commit(s) were added to refs/heads/main by this push:
new 0a9ed8b Eventually Consistent Global Secondary Indexes
0a9ed8b is described below
commit 0a9ed8b600c05b5c3be7989e189607e6e1d29bc0
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Tue Apr 21 18:28:59 2026 -0700
Eventually Consistent Global Secondary Indexes
---
.../phoenix/ddb/service/CreateTableService.java | 23 ++-
.../phoenix/ddb/service/UpdateTableService.java | 12 +-
.../apache/phoenix/ddb/AccessKeyAuthFilterIT.java | 3 +-
.../org/apache/phoenix/ddb/BaseSegmentScanIT.java | 3 +-
.../org/apache/phoenix/ddb/BatchGetItem2IT.java | 3 +-
.../org/apache/phoenix/ddb/BatchGetItemIT.java | 3 +-
.../org/apache/phoenix/ddb/BatchWriteItem2IT.java | 3 +-
.../org/apache/phoenix/ddb/BatchWriteItemIT.java | 3 +-
.../org/apache/phoenix/ddb/BinaryEndToEndIT.java | 167 +++++++++++----------
.../org/apache/phoenix/ddb/BinaryStreamsIT.java | 3 +-
.../apache/phoenix/ddb/ConditionalPutItem2IT.java | 3 +-
.../apache/phoenix/ddb/ConditionalPutItemIT.java | 7 +-
.../org/apache/phoenix/ddb/ConnectionConfigIT.java | 3 +-
.../java/org/apache/phoenix/ddb/CreateTableIT.java | 10 +-
.../java/org/apache/phoenix/ddb/DeleteItem2IT.java | 3 +-
.../java/org/apache/phoenix/ddb/DeleteItemIT.java | 3 +-
.../java/org/apache/phoenix/ddb/DeleteTableIT.java | 3 +-
.../phoenix/ddb/DescribeContinuousBackupsIT.java | 3 +-
.../org/apache/phoenix/ddb/DescribeStreamIT.java | 3 +-
.../org/apache/phoenix/ddb/DescribeTableIT.java | 5 +-
.../java/org/apache/phoenix/ddb/GetItemIT.java | 7 +-
.../java/org/apache/phoenix/ddb/GetRecordsIT.java | 3 +-
.../phoenix/ddb/GetRecordsMultipleProducersIT.java | 3 +-
.../phoenix/ddb/GetRecordsSequenceNumberIT.java | 3 +-
.../phoenix/ddb/GetRecordsShardIteratorTypeIT.java | 3 +-
.../phoenix/ddb/GetRecordsShardLineageIT.java | 3 +-
.../apache/phoenix/ddb/GetRecordsStreamTypeIT.java | 3 +-
.../apache/phoenix/ddb/GetRecordsTTLExpiryIT.java | 3 +-
.../org/apache/phoenix/ddb/GetShardIteratorIT.java | 3 +-
.../org/apache/phoenix/ddb/IndexSegmentScanIT.java | 2 +
.../java/org/apache/phoenix/ddb/JMXMetricsIT.java | 3 +-
.../java/org/apache/phoenix/ddb/ListStreamsIT.java | 3 +-
.../java/org/apache/phoenix/ddb/ListTablesIT.java | 3 +-
.../java/org/apache/phoenix/ddb/MappedTableIT.java | 18 ++-
.../java/org/apache/phoenix/ddb/Misc1Util.java | 5 +-
.../test/java/org/apache/phoenix/ddb/MiscIT.java | 9 +-
.../java/org/apache/phoenix/ddb/PutItemIT.java | 7 +-
.../test/java/org/apache/phoenix/ddb/Query2IT.java | 3 +-
.../test/java/org/apache/phoenix/ddb/QueryIT.java | 3 +-
.../java/org/apache/phoenix/ddb/QueryIndex1IT.java | 15 +-
.../java/org/apache/phoenix/ddb/QueryIndex2IT.java | 27 +++-
.../java/org/apache/phoenix/ddb/QueryIndex3IT.java | 19 ++-
.../java/org/apache/phoenix/ddb/QueryIndex4IT.java | 6 +-
.../phoenix/ddb/QueryIndexExclusiveStartKeyIT.java | 43 ++++--
.../org/apache/phoenix/ddb/QueryProjectionIT.java | 3 +-
.../org/apache/phoenix/ddb/ReturnItemsLimitIT.java | 3 +-
.../phoenix/ddb/ScanExclusiveStartKeyIT.java | 3 +-
.../java/org/apache/phoenix/ddb/ScanIndex2IT.java | 10 +-
.../java/org/apache/phoenix/ddb/ScanIndex3IT.java | 5 +-
.../phoenix/ddb/ScanIndexExclusiveStartKeyIT.java | 151 +++++++++----------
.../java/org/apache/phoenix/ddb/ScanIndexIT.java | 17 ++-
.../java/org/apache/phoenix/ddb/ScanTable2IT.java | 3 +-
.../java/org/apache/phoenix/ddb/ScanTableIT.java | 3 +-
.../java/org/apache/phoenix/ddb/SegmentScanIT.java | 2 +-
.../java/org/apache/phoenix/ddb/TestUtils.java | 19 +++
.../java/org/apache/phoenix/ddb/TimeToLiveIT.java | 3 +-
.../phoenix/ddb/UpdateExpressionValidationIT.java | 3 +-
.../apache/phoenix/ddb/UpdateItemBaseTests.java | 3 +-
.../ddb/UpdateItemReturnValuesConcurrentIT.java | 3 +-
.../org/apache/phoenix/ddb/UpdateTable2IT.java | 5 +-
.../java/org/apache/phoenix/ddb/UpdateTableIT.java | 13 +-
.../java/org/apache/phoenix/ddb/ValidationIT.java | 3 +-
.../resources/phoenix-index-options.properties | 3 +-
.../resources/phoenix-table-options.properties | 5 +-
64 files changed, 424 insertions(+), 299 deletions(-)
diff --git a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/CreateTableService.java b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/CreateTableService.java
index 3b5d0ea..3ec6c5c 100644
--- a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/CreateTableService.java
+++ b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/CreateTableService.java
@@ -313,11 +313,11 @@ public class CreateTableService {
cols.append(", COL BSON CONSTRAINT pk PRIMARY KEY (").append(pkCols).append(")");
List<String> createCdcDDLs = getCdcDDL(request);
+ List<String> createIndexDDLs = getIndexDDLs(request);
String createTableDDL =
"CREATE TABLE IF NOT EXISTS " + PhoenixUtils.getFullTableName(tableName, true)
+ " (" + cols + ") " + TableOptionsConfig.getTableOptions(
- createCdcDDLs.isEmpty());
- List<String> createIndexDDLs = getIndexDDLs(request);
+ createCdcDDLs.isEmpty() && createIndexDDLs.isEmpty());
try (Connection connection = ConnectionUtil.getConnection(connectionUrl)) {
connection.setAutoCommit(true);
@@ -342,14 +342,23 @@ public class CreateTableService {
tableExists = checkTableExistence(phoenixConnection, tableName);
LOGGER.info("Create Table DDL: {}", createTableDDL);
connection.createStatement().execute(createTableDDL);
+ for (String ddl : createCdcDDLs) {
+ LOGGER.info("Create CDC DDL: {}", ddl);
+ try {
+ connection.createStatement().execute(ddl);
+ } catch (SQLException e) {
+ // TODO : remove this if condition once "CREATE CDC IF NOT EXISTS" no longer
+ // throws CDC_ALREADY_ENABLED. The error code CDC_ALREADY_ENABLED should be
+ // thrown only if "IF NOT EXISTS" is not used with "CREATE CDC".
+ if (SQLExceptionCode.CDC_ALREADY_ENABLED.getErrorCode() != e.getErrorCode()) {
+ throw new PhoenixServiceException(e);
+ }
+ }
+ }
for (String createIndexDDL : createIndexDDLs) {
LOGGER.info("Create Index DDL: {}", createIndexDDL);
connection.createStatement().execute(createIndexDDL);
}
- for (String ddl : createCdcDDLs) {
- LOGGER.info("Create CDC DDL: {}", ddl);
- connection.createStatement().execute(ddl);
- }
} catch (SQLException e) {
LOGGER.error("Error with table creation", e);
// TODO : remove this if condition once "CREATE CDC IF NOT EXISTS" no longer
@@ -377,7 +386,7 @@ public class CreateTableService {
if (table != null) {
long tableTimestamp = table.getTimeStamp();
long elapsedMillis = EnvironmentEdgeManager.currentTime() - tableTimestamp;
- return elapsedMillis > 5000;
+ return elapsedMillis > 15000;
}
} catch (TableNotFoundException e) {
// ignore
diff --git a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/UpdateTableService.java b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/UpdateTableService.java
index a334bb0..4cda95a 100644
--- a/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/UpdateTableService.java
+++ b/phoenix-ddb-rest/src/main/java/org/apache/phoenix/ddb/service/UpdateTableService.java
@@ -6,6 +6,7 @@ import org.apache.phoenix.ddb.service.exceptions.ValidationException;
import org.apache.phoenix.ddb.utils.ApiMetadata;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
import org.apache.phoenix.ddb.service.utils.TableDescriptorUtils;
+import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.schema.PIndexState;
@@ -42,7 +43,16 @@ public class UpdateTableService {
PhoenixConnection pconn = connection.unwrap(PhoenixConnection.class);
PTable table = pconn.getTableNoCache(pconn.getTenantId(), PhoenixUtils.getFullTableName(tableName, false));
for (String ddl : getCdcDdlsToExecute(table, request)) {
- connection.createStatement().execute(ddl);
+ try {
+ connection.createStatement().execute(ddl);
+ } catch (SQLException e) {
+ // TODO : remove this if condition once "CREATE CDC IF NOT EXISTS" no longer
+ // throws CDC_ALREADY_ENABLED. The error code CDC_ALREADY_ENABLED should be
+ // thrown only if "IF NOT EXISTS" is not used with "CREATE CDC".
+ if (SQLExceptionCode.CDC_ALREADY_ENABLED.getErrorCode() != e.getErrorCode()) {
+ throw new PhoenixServiceException(e);
+ }
+ }
}
} catch (SQLException e) {
throw new PhoenixServiceException(e);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java
index b791838..8088ed1 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java
@@ -41,7 +41,6 @@ import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.rest.auth.CredentialStore;
@@ -86,7 +85,7 @@ public class AccessKeyAuthFilterIT {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java
index 13b9b68..750fbb6 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java
@@ -42,7 +42,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import software.amazon.awssdk.services.dynamodb.model.WriteRequest;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -84,7 +83,7 @@ public abstract class BaseSegmentScanIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java
index 0c10af2..ac300ea 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Random;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -109,7 +108,7 @@ public class BatchGetItem2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java
index be80d4a..f7a0257 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java
@@ -42,7 +42,6 @@ import software.amazon.awssdk.services.dynamodb.model.PutItemRequest;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -74,7 +73,7 @@ public class BatchGetItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java
index 483c814..75b6ea2 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Random;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -98,7 +97,7 @@ public class BatchWriteItem2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java
index 271c789..12e413b 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java
@@ -46,7 +46,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import software.amazon.awssdk.services.dynamodb.model.WriteRequest;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -76,7 +75,7 @@ public class BatchWriteItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java
index ebcb96d..fa519b0 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
@@ -36,7 +35,9 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.core.SdkBytes;
@@ -103,15 +104,18 @@ public class BinaryEndToEndIT {
private static String tmpDir;
private static RESTServer restServer = null;
- private static String TABLE_NAME = "Binary.PK_Test-Table";
- private static String INDEX_NAME = "Binary.PK_Test-Index";
+ private String tableName;
+ private String indexName;
private static Random random = new Random(42);
+ @Rule
+ public TestName testName = new TestName();
+
@BeforeClass
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
@@ -154,9 +158,11 @@ public class BinaryEndToEndIT {
@Before
public void createTableAndIndex() {
- CreateTableRequest request = CreateTableRequest.builder().tableName(TABLE_NAME)
+ tableName = "Binary.PK_Test-Table_" + testName.getMethodName();
+ indexName = "Binary.PK_Test-Index_" + testName.getMethodName();
+ CreateTableRequest request = CreateTableRequest.builder().tableName(tableName)
.billingMode(BillingMode.PAY_PER_REQUEST).globalSecondaryIndexes(Arrays.asList(
- GlobalSecondaryIndex.builder().indexName(INDEX_NAME).keySchema(
+ GlobalSecondaryIndex.builder().indexName(indexName).keySchema(
Arrays.asList(KeySchemaElement.builder()
.attributeName("index_hk").keyType(
KeyType.HASH)
@@ -191,7 +197,7 @@ public class BinaryEndToEndIT {
@After
public void deleteTable() {
- DeleteTableRequest request = DeleteTableRequest.builder().tableName(TABLE_NAME).build();
+ DeleteTableRequest request = DeleteTableRequest.builder().tableName(tableName).build();
phoenixDBClientV2.deleteTable(request);
dynamoDbClient.deleteTable(request);
}
@@ -199,36 +205,36 @@ public class BinaryEndToEndIT {
@Test
public void putThenGetItem() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
Map<String, AttributeValue> key = getKey(item);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void putThenDeleteItem() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
Map<String, AttributeValue> key = getKey(item);
- DeleteItemRequest del = DeleteItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ DeleteItemRequest del = DeleteItemRequest.builder().tableName(tableName).key(key).build();
dynamoDbClient.deleteItem(del);
phoenixDBClientV2.deleteItem(del);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void getNonExistentItem() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
Map<String, AttributeValue> key = getKey(getItem(2));
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@@ -239,7 +245,7 @@ public class BinaryEndToEndIT {
exprAttrNames.put("#1", "hk");
exprAttrNames.put("#2", "sk");
PutItemRequest pir = PutItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.item(item)
.expressionAttributeNames(exprAttrNames)
.conditionExpression("attribute_not_exists(#1) AND attribute_not_exists(#2)")
@@ -247,14 +253,14 @@ public class BinaryEndToEndIT {
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
Map<String, AttributeValue> key = getKey(item);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void putWithConditionThatFails() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -264,7 +270,7 @@ public class BinaryEndToEndIT {
Map<String, AttributeValue> exprAttrVals = new HashMap<>();
exprAttrVals.put(":v1", item.get("index_sk"));
pir = PutItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.item(item)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVals)
@@ -278,14 +284,14 @@ public class BinaryEndToEndIT {
} catch (ConditionalCheckFailedException expected) {}
Map<String, AttributeValue> key = getKey(item);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void deleteWithConditionThatSucceeds() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -295,7 +301,7 @@ public class BinaryEndToEndIT {
Map<String, AttributeValue> exprAttrVals = new HashMap<>();
exprAttrVals.put(":v1", item.get("index_hk"));
DeleteItemRequest del = DeleteItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVals)
@@ -304,14 +310,14 @@ public class BinaryEndToEndIT {
dynamoDbClient.deleteItem(del);
phoenixDBClientV2.deleteItem(del);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void deleteWithConditionThatFails() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -322,7 +328,7 @@ public class BinaryEndToEndIT {
byte[] index_sk_val = new byte[]{0, 0, 0};
exprAttrVals.put(":v1", AttributeValue.builder().b(SdkBytes.fromByteArray(index_sk_val)).build());
DeleteItemRequest del = DeleteItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVals)
@@ -335,30 +341,30 @@ public class BinaryEndToEndIT {
phoenixDBClientV2.deleteItem(del);
} catch (ConditionalCheckFailedException expected) {}
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void deleteNonExistentItem() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
Map<String, AttributeValue> key = getKey(getItem(2));
- DeleteItemRequest del = DeleteItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ DeleteItemRequest del = DeleteItemRequest.builder().tableName(tableName).key(key).build();
dynamoDbClient.deleteItem(del);
phoenixDBClientV2.deleteItem(del);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(getKey(item)).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(getKey(item)).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
- public void putThenUpdateItemAndScanIndex() throws SQLException {
+ public void putThenUpdateItemAndScanIndex() throws SQLException, InterruptedException {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -370,7 +376,7 @@ public class BinaryEndToEndIT {
exprAttrVal.put(":v1", AttributeValue.builder().b(SdkBytes.fromByteArray(new byte[] {0, 0})).build());
exprAttrVal.put(":v2", AttributeValue.builder().b(SdkBytes.fromByteArray(new byte[] {1, 1})).build());
UpdateItemRequest uir = UpdateItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVal)
@@ -380,10 +386,11 @@ public class BinaryEndToEndIT {
dynamoDbClient.updateItem(uir);
phoenixDBClientV2.updateItem(uir);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(getKey(item)).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(getKey(item)).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
- ScanRequest sr = ScanRequest.builder().tableName(TABLE_NAME).indexName(INDEX_NAME).build();
+ ScanRequest sr = ScanRequest.builder().tableName(tableName).indexName(indexName).build();
+ Thread.sleep(20000);
Assert.assertEquals(dynamoDbClient.scan(sr).items(), phoenixDBClientV2.scan(sr).items());
TestUtils.validateIndexUsed(sr, url, "FULL SCAN ");
}
@@ -391,7 +398,7 @@ public class BinaryEndToEndIT {
@Test
public void updateWithConditionThatSucceeds() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -405,7 +412,7 @@ public class BinaryEndToEndIT {
exprAttrVal.put(":v2", AttributeValue.builder().b(SdkBytes.fromByteArray(new byte[] {1, 1})).build());
exprAttrVal.put(":v3", AttributeValue.builder().n("3").build());
UpdateItemRequest uir = UpdateItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVal)
@@ -416,14 +423,14 @@ public class BinaryEndToEndIT {
dynamoDbClient.updateItem(uir);
phoenixDBClientV2.updateItem(uir);
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(getKey(item)).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(getKey(item)).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
public void updateWithConditionThatFails() {
Map<String, AttributeValue> item = getItem(1);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
@@ -437,7 +444,7 @@ public class BinaryEndToEndIT {
exprAttrVal.put(":v2", AttributeValue.builder().b(SdkBytes.fromByteArray(new byte[] {1, 1})).build());
exprAttrVal.put(":v3", AttributeValue.builder().n("0").build());
UpdateItemRequest uir = UpdateItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(exprAttrNames)
.expressionAttributeValues(exprAttrVal)
@@ -452,18 +459,18 @@ public class BinaryEndToEndIT {
phoenixDBClientV2.updateItem(uir);
} catch (ConditionalCheckFailedException expected) {}
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(getKey(item)).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(getKey(item)).build();
Assert.assertEquals(dynamoDbClient.getItem(gir).item(), phoenixDBClientV2.getItem(gir).item());
}
@Test
- public void batchWriteItems() throws SQLException {
+ public void batchWriteItems() throws SQLException, InterruptedException {
Map<String, AttributeValue> item1 = getItem(1);
- PutItemRequest pir1 = PutItemRequest.builder().tableName(TABLE_NAME).item(item1).build();
+ PutItemRequest pir1 = PutItemRequest.builder().tableName(tableName).item(item1).build();
dynamoDbClient.putItem(pir1);
phoenixDBClientV2.putItem(pir1);
Map<String, AttributeValue> item2 = getItem(2);
- PutItemRequest pir2 = PutItemRequest.builder().tableName(TABLE_NAME).item(item2).build();
+ PutItemRequest pir2 = PutItemRequest.builder().tableName(tableName).item(item2).build();
dynamoDbClient.putItem(pir2);
phoenixDBClientV2.putItem(pir2);
@@ -477,15 +484,16 @@ public class BinaryEndToEndIT {
writeReqs.add(WriteRequest.builder().deleteRequest(
DeleteRequest.builder().key(getKey(item2)).build()).build());
Map<String, List<WriteRequest>> requestItems = new HashMap<>();
- requestItems.put(TABLE_NAME, writeReqs);
+ requestItems.put(tableName, writeReqs);
BatchWriteItemRequest bwir = BatchWriteItemRequest.builder().requestItems(requestItems).build();
dynamoDbClient.batchWriteItem(bwir);
phoenixDBClientV2.batchWriteItem(bwir);
- ScanRequest sr = ScanRequest.builder().tableName(TABLE_NAME).build();
+ ScanRequest sr = ScanRequest.builder().tableName(tableName).build();
Assert.assertEquals(dynamoDbClient.scan(sr).items().size(), phoenixDBClientV2.scan(sr).items().size());
- sr = ScanRequest.builder().tableName(TABLE_NAME).indexName(INDEX_NAME).build();
+ sr = ScanRequest.builder().tableName(tableName).indexName(indexName).build();
+ Thread.sleep(20000);
Assert.assertEquals(dynamoDbClient.scan(sr).items().size(), phoenixDBClientV2.scan(sr).items().size());
TestUtils.validateIndexUsed(sr, url, "FULL SCAN ");
}
@@ -523,7 +531,7 @@ public class BinaryEndToEndIT {
item.put("environment", AttributeValue.builder().s("development").build());
// Insert initial item
- PutItemRequest initialPir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest initialPir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(initialPir);
phoenixDBClientV2.putItem(initialPir);
@@ -544,7 +552,7 @@ public class BinaryEndToEndIT {
putExprAttrVals.put(":activeStatus", AttributeValue.builder().s("active").build());
PutItemRequest conditionalPut = PutItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.item(newItem)
.expressionAttributeNames(putExprAttrNames)
.expressionAttributeValues(putExprAttrVals)
@@ -609,7 +617,7 @@ public class BinaryEndToEndIT {
updateExprAttrVals.put(":activeStatus", AttributeValue.builder().s("active").build());
UpdateItemRequest complexUpdate = UpdateItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(updateExprAttrNames)
.expressionAttributeValues(updateExprAttrVals)
@@ -626,7 +634,7 @@ public class BinaryEndToEndIT {
phoenixDBClientV2.updateItem(complexUpdate);
// Verify the update worked
- GetItemRequest gir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest gir = GetItemRequest.builder().tableName(tableName).key(key).build();
Map<String, AttributeValue> dynamoResult = dynamoDbClient.getItem(gir).item();
Map<String, AttributeValue> phoenixResult = phoenixDBClientV2.getItem(gir).item();
Assert.assertEquals("Results should match after complex update", dynamoResult, phoenixResult);
@@ -651,7 +659,7 @@ public class BinaryEndToEndIT {
deleteExprAttrVals.put(":recentTime", AttributeValue.builder().n(String.valueOf(System.currentTimeMillis() - 60000)).build()); // 1 minute ago
DeleteItemRequest complexDelete = DeleteItemRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.key(key)
.expressionAttributeNames(deleteExprAttrNames)
.expressionAttributeValues(deleteExprAttrVals)
@@ -665,7 +673,7 @@ public class BinaryEndToEndIT {
phoenixDBClientV2.deleteItem(complexDelete);
// Verify the item was deleted
- GetItemRequest finalGir = GetItemRequest.builder().tableName(TABLE_NAME).key(key).build();
+ GetItemRequest finalGir = GetItemRequest.builder().tableName(tableName).key(key).build();
Assert.assertEquals("Item should be deleted from both systems",
dynamoDbClient.getItem(finalGir).item(),
phoenixDBClientV2.getItem(finalGir).item());
@@ -683,7 +691,7 @@ public class BinaryEndToEndIT {
Map<String, AttributeValue> item = getItem(i);
item.put("hk", AttributeValue.builder().b(SdkBytes.fromByteArray(hk)).build());
items.add(item);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
}
@@ -703,13 +711,13 @@ public class BinaryEndToEndIT {
exprVals.put(":hk", AttributeValue.builder().b(SdkBytes.fromByteArray(hk)).build());
exprVals.put(":startSk", AttributeValue.builder().b(SdkBytes.fromByteArray(startSk)).build());
exprVals.put(":endSk", AttributeValue.builder().b(SdkBytes.fromByteArray(endSk)).build());
- QueryRequest.Builder qr = QueryRequest.builder().tableName(TABLE_NAME)
+ QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName)
.keyConditionExpression("hk = :hk AND sk BETWEEN :startSk AND :endSk")
.projectionExpression("payload")
.limit(2)
.expressionAttributeValues(exprVals);
TestUtils.compareQueryOutputs(qr, phoenixDBClientV2, dynamoDbClient);
- qr = QueryRequest.builder().tableName(TABLE_NAME)
+ qr = QueryRequest.builder().tableName(tableName)
.keyConditionExpression("hk = :hk AND sk BETWEEN :startSk AND :endSk")
.projectionExpression("payload")
.limit(2)
@@ -719,16 +727,16 @@ public class BinaryEndToEndIT {
}
@Test
- public void queryIndexForwardWithPagination() {
+ public void queryIndexForwardWithPagination() throws InterruptedException {
queryIndexWithPagination(true);
}
@Test
- public void queryIndexBackwardWithPagination() {
+ public void queryIndexBackwardWithPagination() throws InterruptedException {
queryIndexWithPagination(false);
}
- private void queryIndexWithPagination(boolean scanIndexForward) {
+ private void queryIndexWithPagination(boolean scanIndexForward) throws InterruptedException {
//insert items with same index_hk, different index_sk
byte[] index_hk = new byte[15];
random.nextBytes(index_hk);
@@ -737,7 +745,7 @@ public class BinaryEndToEndIT {
Map<String, AttributeValue> item = getItem(i);
item.put("index_hk", AttributeValue.builder().b(SdkBytes.fromByteArray(index_hk)).build());
items.add(item);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
}
@@ -757,17 +765,18 @@ public class BinaryEndToEndIT {
exprVals.put(":indexHk", AttributeValue.builder().b(SdkBytes.fromByteArray(index_hk)).build());
exprVals.put(":startIndexSk", AttributeValue.builder().b(SdkBytes.fromByteArray(startSk)).build());
exprVals.put(":endIndexSk", AttributeValue.builder().b(SdkBytes.fromByteArray(endSk)).build());
- QueryRequest.Builder qr = QueryRequest.builder().tableName(TABLE_NAME).indexName(INDEX_NAME)
+ QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName).indexName(indexName)
.keyConditionExpression("index_hk = :indexHk AND index_sk BETWEEN :startIndexSk AND :endIndexSk")
.projectionExpression("payload")
.limit(3)
.expressionAttributeValues(exprVals)
.scanIndexForward(scanIndexForward);
+ Thread.sleep(20000);
TestUtils.compareQueryOutputs(qr, phoenixDBClientV2, dynamoDbClient);
}
@Test
- public void queryIndexWithEqualsSortKeyAndPagination() {
+ public void queryIndexWithEqualsSortKeyAndPagination() throws InterruptedException {
// Common GSI key values (like Phoenix test: GSI_HK and GSI_SK are the same for all rows)
byte[] gsiHk = new byte[]{0x00, 0x00, 0x00, 0x0A}; // GSI hash key
byte[] gsiSk = "1".getBytes(); // GSI sort key = "1"
@@ -803,12 +812,12 @@ public class BinaryEndToEndIT {
item3.put("data", AttributeValue.builder().s("row3").build());
// Insert all rows
- dynamoDbClient.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item1).build());
- phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item1).build());
- dynamoDbClient.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item2).build());
- phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item2).build());
- dynamoDbClient.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item3).build());
- phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(TABLE_NAME).item(item3).build());
+ dynamoDbClient.putItem(PutItemRequest.builder().tableName(tableName).item(item1).build());
+ phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(tableName).item(item1).build());
+ dynamoDbClient.putItem(PutItemRequest.builder().tableName(tableName).item(item2).build());
+ phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(tableName).item(item2).build());
+ dynamoDbClient.putItem(PutItemRequest.builder().tableName(tableName).item(item3).build());
+ phoenixDBClientV2.putItem(PutItemRequest.builder().tableName(tableName).item(item3).build());
// Query GSI with index_hk = gsiHk AND index_sk = gsiSk (EQUALS on sort key)
Map<String, AttributeValue> exprVals = new HashMap<>();
@@ -816,12 +825,13 @@ public class BinaryEndToEndIT {
exprVals.put(":indexSk", AttributeValue.builder().b(SdkBytes.fromByteArray(gsiSk)).build());
QueryRequest.Builder qr = QueryRequest.builder()
- .tableName(TABLE_NAME)
- .indexName(INDEX_NAME)
+ .tableName(tableName)
+ .indexName(indexName)
.keyConditionExpression("index_hk = :indexHk AND index_sk = :indexSk")
.limit(1)
.expressionAttributeValues(exprVals);
+ Thread.sleep(20000);
TestUtils.compareQueryOutputs(qr, phoenixDBClientV2, dynamoDbClient);
}
@@ -831,14 +841,14 @@ public class BinaryEndToEndIT {
for (int i = 0; i < 100; i++) {
Map<String, AttributeValue> item = getItem(i);
items.add(item);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
}
Map<String, AttributeValue> exprAttrValues = new HashMap<>();
exprAttrValues.put(":val", items.get(45).get("index_hk"));
ScanRequest.Builder sr = ScanRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(tableName)
.limit(7)
.projectionExpression("index_sk")
.filterExpression("index_hk > :val")
@@ -864,25 +874,26 @@ public class BinaryEndToEndIT {
}
@Test
- public void scanIndexWithFilterProjectionAndPagination() {
+ public void scanIndexWithFilterProjectionAndPagination() throws InterruptedException {
List<Map<String, AttributeValue>> items = new ArrayList<>();
for (int i = 0; i < 100; i++) {
Map<String, AttributeValue> item = getItem(i);
items.add(item);
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
}
Map<String, AttributeValue> exprAttrValues = new HashMap<>();
exprAttrValues.put(":val", items.get(78).get("index_sk"));
ScanRequest.Builder sr = ScanRequest.builder()
- .tableName(TABLE_NAME)
- .indexName(INDEX_NAME)
+ .tableName(tableName)
+ .indexName(indexName)
.limit(7)
.projectionExpression("sk")
.filterExpression("index_sk < :val")
.expressionAttributeValues(exprAttrValues);
List<Map<String, AttributeValue>> phoenixResult = new ArrayList<>();
+ Thread.sleep(20000);
ScanResponse phoenixResponse;
do {
phoenixResponse = phoenixDBClientV2.scan(sr.build());
@@ -908,16 +919,16 @@ public class BinaryEndToEndIT {
for (int i = 0; i < 20; i++) {
Map<String, AttributeValue> item = getItem(i);
keys.add(getKey(item));
- PutItemRequest pir = PutItemRequest.builder().tableName(TABLE_NAME).item(item).build();
+ PutItemRequest pir = PutItemRequest.builder().tableName(tableName).item(item).build();
dynamoDbClient.putItem(pir);
phoenixDBClientV2.putItem(pir);
}
KeysAndAttributes keysAndAttr = KeysAndAttributes.builder().keys(keys.subList(11, 19)).projectionExpression("payload").build();
Map<String, KeysAndAttributes> requestItems = new HashMap<>();
- requestItems.put(TABLE_NAME, keysAndAttr);
+ requestItems.put(tableName, keysAndAttr);
BatchGetItemRequest bgir = BatchGetItemRequest.builder().requestItems(requestItems).build();
- List<Map<String, AttributeValue>> ddbItems = dynamoDbClient.batchGetItem(bgir).responses().get(TABLE_NAME);
- List<Map<String, AttributeValue>> phoenixItems = phoenixDBClientV2.batchGetItem(bgir).responses().get(TABLE_NAME);
+ List<Map<String, AttributeValue>> ddbItems = dynamoDbClient.batchGetItem(bgir).responses().get(tableName);
+ List<Map<String, AttributeValue>> phoenixItems = phoenixDBClientV2.batchGetItem(bgir).responses().get(tableName);
Assert.assertEquals(ddbItems.size(), phoenixItems.size());
for (Map<String, AttributeValue> item : ddbItems) {
Assert.assertTrue(phoenixItems.contains(item));
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java
index 30fe906..7470e24 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java
@@ -1,7 +1,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -66,7 +65,7 @@ public class BinaryStreamsIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java
index 31de329..4948577 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -73,7 +72,7 @@ public class ConditionalPutItem2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java
index 04d48a1..6830f1e 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.ddb.bson.BsonDocumentToDdbAttributes;
@@ -26,6 +25,7 @@ import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -82,11 +82,12 @@ public class ConditionalPutItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
@@ -257,6 +258,7 @@ public class ConditionalPutItemIT {
BsonDocumentToDdbAttributes.getFullItem(rowBsonDoc);
Assert.assertEquals(phoenixItem, dynamoItem);
+ TestUtils.waitForEventualConsistentIndex();
//check no update to index row [123, val1, (val1, 123)]
rs = connection.createStatement().executeQuery(
"SELECT * FROM " + PhoenixUtils.getFullTableName(
@@ -623,6 +625,7 @@ public class ConditionalPutItemIT {
BsonDocumentToDdbAttributes.getFullItem((BsonDocument) rs.getObject(2));
Assert.assertEquals(phoenixItem, item2);
+ TestUtils.waitForEventualConsistentIndex();
// check index row is updated (Id2, attr_0, COL)
rs = connection.createStatement().executeQuery(
"SELECT * FROM " + PhoenixUtils.getFullTableName(
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java
index 1ac5c9b..ebe96ea 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.ConnectionUtil;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -57,7 +56,7 @@ public class ConnectionConfigIT {
@BeforeClass
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java
index f34e56f..494e542 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java
@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -61,7 +62,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import software.amazon.awssdk.services.dynamodb.model.TableDescription;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -100,14 +100,14 @@ public class CreateTableIT {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
validateRestServerInitFailure();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
-
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
@@ -172,7 +172,7 @@ public class CreateTableIT {
TableDescription tableDescription1 = CreateTableResponse1.tableDescription();
TableDescription tableDescription2 = CreateTableResponse2.tableDescription();
DDLTestUtils.assertTableDescriptions(tableDescription1, tableDescription2);
- TestUtils.validateTableProps(url, tableName, true);
+ TestUtils.validateTableProps(url, tableName, false);
TestUtils.validateTableProps(url, tableName + "_IDX1_" + tableName, true);
TestUtils.validateTableProps(url, tableName + "_IDX2_" + tableName, true);
}
@@ -341,7 +341,7 @@ public class CreateTableIT {
dynamoDbClient.createTable(request);
phoenixDBClientV2.createTable(request);
- Thread.sleep(6000);
+ Thread.sleep(16000);
try {
dynamoDbClient.createTable(request);
Assert.fail("Expected ResourceInUseException from DynamoDB");
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java
index 154ec99..91c25dc 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java
@@ -46,7 +46,6 @@ import software.amazon.awssdk.services.dynamodb.model.ReturnValuesOnConditionChe
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
@@ -88,7 +87,7 @@ public class DeleteItem2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java
index c5fed90..6265d34 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java
@@ -54,7 +54,6 @@ import software.amazon.awssdk.services.dynamodb.model.ReturnValuesOnConditionChe
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
@@ -85,7 +84,7 @@ public class DeleteItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java
index b13fb51..b43d293 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java
@@ -37,7 +37,6 @@ import software.amazon.awssdk.services.dynamodb.model.TableDescription;
import software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -66,7 +65,7 @@ public class DeleteTableIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java
index a4b2b8a..1bae2d6 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java
@@ -37,7 +37,6 @@ import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -77,7 +76,7 @@ public class DescribeContinuousBackupsIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put("hbase.coprocessor.master.classes", PhoenixMasterObserver.class.getName());
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java
index b8492b4..05aff16 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java
@@ -19,7 +19,6 @@ package org.apache.phoenix.ddb;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
@@ -92,7 +91,7 @@ public class DescribeStreamIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(3);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java
index aa19bcc..f45db9e 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java
@@ -37,12 +37,12 @@ import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import software.amazon.awssdk.services.dynamodb.model.StreamSpecification;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -76,11 +76,12 @@ public class DescribeTableIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java
index 088fe69..73fcc8f 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java
@@ -51,11 +51,11 @@ import software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -81,11 +81,12 @@ public class GetItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
@@ -370,6 +371,8 @@ public class GetItemIT {
getItemResponse2 = phoenixDBClientV2.getItem(getItemRequest);
Assert.assertEquals(getItemResponse2.item(), getItemResponse1.item());
+ TestUtils.waitForEventualConsistentIndex();
+
QueryRequest.Builder qr = QueryRequest.builder().tableName("Tablex2048hfg.shLinux");
qr.indexName("outstanding_tasks");
qr.keyConditionExpression("#0 = :v0 AND #1 = :v1");
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java
index 57bbc69..cd0a85c 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
@@ -109,7 +108,7 @@ public class GetRecordsIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(0));
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java
index c0c328b..6f910fc 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.coprocessorclient.BaseScannerRegionObserverConstants;
@@ -119,7 +118,7 @@ public class GetRecordsMultipleProducersIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java
index 65fcd06..af63056 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -90,7 +89,7 @@ public class GetRecordsSequenceNumberIT extends GetRecordsBaseTest {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java
index a5fbd2c..d8b9256 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -90,7 +89,7 @@ public class GetRecordsShardIteratorTypeIT extends GetRecordsBaseTest {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java
index 49e6483..feb9220 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
@@ -90,7 +89,7 @@ public class GetRecordsShardLineageIT extends GetRecordsBaseTest {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java
index cd221bc..6856e4d 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -112,7 +111,7 @@ public class GetRecordsStreamTypeIT extends GetRecordsBaseTest {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java
index cf58572..be7b403 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java
@@ -54,7 +54,6 @@ import software.amazon.awssdk.services.dynamodb.model.UpdateTimeToLiveRequest;
import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
@@ -98,7 +97,7 @@ public class GetRecordsTTLExpiryIT extends GetRecordsBaseTest {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java
index e22e6ad..962f936 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -84,7 +83,7 @@ public class GetShardIteratorIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/IndexSegmentScanIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/IndexSegmentScanIT.java
index 11dfaee..1af79c4 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/IndexSegmentScanIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/IndexSegmentScanIT.java
@@ -130,6 +130,8 @@ public class IndexSegmentScanIT extends BaseSegmentScanIT {
dynamoDbClient.createTable(createTableRequest);
insertItemsAndSplitIndex(tableName, indexName, TOTAL_ITEMS, SPLIT_FREQUENCY, 200);
+ TestUtils.waitForEventualConsistentIndex();
+ TestUtils.waitForEventualConsistentIndex();
Random random = new Random();
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java
index 99183fa..e74e56f 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java
@@ -41,7 +41,6 @@ import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -68,7 +67,7 @@ public class JMXMetricsIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java
index 61a1735..9eebbf5 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -74,7 +73,7 @@ public class ListStreamsIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java
index 57569b1..ce10451 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -64,7 +63,7 @@ public class ListTablesIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java
index d49804f..5033dd4 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -35,6 +34,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;
@@ -76,13 +76,11 @@ public class MappedTableIT {
private static String tmpDir;
private static RESTServer restServer = null;
- private static final String TABLE_NAME = "TEST_MAPPED_TABLE_NAME";
-
@BeforeClass
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
@@ -283,10 +281,16 @@ public class MappedTableIT {
@Rule
public ExpectedException exception = ExpectedException.none();
+ @Rule
+ public final TestName testName = new TestName();
+
+ private String currentTableName;
+
@Before
public void createTable() {
- mappedTable = ddbPhoenixEnhancedClient.table(TABLE_NAME, TABLE_SCHEMA);
- mappedShortTable = ddbPhoenixEnhancedClient.table(TABLE_NAME, SHORT_TABLE_SCHEMA);
+ currentTableName = testName.getMethodName();
+ mappedTable = ddbPhoenixEnhancedClient.table(currentTableName, TABLE_SCHEMA);
+ mappedShortTable = ddbPhoenixEnhancedClient.table(currentTableName, SHORT_TABLE_SCHEMA);
mappedTable.createTable(r -> r.globalSecondaryIndices(
EnhancedGlobalSecondaryIndex.builder()
.indexName("gsi_1")
@@ -297,7 +301,7 @@ public class MappedTableIT {
@After
public void deleteTable() {
phoenixDBClientV2.deleteTable(DeleteTableRequest.builder()
- .tableName(TABLE_NAME)
+ .tableName(currentTableName)
.build());
}
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Misc1Util.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Misc1Util.java
index 398b6ac..e7fd317 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Misc1Util.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Misc1Util.java
@@ -122,7 +122,7 @@ public class Misc1Util {
dynamoDbClient.createTable(objectsTableRequest);
phoenixDBClientV2.createTable(objectsTableRequest);
-
+ Thread.sleep(61000);
UpdateTimeToLiveRequest enableTtlRequest =
UpdateTimeToLiveRequest.builder().tableName(objectsTableName)
.timeToLiveSpecification(
@@ -849,6 +849,7 @@ public class Misc1Util {
dynamoDbClient.createTable(table2Request);
phoenixDBClientV2.createTable(table2Request);
+ Thread.sleep(61000);
int totalItems = 10000;
int numPartitions = 13;
@@ -868,6 +869,8 @@ public class Misc1Util {
batchDeleteItems(dynamoDbClient, phoenixDBClientV2, table1Name, table1ItemsToDelete);
batchDeleteItems(dynamoDbClient, phoenixDBClientV2, table2Name, table2ItemsToDelete);
+ TestUtils.waitForEventualConsistentIndex();
+
for (int partitionId = 0; partitionId < numPartitions; partitionId++) {
String pkValueTable1 = "pk_" + partitionId + "_t1";
String pkValueTable2 = "pk_" + partitionId + "_t2";
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java
index 12df45e..343e49c 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java
@@ -43,7 +43,6 @@ import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse;
import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -77,7 +76,7 @@ public class MiscIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
props.put("hbase.coprocessor.master.classes", PhoenixMasterObserver.class.getName());
@@ -115,19 +114,19 @@ public class MiscIT {
System.setProperty("java.io.tmpdir", tmpDir);
}
- @Test
+ @Test(timeout = 240000)
public void testMixWorkflows1() throws Exception {
Misc1Util.test1(dynamoDbClient, phoenixDBClientV2, dynamoDbStreamsClient,
phoenixDBStreamsClientV2);
}
- @Test
+ @Test(timeout = 120000)
public void testMixWorkflows2() throws Exception {
Misc1Util.test2(dynamoDbClient, phoenixDBClientV2, dynamoDbStreamsClient,
phoenixDBStreamsClientV2);
}
- @Test
+ @Test(timeout = 600000)
public void testMixWorkflows4() throws Exception {
Misc1Util.test3(dynamoDbClient, phoenixDBClientV2, dynamoDbStreamsClient,
phoenixDBStreamsClientV2);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java
index bdfc408..61739a4 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java
@@ -46,13 +46,13 @@ import software.amazon.awssdk.services.dynamodb.model.ReturnValuesOnConditionChe
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.bson.BsonDocumentToDdbAttributes;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -78,11 +78,12 @@ public class PutItemIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
@@ -248,6 +249,7 @@ public class PutItemIT {
//TODO: uncomment when we have utility to compare sets
//Assert.assertEquals(dynamoItem, phoenixItem);
+ TestUtils.waitForEventualConsistentIndex();
// check index row (Title, attr_0, attr1, COL)
rs = connection.createStatement().executeQuery(
"SELECT * FROM " + PhoenixUtils.getFullTableName(
@@ -291,6 +293,7 @@ public class PutItemIT {
phoenixDBClientV2.putItem(getPutItemRequestForIndexSortingTest(tableName, "val8", "0"));
phoenixDBClientV2.putItem(getPutItemRequestForIndexSortingTest(tableName, "val9", "0.123"));
+ TestUtils.waitForEventualConsistentIndex();
// check index rows are sorted
try (Connection connection = DriverManager.getConnection(url)) {
ResultSet rs = connection.createStatement().executeQuery(
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java
index 9d75020..6c948bd 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java
@@ -42,7 +42,6 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -77,7 +76,7 @@ public class Query2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java
index 1616c75..d18491e 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java
@@ -42,7 +42,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import software.amazon.awssdk.services.dynamodb.model.Select;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -73,7 +72,7 @@ public class QueryIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java
index 58fa05c..fb86f92 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -39,7 +40,6 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -72,13 +72,14 @@ public class QueryIndex1IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
@@ -143,6 +144,7 @@ public class QueryIndex1IT {
Map<String, AttributeValue> exprAttrVal = new HashMap<>();
exprAttrVal.put(":v0", AttributeValue.builder().s("101.01").build());
qr.expressionAttributeValues(exprAttrVal);
+ TestUtils.waitForEventualConsistentIndex();
// query result
QueryResponse phoenixResult = phoenixDBClientV2.query(qr.build());
@@ -196,6 +198,7 @@ public class QueryIndex1IT {
Map<String, AttributeValue> exprAttrVal = new HashMap<>();
exprAttrVal.put(":v0", AttributeValue.builder().s("101.01").build());
qr.expressionAttributeValues(exprAttrVal);
+ TestUtils.waitForEventualConsistentIndex();
// query result
QueryResponse phoenixResult = phoenixDBClientV2.query(qr.build());
@@ -250,6 +253,7 @@ public class QueryIndex1IT {
exprAttrVal.put(":v0", AttributeValue.builder().s("101.01").build());
exprAttrVal.put(":v1", AttributeValue.builder().n("2.1").build());
qr.expressionAttributeValues(exprAttrVal);
+ TestUtils.waitForEventualConsistentIndex();
// query result
QueryResponse phoenixResult = phoenixDBClientV2.query(qr.build());
@@ -307,6 +311,7 @@ public class QueryIndex1IT {
exprAttrVal.put(":v0", AttributeValue.builder().s("101.01").build());
exprAttrVal.put(":v1", AttributeValue.builder().n("2.1").build());
qr.expressionAttributeValues(exprAttrVal);
+ TestUtils.waitForEventualConsistentIndex();
// query result
QueryResponse phoenixResult = phoenixDBClientV2.query(qr.build());
@@ -350,6 +355,7 @@ public class QueryIndex1IT {
dynamoDbClient.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
//query request using index
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
@@ -418,6 +424,7 @@ public class QueryIndex1IT {
exprAttrVal.put(":v0", AttributeValue.builder().s("foo").build());
qr.expressionAttributeValues(exprAttrVal);
qr.select("COUNT");
+ TestUtils.waitForEventualConsistentIndex();
// query result with count only
QueryResponse phoenixResult = phoenixDBClientV2.query(qr.build());
@@ -460,6 +467,7 @@ public class QueryIndex1IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
//query request using index with COUNT and limit for pagination
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -512,6 +520,7 @@ public class QueryIndex1IT {
PutItemRequest putItemRequest1 = PutItemRequest.builder().tableName(tableName).item(getItem1()).build();
phoenixDBClientV2.putItem(putItemRequest1);
dynamoDbClient.putItem(putItemRequest1);
+ TestUtils.waitForEventualConsistentIndex();
//query request using index with ALL_ATTRIBUTES (no projectionExpression)
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
@@ -598,6 +607,7 @@ public class QueryIndex1IT {
phoenixDBClientV2.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest1);
dynamoDbClient.putItem(putItemRequest2);
+ TestUtils.waitForEventualConsistentIndex();
//query request using index with sort key condition before partition key
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
@@ -647,6 +657,7 @@ public class QueryIndex1IT {
phoenixDBClientV2.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest1);
dynamoDbClient.putItem(putItemRequest2);
+ TestUtils.waitForEventualConsistentIndex();
//query request using index with begins_with before partition key
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java
index dc964f8..e966128 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java
@@ -44,11 +44,11 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -78,13 +78,14 @@ public class QueryIndex2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
@@ -139,6 +140,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -198,6 +201,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -252,6 +257,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -306,6 +313,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -358,6 +367,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -410,6 +421,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -519,6 +532,8 @@ public class QueryIndex2IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
// Test 1: begins_with with String attribute using FilterExpression
QueryRequest.Builder qr1 = QueryRequest.builder().tableName(tableName);
qr1.indexName(indexName);
@@ -831,6 +846,8 @@ public class QueryIndex2IT {
putItemsForQueryWithContainsFilter(tableName);
+ TestUtils.waitForEventualConsistentIndex();
+
// Test 1: contains() with String attribute - substring search
QueryRequest.Builder qr1 = QueryRequest.builder().tableName(tableName);
qr1.indexName(indexName);
@@ -1046,6 +1063,8 @@ public class QueryIndex2IT {
putItemsForQueryWithSizeFilter(tableName);
+ TestUtils.waitForEventualConsistentIndex();
+
// Test 1: size() with String attribute - find strings longer than 5 characters
QueryRequest.Builder qr1 = QueryRequest.builder().tableName(tableName);
qr1.indexName(indexName);
@@ -1117,6 +1136,8 @@ public class QueryIndex2IT {
putItemsForQueryWithAttributeTypeFilter(tableName);
+ TestUtils.waitForEventualConsistentIndex();
+
// Test 1: attribute_type() for String attribute - find items with String titles
QueryRequest.Builder qr1 = QueryRequest.builder().tableName(tableName);
qr1.indexName(indexName);
@@ -1463,6 +1484,8 @@ public class QueryIndex2IT {
insertItems(tableName);
+ TestUtils.waitForEventualConsistentIndex();
+
QueryRequest.Builder qr1 = QueryRequest.builder().tableName(tableName).indexName(indexName);
qr1.keyConditionExpression("category = :cat");
Map<String, AttributeValue> exprAttrVal1 = new HashMap<>();
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java
index 87db3f4..fefeb64 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java
@@ -42,11 +42,11 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -77,13 +77,14 @@ public class QueryIndex3IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
@@ -143,6 +144,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -208,6 +211,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -266,6 +271,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest3);
+ TestUtils.waitForEventualConsistentIndex();
+
// Query with index using KeyConditions and QueryFilter with OR operator
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -325,6 +332,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -385,6 +394,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -444,6 +455,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
@@ -503,6 +516,8 @@ public class QueryIndex3IT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
//query request using index and filter with KeyConditions
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java
index 2073a99..51660c8 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java
@@ -25,11 +25,11 @@ import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
import org.junit.AfterClass;
@@ -68,13 +68,14 @@ public class QueryIndex4IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
@@ -83,6 +84,7 @@ public class QueryIndex4IT {
dynamoDbClient = LocalDynamoDbTestBase.localDynamoDb().createV2Client();
createTableAndInsertData();
+ TestUtils.waitForEventualConsistentIndex();
}
private static void createTableAndInsertData() {
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java
index 650dc81..8c60f1f 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java
@@ -41,11 +41,11 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.ServerUtil;
import static org.apache.phoenix.ddb.TestUtils.verifyItemsEqual;
@@ -57,13 +57,15 @@ import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster;
public class QueryIndexExclusiveStartKeyIT {
private static final Logger LOGGER = LoggerFactory.getLogger(QueryIndexExclusiveStartKeyIT.class);
- private final DynamoDbClient dynamoDbClient =
- LocalDynamoDbTestBase.localDynamoDb().createV2Client();
+ private static DynamoDbClient dynamoDbClient;
private static DynamoDbClient phoenixDBClientV2;
private static HBaseTestingUtility utility;
private static RESTServer restServer;
private static String tmpDir;
+ private static final Map<String, String> TABLE_NAMES = new HashMap<>();
+ private static final Map<String, String> INDEX_NAMES = new HashMap<>();
+
private final boolean tableHasSK;
private final boolean indexHasSK;
private final int limit;
@@ -93,13 +95,30 @@ public class QueryIndexExclusiveStartKeyIT {
public static void setup() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
restServer.run();
+ dynamoDbClient = LocalDynamoDbTestBase.localDynamoDb().createV2Client();
phoenixDBClientV2 = LocalDynamoDB.createV2Client("http://" + restServer.getServerAddress());
+
+ boolean[] vals = {false, true};
+ for (boolean tableSK : vals) {
+ for (boolean indexSK : vals) {
+ String key = tableSK + "_" + indexSK;
+ String tableName = generateUniqueName() + "_" + tableSK + "_" + indexSK;
+ String indexName = "GSI_" + generateUniqueName();
+ TABLE_NAMES.put(key, tableName);
+ INDEX_NAMES.put(key, indexName);
+ createTableAndIndex(tableName, indexName, tableSK, indexSK);
+ insertItems(tableName, 200, tableSK, indexSK);
+ }
+ }
+ TestUtils.waitForEventualConsistentIndex();
+ TestUtils.waitForEventualConsistentIndex();
}
@AfterClass
@@ -116,13 +135,11 @@ public class QueryIndexExclusiveStartKeyIT {
System.setProperty("java.io.tmpdir", tmpDir);
}
- @Test(timeout = 18000)
+ @Test(timeout = 120000)
public void testIndexQueryPagination() {
- String tableName = generateUniqueName() + "_" + tableHasSK + "_" + indexHasSK + "_" + limit;
- String indexName = "GSI_" + generateUniqueName();
-
- createTableAndIndex(tableName, indexName);
- insertItems(tableName, 200);
+ String key = tableHasSK + "_" + indexHasSK;
+ String tableName = TABLE_NAMES.get(key);
+ String indexName = INDEX_NAMES.get(key);
// Forward scan
List<Map<String, AttributeValue>> phoenixItems = queryAllPages(phoenixDBClientV2, tableName, indexName, true);
@@ -147,7 +164,8 @@ public class QueryIndexExclusiveStartKeyIT {
verifyItemsEqual(dynamoItemsRev, phoenixItemsRev, "hk", tableHasSK ? "sk" : null);
}
- private void createTableAndIndex(String tableName, String indexName) {
+ private static void createTableAndIndex(String tableName, String indexName,
+ boolean tableHasSK, boolean indexHasSK) {
CreateTableRequest req = DDLTestUtils.getCreateTableRequest(
tableName, "hk", ScalarAttributeType.S,
tableHasSK ? "sk" : null, tableHasSK ? ScalarAttributeType.S : null);
@@ -160,7 +178,8 @@ public class QueryIndexExclusiveStartKeyIT {
dynamoDbClient.createTable(req);
}
- private void insertItems(String tableName, int count) {
+ private static void insertItems(String tableName, int count,
+ boolean tableHasSK, boolean indexHasSK) {
for (int i = 1; i <= count; i++) {
Map<String, AttributeValue> item = new HashMap<>();
// Create duplicates: groups of 5 share same hk when table has sk
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java
index f6ce889..68b5743 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java
@@ -40,7 +40,6 @@ import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -70,7 +69,7 @@ public class QueryProjectionIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java
index 049af57..c6388f1 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java
@@ -54,7 +54,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
import software.amazon.awssdk.services.dynamodb.streams.DynamoDbStreamsClient;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.coprocessor.PhoenixMasterObserver;
import org.apache.phoenix.ddb.rest.RESTServer;
@@ -95,7 +94,7 @@ public class ReturnItemsLimitIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
// props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java
index ffc853e..66fbf1c 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java
@@ -46,7 +46,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import software.amazon.awssdk.core.SdkBytes;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -142,7 +141,7 @@ public class ScanExclusiveStartKeyIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java
index 131b8bb..23fc0ba 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java
@@ -42,11 +42,11 @@ import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.ServerUtil;
@@ -77,7 +77,7 @@ public class ScanIndex2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
@@ -138,6 +138,8 @@ public class ScanIndex2IT {
dynamoDbClient.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest3);
+ TestUtils.waitForEventualConsistentIndex();
+
// Scan with index using ScanFilter with AND operator
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
@@ -194,6 +196,8 @@ public class ScanIndex2IT {
dynamoDbClient.putItem(putItemRequest2);
dynamoDbClient.putItem(putItemRequest3);
+ TestUtils.waitForEventualConsistentIndex();
+
// Scan with index using ScanFilter with OR operator
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
@@ -235,6 +239,8 @@ public class ScanIndex2IT {
phoenixDBClientV2.createTable(createTableRequest);
dynamoDbClient.createTable(createTableRequest);
+ TestUtils.waitForEventualConsistentIndex();
+
// Scan request with both ScanFilter and FilterExpression - should fail
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
index 6a9be8d..fceca52 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -73,7 +72,7 @@ public class ScanIndex3IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
@@ -89,6 +88,8 @@ public class ScanIndex3IT {
dynamoDbClient = LocalDynamoDbTestBase.localDynamoDb().createV2Client();
createTableAndInsertData();
+ TestUtils.waitForEventualConsistentIndex();
+ TestUtils.waitForEventualConsistentIndex();
}
private static void executeBatchWrite(String tableName, List<WriteRequest> batch) {
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java
index 26cf40d..58b20c3 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java
@@ -28,9 +28,7 @@ import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
@@ -46,7 +44,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import software.amazon.awssdk.core.SdkBytes;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -72,18 +69,32 @@ public class ScanIndexExclusiveStartKeyIT {
private static final String INDEX_HK = "idx_hk";
private static final String INDEX_SK = "idx_sk";
- private final DynamoDbClient dynamoDbClient =
- LocalDynamoDbTestBase.localDynamoDb().createV2Client();
+ private static final int NUM_HASH_KEYS = 7;
+ private static final int NUM_SORT_KEYS = 8;
+ private static final int TOTAL_ITEMS = NUM_HASH_KEYS * NUM_SORT_KEYS;
+
+ private static final KeyTypeConfig[] KEY_CONFIGS = {
+ new KeyTypeConfig("tSN_iSN", ScalarAttributeType.S, ScalarAttributeType.N,
+ ScalarAttributeType.S, ScalarAttributeType.N),
+ new KeyTypeConfig("tSS_iNS", ScalarAttributeType.S, ScalarAttributeType.S,
+ ScalarAttributeType.N, ScalarAttributeType.S),
+ new KeyTypeConfig("tNN_iSS", ScalarAttributeType.N, ScalarAttributeType.N,
+ ScalarAttributeType.S, ScalarAttributeType.S),
+ new KeyTypeConfig("tSN_iNN", ScalarAttributeType.S, ScalarAttributeType.N,
+ ScalarAttributeType.N, ScalarAttributeType.N),
+ new KeyTypeConfig("tBN_iSN", ScalarAttributeType.B, ScalarAttributeType.N,
+ ScalarAttributeType.S, ScalarAttributeType.N),
+ new KeyTypeConfig("tNS_iSB", ScalarAttributeType.N, ScalarAttributeType.S,
+ ScalarAttributeType.S, ScalarAttributeType.B),
+ };
+
+ private static DynamoDbClient dynamoDbClient;
private static DynamoDbClient phoenixDBClientV2;
- private static String url;
private static HBaseTestingUtility utility = null;
private static String tmpDir;
private static RESTServer restServer = null;
- @Rule
- public final TestName testName = new TestName();
-
public int scanLimit;
public KeyTypeConfig keyTypeConfig;
public boolean withFilter;
@@ -114,36 +125,19 @@ public class ScanIndexExclusiveStartKeyIT {
@Parameterized.Parameters(name = "limit_{0}_keyTypes_{1}_filter_{2}")
public static synchronized Collection<Object[]> data() {
List<Object[]> parameters = new ArrayList<>();
-
int[] scanLimits = {1, 2, 3, 5, 7, 10, 15};
-
- KeyTypeConfig[] keyConfigs = {
- new KeyTypeConfig("tSN_iSN", ScalarAttributeType.S, ScalarAttributeType.N,
- ScalarAttributeType.S, ScalarAttributeType.N),
- new KeyTypeConfig("tSS_iNS", ScalarAttributeType.S, ScalarAttributeType.S,
- ScalarAttributeType.N, ScalarAttributeType.S),
- new KeyTypeConfig("tNN_iSS", ScalarAttributeType.N, ScalarAttributeType.N,
- ScalarAttributeType.S, ScalarAttributeType.S),
- new KeyTypeConfig("tSN_iNN", ScalarAttributeType.S, ScalarAttributeType.N,
- ScalarAttributeType.N, ScalarAttributeType.N),
- new KeyTypeConfig("tBN_iSN", ScalarAttributeType.B, ScalarAttributeType.N,
- ScalarAttributeType.S, ScalarAttributeType.N),
- new KeyTypeConfig("tNS_iSB", ScalarAttributeType.N, ScalarAttributeType.S,
- ScalarAttributeType.S, ScalarAttributeType.B),
- };
-
for (int limit : scanLimits) {
- for (KeyTypeConfig config : keyConfigs) {
+ for (KeyTypeConfig config : KEY_CONFIGS) {
for (boolean filter : new boolean[]{false, true}) {
parameters.add(new Object[]{limit, config, filter});
}
}
}
-
return parameters;
}
- public ScanIndexExclusiveStartKeyIT(int scanLimit, KeyTypeConfig keyTypeConfig, boolean withFilter) {
+ public ScanIndexExclusiveStartKeyIT(int scanLimit, KeyTypeConfig keyTypeConfig,
+ boolean withFilter) {
this.scanLimit = scanLimit;
this.keyTypeConfig = keyTypeConfig;
this.withFilter = withFilter;
@@ -153,13 +147,14 @@ public class ScanIndexExclusiveStartKeyIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
- url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR
+ + zkQuorum;
DriverManager.registerDriver(new PhoenixTestDriver());
restServer = new RESTServer(utility.getConfiguration());
@@ -167,6 +162,42 @@ public class ScanIndexExclusiveStartKeyIT {
LOGGER.info("started {} on port {}", restServer.getClass().getName(), restServer.getPort());
phoenixDBClientV2 = LocalDynamoDB.createV2Client("http://" + restServer.getServerAddress());
+ dynamoDbClient = LocalDynamoDbTestBase.localDynamoDb().createV2Client();
+
+ createAllTablesAndInsertData();
+
+ TestUtils.waitForEventualConsistentIndex();
+ TestUtils.waitForEventualConsistentIndex();
+ }
+
+ private static void createAllTablesAndInsertData() {
+ for (KeyTypeConfig config : KEY_CONFIGS) {
+ String tableName = "SIESK_" + config.name;
+
+ CreateTableRequest createTableRequest =
+ DDLTestUtils.getCreateTableRequest(tableName, TABLE_HK,
+ config.tableHKType, TABLE_SK, config.tableSKType);
+ createTableRequest = DDLTestUtils.addIndexToRequest(true, createTableRequest,
+ INDEX_NAME, INDEX_HK, config.indexHKType,
+ INDEX_SK, config.indexSKType);
+
+ phoenixDBClientV2.createTable(createTableRequest);
+ dynamoDbClient.createTable(createTableRequest);
+
+ for (int hashIndex = 0; hashIndex < NUM_HASH_KEYS; hashIndex++) {
+ for (int sortIndex = 0; sortIndex < NUM_SORT_KEYS; sortIndex++) {
+ Map<String, AttributeValue> item =
+ createTestItem(config, hashIndex, sortIndex);
+ PutItemRequest putItemRequest = PutItemRequest.builder()
+ .tableName(tableName)
+ .item(item)
+ .build();
+ phoenixDBClientV2.putItem(putItemRequest);
+ dynamoDbClient.putItem(putItemRequest);
+ }
+ }
+ LOGGER.info("Created table {} and inserted {} items", tableName, TOTAL_ITEMS);
+ }
}
@AfterClass
@@ -187,43 +218,9 @@ public class ScanIndexExclusiveStartKeyIT {
System.setProperty("java.io.tmpdir", tmpDir);
}
- /**
- * Test scan pagination on an index where multiple items share the same (ihk, isk) pair.
- * 56 items (7 table hash keys × 8 sort keys), with index keys cycled to produce ties:
- * ihk = hashIndex % 3 → 3 distinct values
- * isk = sortIndex % 4 → 4 distinct values
- * This forces the RVC cursor to rely on the full (ihk, isk, hk, sk) tuple for correctness.
- */
- @Test(timeout = 120000)
+ @Test(timeout = 150000)
public void testScanIndexExclusiveStartKeyPagination() {
- final String tableName = testName.getMethodName().replaceAll("[\\[\\]]", "_") +
- "_limit_" + scanLimit + "_" + keyTypeConfig.name + "_filter_" + withFilter;
-
- CreateTableRequest createTableRequest =
- DDLTestUtils.getCreateTableRequest(tableName, TABLE_HK,
- keyTypeConfig.tableHKType, TABLE_SK, keyTypeConfig.tableSKType);
- createTableRequest = DDLTestUtils.addIndexToRequest(true, createTableRequest,
- INDEX_NAME, INDEX_HK, keyTypeConfig.indexHKType,
- INDEX_SK, keyTypeConfig.indexSKType);
-
- phoenixDBClientV2.createTable(createTableRequest);
- dynamoDbClient.createTable(createTableRequest);
-
- final int numHashKeys = 7;
- final int numSortKeys = 8;
- final int totalItems = numHashKeys * numSortKeys;
-
- for (int hashIndex = 0; hashIndex < numHashKeys; hashIndex++) {
- for (int sortIndex = 0; sortIndex < numSortKeys; sortIndex++) {
- Map<String, AttributeValue> item = createTestItem(hashIndex, sortIndex);
- PutItemRequest putItemRequest = PutItemRequest.builder()
- .tableName(tableName)
- .item(item)
- .build();
- phoenixDBClientV2.putItem(putItemRequest);
- dynamoDbClient.putItem(putItemRequest);
- }
- }
+ final String tableName = "SIESK_" + keyTypeConfig.name;
List<Map<String, AttributeValue>> phoenixItems = new ArrayList<>();
List<Map<String, AttributeValue>> dynamoItems = new ArrayList<>();
@@ -273,16 +270,16 @@ public class ScanIndexExclusiveStartKeyIT {
Assert.assertFalse("Should return some items", phoenixItems.isEmpty());
if (withFilter) {
Assert.assertTrue("Filter should reduce the result set",
- phoenixItems.size() < totalItems);
+ phoenixItems.size() < TOTAL_ITEMS);
} else {
Assert.assertEquals("Should return all items without filter",
- totalItems, phoenixItems.size());
+ TOTAL_ITEMS, phoenixItems.size());
}
Assert.assertTrue("Phoenix pagination should complete", phoenixPageCount > 0);
Assert.assertTrue("DynamoDB pagination should complete", dynamoPageCount > 0);
- if (scanLimit < totalItems) {
+ if (scanLimit < TOTAL_ITEMS) {
Assert.assertTrue("Should require multiple pagination rounds for limit " + scanLimit,
phoenixPageCount > 1);
}
@@ -307,17 +304,17 @@ public class ScanIndexExclusiveStartKeyIT {
}
}
- private Map<String, AttributeValue> createTestItem(int hashIndex, int sortIndex) {
+ private static Map<String, AttributeValue> createTestItem(KeyTypeConfig config,
+ int hashIndex, int sortIndex) {
Map<String, AttributeValue> item = new HashMap<>();
- item.put(TABLE_HK, createAttributeValue(keyTypeConfig.tableHKType, hashIndex, "pk"));
- item.put(TABLE_SK, createAttributeValue(keyTypeConfig.tableSKType, sortIndex, "sk"));
+ item.put(TABLE_HK, createAttributeValue(config.tableHKType, hashIndex, "pk"));
+ item.put(TABLE_SK, createAttributeValue(config.tableSKType, sortIndex, "sk"));
- // Cycle index keys to create ties: 3 distinct ihk values, 4 distinct isk values
int ihkVal = hashIndex % 3;
int iskVal = sortIndex % 4;
- item.put(INDEX_HK, createAttributeValue(keyTypeConfig.indexHKType, ihkVal, "ihk"));
- item.put(INDEX_SK, createAttributeValue(keyTypeConfig.indexSKType, iskVal, "isk"));
+ item.put(INDEX_HK, createAttributeValue(config.indexHKType, ihkVal, "ihk"));
+ item.put(INDEX_SK, createAttributeValue(config.indexSKType, iskVal, "isk"));
item.put("extra_data", AttributeValue.builder()
.s("data_" + hashIndex + "_" + sortIndex).build());
@@ -327,7 +324,7 @@ public class ScanIndexExclusiveStartKeyIT {
return item;
}
- private AttributeValue createAttributeValue(ScalarAttributeType type, int index,
+ private static AttributeValue createAttributeValue(ScalarAttributeType type, int index,
String prefix) {
switch (type) {
case S:
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java
index 7777a59..877ca71 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java
@@ -40,7 +40,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -70,7 +69,7 @@ public class ScanIndexIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
@@ -138,6 +137,8 @@ public class ScanIndexIT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.filterExpression("#0 BETWEEN :v1 AND :v2");
@@ -196,6 +197,8 @@ public class ScanIndexIT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.select("COUNT");
@@ -246,6 +249,8 @@ public class ScanIndexIT {
phoenixDBClientV2.putItem(putItemRequest1);
dynamoDbClient.putItem(putItemRequest1);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.select("ALL_ATTRIBUTES");
@@ -296,6 +301,8 @@ public class ScanIndexIT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.filterExpression("#0 BETWEEN :v1 AND :v2");
@@ -350,6 +357,8 @@ public class ScanIndexIT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.filterExpression("#1 > :v3 AND #0 BETWEEN :v1 AND :v2");
@@ -406,6 +415,8 @@ public class ScanIndexIT {
dynamoDbClient.putItem(putItemRequest3);
dynamoDbClient.putItem(putItemRequest4);
+ TestUtils.waitForEventualConsistentIndex();
+
ScanRequest.Builder sr = ScanRequest.builder().tableName(tableName);
sr.indexName(indexName);
sr.filterExpression("#0 BETWEEN :v1 AND :v2");
@@ -486,6 +497,7 @@ public class ScanIndexIT {
ScanRequest.Builder sr = ScanRequest.builder()
.tableName(tableName).indexName(indexName).limit(2);
+ TestUtils.waitForEventualConsistentIndex();
TestUtils.compareScanOutputs(sr, phoenixDBClientV2, dynamoDbClient,
"pk", null, ScalarAttributeType.S, null);
sr.exclusiveStartKey(null);
@@ -520,6 +532,7 @@ public class ScanIndexIT {
dynamoDbClient.putItem(req);
}
+ TestUtils.waitForEventualConsistentIndex();
ScanRequest.Builder sr = ScanRequest.builder()
.tableName(tableName).indexName(indexName).limit(2);
TestUtils.compareScanOutputs(sr, phoenixDBClientV2, dynamoDbClient,
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java
index 5bde30f..c3ce5ed 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java
@@ -40,7 +40,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanRequest;
import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -75,7 +74,7 @@ public class ScanTable2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java
index 18fc91e..2204710 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java
@@ -43,7 +43,6 @@ import software.amazon.awssdk.services.dynamodb.model.ScanResponse;
import software.amazon.awssdk.services.dynamodb.model.Select;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -73,7 +72,7 @@ public class ScanTableIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/SegmentScanIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/SegmentScanIT.java
index 8a168c3..242d193 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/SegmentScanIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/SegmentScanIT.java
@@ -57,7 +57,7 @@ public abstract class SegmentScanIT extends BaseSegmentScanIT {
this.filterNum = useFilter ? random.nextInt(15) + 1 : 0;
}
- @Test(timeout = 600000)
+ @Test(timeout = 900000)
public void testSegmentScan() throws Exception {
final String tableName = testName.getMethodName().replaceAll("[\\[\\]]", "_")
+ "_" + generateRandomString(7);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TestUtils.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TestUtils.java
index 432556b..5eee162 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TestUtils.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TestUtils.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import org.apache.hadoop.hbase.HBaseConfiguration;
import org.bson.BsonDocument;
import org.junit.Assert;
import org.slf4j.Logger;
@@ -184,6 +185,24 @@ public class TestUtils {
return ScanService.buildQuery(connection, request, config);
}
+ public static void waitForEventualConsistentIndex() {
+ try {
+ Thread.sleep(15000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Configuration getConfigForMiniCluster() {
+ Configuration conf = HBaseConfiguration.create();
+ conf.set("phoenix.server.page.size.ms", Integer.toString(-1));
+ conf.set("phoenix.index.cdc.consumer.retry.pause.ms", Integer.toString(100));
+ conf.set("phoenix.index.cdc.consumer.timestamp.buffer.ms", Integer.toString(1000));
+ conf.set("phoenix.index.cdc.consumer.batch.size", Integer.toString(1000));
+ return conf;
+ }
+
/**
* Wait for stream to get ENABLED.
*/
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java
index 25ff5af..df85747 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.PhoenixUtils;
@@ -80,7 +79,7 @@ public class TimeToLiveIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java
index 4beeeb0..e874125 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java
@@ -45,7 +45,6 @@ import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -75,7 +74,7 @@ public class UpdateExpressionValidationIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java
index cf06696..e2ac382 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java
@@ -53,7 +53,6 @@ import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest;
import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -96,7 +95,7 @@ public class UpdateItemBaseTests {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java
index 6c32a3c..c6f2ec1 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java
@@ -47,7 +47,6 @@ import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest;
import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -92,7 +91,7 @@ public class UpdateItemReturnValuesConcurrentIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java
index cdc8e84..4943d67 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.AsyncIndexManager;
@@ -83,7 +82,7 @@ public class UpdateTable2IT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
@@ -200,6 +199,8 @@ public class UpdateTable2IT {
dynamoDbClient.putItem(putRequest5);
dynamoDbClient.putItem(putRequest6);
+ TestUtils.waitForEventualConsistentIndex();
+
QueryRequest.Builder qr = QueryRequest.builder().tableName(tableName);
qr.indexName(indexName);
qr.keyConditionExpression("#0 = :v0");
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java
index 045d3a6..de8000b 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.ddb.utils.AsyncIndexManager;
@@ -26,6 +25,7 @@ import org.apache.phoenix.ddb.utils.PhoenixUtils;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
import org.apache.phoenix.schema.PIndexState;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.util.PhoenixRuntime;
@@ -87,11 +87,12 @@ public class UpdateTableIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
utility.startMiniCluster();
+ DriverManager.registerDriver(new PhoenixTestDriver());
String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort();
url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
@@ -231,9 +232,11 @@ public class UpdateTableIT {
//change index state
try (Connection connection = DriverManager.getConnection(url)) {
AsyncIndexManager.activateIndexesForBuilding(connection, 0);
- PTable pTable =
- connection.unwrap(PhoenixConnection.class).getTableNoCache(PhoenixUtils.getFullTableName(tableName, false));
- Assert.assertEquals(PIndexState.BUILDING, pTable.getIndexes().get(0).getIndexState());
+ PTable indexPTable =
+ connection.unwrap(PhoenixConnection.class).getTableNoCache(
+ PhoenixUtils.getFullTableName(
+ PhoenixUtils.getInternalIndexName(tableName, indexName), false));
+ Assert.assertEquals(PIndexState.BUILDING, indexPTable.getIndexState());
}
describeTableResponse = phoenixDBClientV2.describeTable(describeTableRequest);
Assert.assertEquals("CREATING",
diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java
index b65f6bf..30ea138 100644
--- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java
+++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java
@@ -18,7 +18,6 @@
package org.apache.phoenix.ddb;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.phoenix.ddb.rest.RESTServer;
import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl;
@@ -65,7 +64,7 @@ public class ValidationIT {
public static void initialize() throws Exception {
tmpDir = System.getProperty("java.io.tmpdir");
LocalDynamoDbTestBase.localDynamoDb().start();
- Configuration conf = HBaseConfiguration.create();
+ Configuration conf = TestUtils.getConfigForMiniCluster();
utility = new HBaseTestingUtility(conf);
setUpConfigForMiniCluster(conf);
diff --git a/phoenix-ddb-utils/src/main/resources/phoenix-index-options.properties b/phoenix-ddb-utils/src/main/resources/phoenix-index-options.properties
index c0badc8..3020966 100644
--- a/phoenix-ddb-utils/src/main/resources/phoenix-index-options.properties
+++ b/phoenix-ddb-utils/src/main/resources/phoenix-index-options.properties
@@ -1,2 +1,3 @@
# Phoenix Index Configuration Options
-hbase.hregion.majorcompaction=172800000
\ No newline at end of file
+hbase.hregion.majorcompaction=172800000
+CONSISTENCY=EVENTUAL
\ No newline at end of file
diff --git a/phoenix-ddb-utils/src/main/resources/phoenix-table-options.properties b/phoenix-ddb-utils/src/main/resources/phoenix-table-options.properties
index a8a44ee..bf348b1 100644
--- a/phoenix-ddb-utils/src/main/resources/phoenix-table-options.properties
+++ b/phoenix-ddb-utils/src/main/resources/phoenix-table-options.properties
@@ -3,4 +3,7 @@ IS_STRICT_TTL=false
UPDATE_CACHE_FREQUENCY=60000
phoenix.max.lookback.age.seconds=97200
hbase.hregion.majorcompaction=172800000
-org.apache.hadoop.hbase.index.lazy.post_batch.write=true
\ No newline at end of file
+org.apache.hadoop.hbase.index.lazy.post_batch.write=true
+phoenix.index.cdc.consumer.batch.size=500
+phoenix.index.cdc.mutation.serialize=false
+phoenix.index.cdc.consumer.timestamp.buffer.ms=5000
\ No newline at end of file