This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new b0a18ec93e PHOENIX-7001: Addendum to initial CDC feature (#1899)
b0a18ec93e is described below
commit b0a18ec93e00650545fa77e7d6de13c6604b5b1d
Author: Hari Krishna Dara <[email protected]>
AuthorDate: Mon Jun 3 22:50:38 2024 +0530
PHOENIX-7001: Addendum to initial CDC feature (#1899)
---
phoenix-core-client/src/main/antlr3/PhoenixSQL.g | 8 ---
.../org/apache/phoenix/jdbc/PhoenixStatement.java | 19 -------
.../apache/phoenix/parse/AlterCDCStatement.java | 58 ----------------------
.../org/apache/phoenix/parse/ParseNodeFactory.java | 8 ---
.../org/apache/phoenix/end2end/CreateTableIT.java | 5 +-
.../apache/phoenix/end2end/index/BaseIndexIT.java | 1 +
.../end2end/index/BaseIndexWithRegionMovesIT.java | 1 +
.../org/apache/phoenix/parse/QueryParserTest.java | 22 --------
8 files changed, 5 insertions(+), 117 deletions(-)
diff --git a/phoenix-core-client/src/main/antlr3/PhoenixSQL.g
b/phoenix-core-client/src/main/antlr3/PhoenixSQL.g
index feb8a19ba6..617fd5da7e 100644
--- a/phoenix-core-client/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core-client/src/main/antlr3/PhoenixSQL.g
@@ -443,7 +443,6 @@ oneStatement returns [BindableStatement ret]
| s=drop_cdc_node
| s=alter_index_node
| s=alter_table_node
- | s=alter_cdc_node
| s=show_node
| s=show_create_table_node
| s=trace_node
@@ -702,13 +701,6 @@ alter_index_node returns [AlterIndexStatement ret]
{ret = factory.alterIndex(factory.namedTable(null,
TableName.create(t.getSchemaName(), i.getName())), t.getTableName(), ex!=null,
PIndexState.valueOf(SchemaUtil.normalizeIdentifier(s.getText())),
isRebuildAll!=null, async!=null, p); }
;
-// Parse a alter CDC statement
-alter_cdc_node returns [AlterCDCStatement ret]
- : ALTER CDC (IF ex=EXISTS)? o=cdc_name ON t=from_table_name
- ((SET?) p=fam_properties)?
- {ret = factory.alterCDC(factory.namedTable(null,
TableName.create(t.getSchemaName(), o.getName())), t.getTableName(), ex!=null,
p); }
- ;
-
// Parse a trace statement.
trace_node returns [TraceStatement ret]
: TRACE ((flag = ON ( WITH SAMPLING s = sampling_rate)?) | flag = OFF)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 3bee7a33a6..f9748c0b33 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -183,7 +183,6 @@ import org.apache.phoenix.parse.UDFParseNode;
import org.apache.phoenix.parse.UpdateStatisticsStatement;
import org.apache.phoenix.parse.UpsertStatement;
import org.apache.phoenix.parse.UseSchemaStatement;
-import org.apache.phoenix.parse.AlterCDCStatement;
import org.apache.phoenix.parse.DropCDCStatement;
import org.apache.phoenix.query.HBaseFactoryProvider;
import org.apache.phoenix.query.KeyRange;
@@ -1654,19 +1653,6 @@ public class PhoenixStatement implements
PhoenixMonitoredStatement, SQLCloseable
}
}
- private static class ExecutableAlterCDCStatement extends AlterCDCStatement
implements CompilableStatement {
-
- public ExecutableAlterCDCStatement(NamedTableNode indexTableNode,
String dataTableName, boolean ifExists,
ListMultimap<String,Pair<String,Object>> props) {
- super(indexTableNode, dataTableName, ifExists, props);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public MutationPlan compilePlan(final PhoenixStatement stmt,
Sequence.ValueOp seqAction) throws SQLException {
- return null;
- }
- }
-
private static class ExecutableTraceStatement extends TraceStatement
implements CompilableStatement {
public ExecutableTraceStatement(boolean isTraceOn, double
samplingRate) {
@@ -2039,11 +2025,6 @@ public class PhoenixStatement implements
PhoenixMonitoredStatement, SQLCloseable
return new ExecutableAlterIndexStatement(indexTableNode,
dataTableName, ifExists, state, isRebuildAll, async, props);
}
- @Override
- public AlterCDCStatement alterCDC(NamedTableNode cdcTableNode, String
dataTableName, boolean ifExist, ListMultimap<String,Pair<String,Object>> props)
{
- return new ExecutableAlterCDCStatement(cdcTableNode,
dataTableName, ifExist, props);
- }
-
@Override
public TraceStatement trace(boolean isTraceOn, double samplingRate) {
return new ExecutableTraceStatement(isTraceOn, samplingRate);
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/parse/AlterCDCStatement.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/parse/AlterCDCStatement.java
deleted file mode 100644
index 9bb5f98163..0000000000
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/parse/AlterCDCStatement.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.parse;
-
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.phoenix.schema.PTableType;
-import
org.apache.phoenix.thirdparty.com.google.common.collect.ImmutableListMultimap;
-import org.apache.phoenix.thirdparty.com.google.common.collect.ListMultimap;
-
-public class AlterCDCStatement extends SingleTableStatement {
- private final String dataTableName;
- private final boolean ifExists;
- private ListMultimap<String, Pair<String,Object>> props;
- private static final PTableType tableType=PTableType.CDC;
-
- public AlterCDCStatement(NamedTableNode cdcTableNode, String
dataTableName, boolean ifExists) {
- this(cdcTableNode,dataTableName,ifExists,null);
- }
-
- public AlterCDCStatement(NamedTableNode cdcTableNode, String
dataTableName, boolean ifExists, ListMultimap<String,Pair<String,Object>>
props) {
- super(cdcTableNode,0);
- this.dataTableName = dataTableName;
- this.ifExists = ifExists;
- this.props= props==null ?
ImmutableListMultimap.<String,Pair<String,Object>>of() : props;
- }
-
- public String getTableName() {
- return dataTableName;
- }
-
- @Override
- public int getBindCount() {
- return 0;
- }
-
- public boolean ifExists() {
- return ifExists;
- }
-
- public ListMultimap<String,Pair<String,Object>> getProps() { return props;
}
-
- public PTableType getTableType(){ return tableType; }
-}
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
index 17ffa6a3f1..dc3c1835cf 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
@@ -451,14 +451,6 @@ public class ParseNodeFactory {
return new AlterIndexStatement(indexTableNode, dataTableName,
ifExists, state, false, false);
}
- public AlterCDCStatement alterCDC(NamedTableNode cdcTableNode, String
dataTableName, boolean ifExist) {
- return new AlterCDCStatement(cdcTableNode, dataTableName, ifExist);
- }
-
- public AlterCDCStatement alterCDC(NamedTableNode cdcTableNode, String
dataTableName, boolean ifExist, ListMultimap<String,Pair<String,Object>> props)
{
- return new AlterCDCStatement(cdcTableNode, dataTableName, ifExist,
props);
- }
-
public TraceStatement trace(boolean isTraceOn, double samplingRate) {
return new TraceStatement(isTraceOn, samplingRate);
}
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
index d7473e5baf..b46341cd4e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
@@ -1762,8 +1762,9 @@ public class CreateTableIT extends
ParallelStatsDisabledIT {
long endTS = EnvironmentEdgeManager.currentTimeMillis();
//Now try the PTable API
long ddlTimestamp = getLastDDLTimestamp(conn, tableFullName);
- assertTrue("PTable DDL Timestamp not in the right range!",
- ddlTimestamp >= startTS && ddlTimestamp <= endTS);
+ assertTrue("PTable DDL Timestamp: " + ddlTimestamp
+ + " not in the expected range: (" + startTS + ", " +
endTS + ")",
+ ddlTimestamp >= startTS && ddlTimestamp <= endTS);
return ddlTimestamp;
}
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexIT.java
index 2241492fe4..429dfbc159 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexIT.java
@@ -1514,6 +1514,7 @@ public abstract class BaseIndexIT extends
ParallelStatsDisabledIT {
// run the index MR job.
IndexToolIT.runIndexTool(false, TestUtil.DEFAULT_SCHEMA_NAME,
tableName, indexName);
+ TestUtil.waitForIndexState(conn, fullIndexName,
PIndexState.ACTIVE);
long activeIndexLastDDLTimestamp =
CreateTableIT.verifyLastDDLTimestamp(
fullIndexName, buildingIndexLastDDLTimestamp + 1, conn);
Thread.sleep(1);
diff --git
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexWithRegionMovesIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexWithRegionMovesIT.java
index 4905515d5c..6f4c270591 100644
---
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexWithRegionMovesIT.java
+++
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseIndexWithRegionMovesIT.java
@@ -1709,6 +1709,7 @@ public abstract class BaseIndexWithRegionMovesIT extends
ParallelStatsDisabledWi
// run the index MR job.
IndexToolIT.runIndexTool(false, TestUtil.DEFAULT_SCHEMA_NAME,
tableName, indexName);
+ TestUtil.waitForIndexState(conn, fullIndexName,
PIndexState.ACTIVE);
long activeIndexLastDDLTimestamp =
CreateTableIT.verifyLastDDLTimestamp(
fullIndexName, buildingIndexLastDDLTimestamp + 1, conn);
Thread.sleep(1);
diff --git
a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index 9983c5f7f1..91c798abf2 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -615,21 +615,6 @@ public class QueryParserTest {
parseInvalidDropCDC("drop cdc foo on bar(ts)",
SQLExceptionCode.MISSING_TOKEN.getErrorCode());
}
- private AlterCDCStatement parseAlterCDCSimple(String sql, boolean
ifNotExists) throws Exception {
- AlterCDCStatement stmt = parseQuery(sql, AlterCDCStatement.class);
- assertEquals("FOO", stmt.getTable().getName().getTableName());
- assertEquals("BAR", stmt.getTableName());
- assertEquals(ifNotExists, stmt.ifExists());
- return stmt;
- }
- @Test
- public void testAlterCDCSimple() throws Exception {
- AlterCDCStatement stmt = null;
- parseAlterCDCSimple("alter cdc foo on bar SET max_look_back=2", false);
- parseAlterCDCSimple("alter cdc if exists foo on bar SET
max_look_back=2", true);
- parseAlterCDCSimple("alter cdc if exists foo on s.bar SET
max_look_back=2", true);
- }
-
private void parseInvalidAlterCDC(String sql, int expRrrorCode) throws
IOException {
try {
parseQuery(sql);
@@ -640,13 +625,6 @@ public class QueryParserTest {
}
}
- @Test
- public void testInvalidAlterCDC() throws Exception {
- parseInvalidAlterCDC("alter cdc foo bar SET max_look_back=2",
SQLExceptionCode.MISSING_TOKEN.getErrorCode());
- parseInvalidAlterCDC("alter cdc s.foo on bar SET max_look_back=2",
SQLExceptionCode.MISMATCHED_TOKEN.getErrorCode());
- parseInvalidAlterCDC("alter cdc foo on bar(ts) SET max_look_back=2",
SQLExceptionCode.MISSING_TOKEN.getErrorCode());
- }
-
@Test
public void testNextValueForSelect() throws Exception {
String sql = ((