(phoenix) branch 5.2 updated: PHOENIX-7309 Support specifying splits.txt file while creating a table (#1931) (#1942)

2024-07-24 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch 5.2
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.2 by this push:
 new 2c1497703a PHOENIX-7309 Support specifying splits.txt file while 
creating a table (#1931) (#1942)
2c1497703a is described below

commit 2c1497703a37c1172c7a9d5a367dc3299f40d428
Author: Rushabh Shah 
AuthorDate: Wed Jul 24 09:48:41 2024 -0700

PHOENIX-7309 Support specifying splits.txt file while creating a table 
(#1931) (#1942)

(cherry picked from commit 1f88ca83f0efb576f01bdffb35becdc5ebccf58a)
---
 .../apache/phoenix/exception/SQLExceptionCode.java |   5 +-
 .../org/apache/phoenix/query/QueryConstants.java   |   2 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  54 +++
 .../org/apache/phoenix/end2end/CreateTableIT.java  | 108 +
 4 files changed, 168 insertions(+), 1 deletion(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
index c3596b4f11..cab3fa98d5 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
@@ -465,7 +465,10 @@ public enum SQLExceptionCode {
 "Missing ENCODED_QUALIFIER."),
 EXECUTE_BATCH_FOR_STMT_WITH_RESULT_SET(1151, "XCL51", "A batch operation 
can't include a "
 + "statement that produces result sets.", 
Factory.BATCH_UPDATE_ERROR),
-
+SPLITS_AND_SPLIT_FILE_EXISTS(1152, "XCL52", "Both splits and split file 
are passed"),
+// 1153 code is taken by CANNOT_DROP_CDC_INDEX
+SPLIT_FILE_DONT_EXIST(1154, "XCL54", "Either split file don't exist or is 
not a file"),
+UNABLE_TO_OPEN_SPLIT_FILE(1155, "XCL55", "Exception occurred while opening 
splits file"),
 
 /**
  * Implementation defined class. Phoenix internal error. (errorcode 20, 
sqlstate INT).
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
index a75cc7e117..e9c795eeb9 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -332,6 +332,8 @@ public interface QueryConstants {
 
 // custom TagType
 byte VIEW_MODIFIED_PROPERTY_TAG_TYPE = (byte) 70;
+String SPLITS_FILE = "SPLITS_FILE";
+
 /**
  * We mark counter values 0 to 10 as reserved. Value 0 is used by
  * {@link #ENCODED_EMPTY_COLUMN_NAME}. Values 1-10
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index ea738bfe55..e1336ec0e0 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -99,6 +99,7 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_CONSTANT;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_INDEX_ID_DATA_TYPE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_STATEMENT;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_TYPE;
+import static org.apache.phoenix.query.QueryConstants.SPLITS_FILE;
 import static org.apache.phoenix.query.QueryConstants.SYSTEM_SCHEMA_NAME;
 import static 
org.apache.phoenix.query.QueryServices.DEFAULT_DISABLE_VIEW_SUBTREE_VALIDATION;
 import static 
org.apache.phoenix.query.QueryServices.DISABLE_VIEW_SUBTREE_VALIDATION;
@@ -130,8 +131,13 @@ import static org.apache.phoenix.schema.PTableType.VIEW;
 import static org.apache.phoenix.schema.types.PDataType.FALSE_BYTES;
 import static org.apache.phoenix.schema.types.PDataType.TRUE_BYTES;
 
+import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.PreparedStatement;
@@ -966,6 +972,7 @@ public class MetaDataClient {
 Map commonFamilyProps = 
Maps.newHashMapWithExpectedSize(statement.getProps().size() + 1);
 populatePropertyMaps(statement.getProps(), tableProps, 
commonFamilyProps, statement.getTableType());
 
+splits = processSplits(tableProps, splits);
 boolean isAppendOnlySchema = false;
 long updateCacheFrequency = (Long) 
ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue(
   

(phoenix) branch master updated: PHOENIX-7309 Support specifying splits.txt file while creating a table (#1931)

2024-07-23 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 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 1f88ca83f0 PHOENIX-7309 Support specifying splits.txt file while 
creating a table (#1931)
1f88ca83f0 is described below

commit 1f88ca83f0efb576f01bdffb35becdc5ebccf58a
Author: Rushabh Shah 
AuthorDate: Tue Jul 23 09:29:03 2024 -0700

PHOENIX-7309 Support specifying splits.txt file while creating a table 
(#1931)
---
 .../apache/phoenix/exception/SQLExceptionCode.java |   5 +-
 .../org/apache/phoenix/query/QueryConstants.java   |   1 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  54 +++
 .../org/apache/phoenix/end2end/CreateTableIT.java  | 108 +
 4 files changed, 167 insertions(+), 1 deletion(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
index d36827306a..24abfc4bb4 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
@@ -485,7 +485,10 @@ public enum SQLExceptionCode {
 "Missing ENCODED_QUALIFIER."),
 EXECUTE_BATCH_FOR_STMT_WITH_RESULT_SET(1151, "XCL51", "A batch operation 
can't include a "
 + "statement that produces result sets.", 
Factory.BATCH_UPDATE_ERROR),
-
+SPLITS_AND_SPLIT_FILE_EXISTS(1152, "XCL52", "Both splits and split file 
are passed"),
+// 1153 code is taken by CANNOT_DROP_CDC_INDEX
+SPLIT_FILE_DONT_EXIST(1154, "XCL54", "Either split file don't exist or is 
not a file"),
+UNABLE_TO_OPEN_SPLIT_FILE(1155, "XCL55", "Exception occurred while opening 
splits file"),
 
 /**
  * Implementation defined class. Phoenix internal error. (errorcode 20, 
sqlstate INT).
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
index 39332d9e66..aac042b4e0 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@ -344,6 +344,7 @@ public interface QueryConstants {
 String CDC_CHANGE_IMAGE = "change_image";
 String CDC_UPSERT_EVENT_TYPE = "upsert";
 String CDC_DELETE_EVENT_TYPE = "delete";
+String SPLITS_FILE = "SPLITS_FILE";
 
 /**
  * We mark counter values 0 to 10 as reserved. Value 0 is used by
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 672deb5397..fb7b3a9595 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -25,6 +25,7 @@ import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TTL_NOT_DEFINED;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.STREAMING_TOPIC_NAME;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_TASK_TABLE;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TTL;
+import static org.apache.phoenix.query.QueryConstants.SPLITS_FILE;
 import static org.apache.phoenix.query.QueryConstants.SYSTEM_SCHEMA_NAME;
 import static 
org.apache.phoenix.query.QueryServices.INDEX_CREATE_DEFAULT_STATE;
 import static org.apache.phoenix.schema.PTableType.CDC;
@@ -134,8 +135,13 @@ import static org.apache.phoenix.schema.PTableType.VIEW;
 import static org.apache.phoenix.schema.types.PDataType.FALSE_BYTES;
 import static org.apache.phoenix.schema.types.PDataType.TRUE_BYTES;
 
+import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.PreparedStatement;
@@ -1053,6 +1059,7 @@ public class MetaDataClient {
 Map commonFamilyProps = 
Maps.newHashMapWithExpectedSize(statement.getProps().size() + 1);
 populatePropertyMaps(statement.getProps(), tableProps, 
commonFamilyProps, statement.getTableType());
 
+splits = processSplits(tableProps, splits);
 boolean isAppendOnlySchema = false;
 long updateCacheFrequency = (Long) 
ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue(
 connection.getQueryServices().getProps().get(
@@ -1150,6 +1157,53 @@ public class MetaDataClient {
 ret

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7166 : Enable feature flags introduced by metadata caching redesign (#1859)

2024-04-19 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 01a28f1f0c PHOENIX-7166 : Enable feature flags introduced by metadata 
caching redesign (#1859)
01a28f1f0c is described below

commit 01a28f1f0cccbf791d24dca0d890fdc03dd9d2ea
Author: palash 
AuthorDate: Fri Apr 19 10:20:42 2024 -0700

PHOENIX-7166 : Enable feature flags introduced by metadata caching redesign 
(#1859)
---
 .../phoenix/compile/CreateIndexCompiler.java   |  4 +-
 .../org/apache/phoenix/compile/FromCompiler.java   |  9 +++-
 .../apache/phoenix/compile/StatementContext.java   |  2 +-
 .../org/apache/phoenix/compile/UpsertCompiler.java |  2 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  | 22 ++--
 .../phoenix/query/ConnectionQueryServicesImpl.java |  4 +-
 .../apache/phoenix/query/QueryServicesOptions.java | 18 ++-
 .../org/apache/phoenix/schema/MetaDataClient.java  | 20 +--
 .../java/org/apache/phoenix/schema/TableRef.java   |  2 +-
 .../phoenix/util/ValidateLastDDLTimestampUtil.java | 14 -
 .../apache/phoenix/schema/transform/Transform.java |  6 +++
 .../phoenix/cache/ServerMetadataCacheIT.java   | 61 --
 .../phoenix/end2end/AlterTableWithViewsIT.java | 19 +++
 .../apache/phoenix/end2end/AppendOnlySchemaIT.java |  2 +-
 .../phoenix/end2end/BackwardCompatibilityIT.java   |  1 -
 .../apache/phoenix/end2end/BasePermissionsIT.java  | 51 +-
 .../org/apache/phoenix/end2end/ConnectionIT.java   |  3 ++
 .../apache/phoenix/end2end/ConnectionUtilIT.java   |  3 ++
 .../org/apache/phoenix/end2end/CreateTableIT.java  |  3 +-
 .../phoenix/end2end/LogicalTableNameBaseIT.java| 10 ++--
 .../end2end/LogicalTableNameExtendedIT.java| 21 +---
 .../MigrateSystemTablesToSystemNamespaceIT.java| 10 
 .../PartialResultServerConfigurationIT.java|  2 +
 .../SystemTablesCreationOnConnectionIT.java| 10 
 .../UpdateCacheAcrossDifferentClientsIT.java   | 17 +++---
 .../java/org/apache/phoenix/end2end/UpgradeIT.java |  4 +-
 .../end2end/index/IndexAsyncThresholdIT.java   |  4 +-
 .../end2end/index/MutableIndexFailureIT.java   |  3 ++
 .../phoenix/iterate/ScannerLeaseRenewalIT.java |  2 +
 .../jdbc/HighAvailabilityTestingUtility.java   |  7 +++
 .../jdbc/LoggingSingleConnectionLimiterIT.java |  2 +-
 .../phoenix/jdbc/ParallelPhoenixConnectionIT.java  |  1 +
 .../monitoring/PhoenixTableLevelMetricsIT.java | 53 ---
 .../phoenix/query/MaxConcurrentConnectionsIT.java  |  8 ++-
 .../apache/phoenix/query/MetaDataCachingIT.java| 19 +--
 .../rpc/UpdateCacheConnectionLevelPropIT.java  | 10 
 .../java/org/apache/phoenix/rpc/UpdateCacheIT.java | 29 --
 .../apache/phoenix/compile/WhereOptimizerTest.java |  4 +-
 .../jdbc/ParallelPhoenixConnectionFailureTest.java |  7 +--
 .../phoenix/query/BaseConnectionlessQueryTest.java |  5 +-
 .../java/org/apache/phoenix/query/BaseTest.java|  3 ++
 41 files changed, 335 insertions(+), 142 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/CreateIndexCompiler.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/CreateIndexCompiler.java
index 35d193de5f..534ce6ebaf 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/CreateIndexCompiler.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/CreateIndexCompiler.java
@@ -224,7 +224,9 @@ public class CreateIndexCompiler {
 }
 public MutationPlan compile(final CreateIndexStatement create) throws 
SQLException {
 final PhoenixConnection connection = statement.getConnection();
-final ColumnResolver resolver = FromCompiler.getResolver(create, 
connection, create.getUdfParseNodes());
+final ColumnResolver resolver
+= FromCompiler.getResolverForCreateIndex(
+create, connection, create.getUdfParseNodes());
 Scan scan = new Scan();
 final StatementContext context = new StatementContext(statement, 
resolver, scan, new SequenceManager(statement));
 verifyIndexWhere(create.getWhere(), context, 
create.getTable().getName());
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
index 15b23438b7..9d3a6b8952 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
@@ -295,9 +295,14 @@ public class FromCompiler {
 }
 }
 
-public static ColumnResolver getResolver(SingleTableStatement statement, 
PhoenixConnection connection, Map udfParseNodes)
+public

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7307 : Client should refresh its metadata cache before running EXPLAIN if last_ddl_timestamp validation is enabled (#1881)

2024-04-17 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new d6a6147453 PHOENIX-7307 : Client should refresh its metadata cache 
before running EXPLAIN if last_ddl_timestamp validation is enabled (#1881)
d6a6147453 is described below

commit d6a6147453e0b1664b72f2477d7e68b12ed735fd
Author: palash 
AuthorDate: Wed Apr 17 11:13:33 2024 -0700

PHOENIX-7307 : Client should refresh its metadata cache before running 
EXPLAIN if last_ddl_timestamp validation is enabled (#1881)
---
 .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 13 +
 1 file changed, 13 insertions(+)

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 c3c52255d2..897de9350a 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
@@ -867,6 +867,19 @@ public class PhoenixStatement implements 
PhoenixMonitoredStatement, SQLCloseable
 public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp 
seqAction) throws SQLException {
 CompilableStatement compilableStmt = getStatement();
 StatementPlan compilePlan = compilableStmt.compilePlan(stmt, 
Sequence.ValueOp.VALIDATE_SEQUENCE);
+// if client is validating timestamps, ensure its metadata cache 
is up to date.
+if (ValidateLastDDLTimestampUtil
+.getValidateLastDdlTimestampEnabled(stmt.getConnection())) 
{
+Set tableRefs = compilePlan.getSourceRefs();
+for (TableRef tableRef : tableRefs) {
+new MetaDataClient(stmt.getConnection()).updateCache(
+stmt.getConnection().getTenantId(),
+tableRef.getTable().getSchemaName().getString(),
+tableRef.getTable().getTableName().getString(),
+true);
+}
+compilePlan = compilableStmt.compilePlan(stmt, 
Sequence.ValueOp.VALIDATE_SEQUENCE);
+}
 // For a QueryPlan, we need to get its optimized plan; for a 
MutationPlan, its enclosed QueryPlan
 // has already been optimized during compilation.
 if (compilePlan instanceof QueryPlan) {



(phoenix) branch PHOENIX-6883-feature updated (7735f70c3b -> 694d6215b4)

2024-04-16 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 7735f70c3b PHOENIX-7305 : Invalidate server metadata cache when 
dropping indexes as part of DROP column (#1882)
 add 4abb39f364 PHOENIX-7302 Server Paging doesn't work on scans with limit
 add 1e96a2756e Moving valid result boolean variable at context level to 
prevent Multi threading (#1876)
 new 694d6215b4 Merge branch 'master' into PHOENIX-6883-feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/phoenix/compile/StatementContext.java   | 12 
 .../phoenix/iterate/ScanningResultIterator.java|  6 +-
 .../apache/phoenix/iterate/SerialIterators.java| 13 +++-
 .../java/org/apache/phoenix/util/ScanUtil.java | 11 +++-
 .../org/apache/phoenix/end2end/ServerPagingIT.java | 74 ++
 5 files changed, 109 insertions(+), 7 deletions(-)



(phoenix) 01/01: Merge branch 'master' into PHOENIX-6883-feature

2024-04-16 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 694d6215b4f5efca1a4ea279e769b98edd245e7e
Merge: 7735f70c3b 1e96a2756e
Author: Rushabh Shah 
AuthorDate: Tue Apr 16 13:26:48 2024 -0700

Merge branch 'master' into PHOENIX-6883-feature

 .../apache/phoenix/compile/StatementContext.java   | 12 
 .../phoenix/iterate/ScanningResultIterator.java|  6 +-
 .../apache/phoenix/iterate/SerialIterators.java| 13 +++-
 .../java/org/apache/phoenix/util/ScanUtil.java | 11 +++-
 .../org/apache/phoenix/end2end/ServerPagingIT.java | 74 ++
 5 files changed, 109 insertions(+), 7 deletions(-)



(phoenix) branch PHOENIX-6883-feature updated (124d7dbbf5 -> 7735f70c3b)

2024-04-16 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 124d7dbbf5 Merge branch 'master' into PHOENIX-6883-feature
 add 7735f70c3b PHOENIX-7305 : Invalidate server metadata cache when 
dropping indexes as part of DROP column (#1882)

No new revisions were added by this update.

Summary of changes:
 .../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java|  8 
 .../org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java   |  9 -
 .../java/org/apache/phoenix/cache/ServerMetadataCacheIT.java   | 10 ++
 3 files changed, 14 insertions(+), 13 deletions(-)



(phoenix) 01/01: Merge branch 'master' into PHOENIX-6883-feature

2024-04-08 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 124d7dbbf58452f726acc453770369b5932ae618
Merge: 4d42c915e1 d8f6e6ea53
Author: Rushabh Shah 
AuthorDate: Mon Apr 8 12:00:09 2024 -0700

Merge branch 'master' into PHOENIX-6883-feature

 .asf.yaml  |  23 +-
 .../phoenix/compile/ExplainPlanAttributes.java |  21 +-
 .../org/apache/phoenix/compile/QueryCompiler.java  |  17 +-
 .../phoenix/compile/ServerBuildIndexCompiler.java  |   1 +
 .../ServerBuildTransformingTableCompiler.java  |   1 +
 .../BaseScannerRegionObserverConstants.java|   2 +-
 .../coprocessorclient/MetaDataProtocol.java|   2 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |   1 +
 .../phoenix/iterate/BaseResultIterators.java   |  57 +++-
 .../iterate/DefaultParallelScanGrouper.java|  11 +
 .../phoenix/iterate/ParallelScanGrouper.java   |  16 +
 .../phoenix/iterate/ScanningResultIterator.java|   5 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java  |   3 +
 .../apache/phoenix/optimize/QueryOptimizer.java|   5 +-
 .../phoenix/query/ConnectionQueryServices.java |  15 +
 .../phoenix/query/ConnectionQueryServicesImpl.java | 103 +--
 .../query/ConnectionlessQueryServicesImpl.java |  16 +-
 .../query/DelegateConnectionQueryServices.java |   9 +
 .../org/apache/phoenix/query/QueryConstants.java   |   2 +
 .../org/apache/phoenix/query/QueryServices.java|   7 +
 .../org/apache/phoenix/schema/DelegateTable.java   |   6 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  71 -
 .../java/org/apache/phoenix/schema/PTable.java |   5 +
 .../java/org/apache/phoenix/schema/PTableImpl.java |  28 +-
 .../org/apache/phoenix/schema/TableProperty.java   |  24 ++
 .../phoenix/schema/transform/TransformClient.java  |   1 +
 .../java/org/apache/phoenix/util/MetaDataUtil.java |  14 +
 .../java/org/apache/phoenix/util/ScanUtil.java |  15 +
 phoenix-core-client/src/main/protobuf/PTable.proto |   1 +
 .../coprocessor/BaseScannerRegionObserver.java |  50 ++-
 .../coprocessor/GlobalIndexRegionScanner.java  |   4 +-
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  | 121 +++-
 .../UngroupedAggregateRegionObserver.java  |   4 +-
 .../iterate/MapReduceParallelScanGrouper.java  |  48 ++-
 .../PhoenixServerBuildIndexInputFormat.java|   1 +
 .../mapreduce/index/IndexScrutinyMapper.java   |   3 +-
 .../phoenix/mapreduce/index/IndexScrutinyTool.java |  31 +-
 .../mapreduce/util/PhoenixConfigurationUtil.java   |  14 +
 .../org/apache/phoenix/end2end/AlterTableIT.java   | 106 ++-
 .../end2end/BaseTenantSpecificViewIndexIT.java |   4 +-
 .../org/apache/phoenix/end2end/CreateTableIT.java  |  78 +
 .../end2end/ExplainPlanWithStatsDisabledIT.java| 340 +
 .../end2end/IndexRepairRegionScannerIT.java| 111 ---
 .../phoenix/end2end/IndexScrutinyToolBaseIT.java   |   7 +-
 .../end2end/IndexScrutinyWithMaxLookbackIT.java| 120 ++--
 .../end2end/IndexToolForNonTxGlobalIndexIT.java|  61 
 .../phoenix/end2end/MaxLookbackExtendedIT.java |  75 -
 .../org/apache/phoenix/end2end/MaxLookbackIT.java  | 251 +++
 .../end2end/RowValueConstructorOffsetIT.java   |  26 ++
 .../org/apache/phoenix/end2end/TableTTLIT.java |  34 ++-
 .../phoenix/end2end/TenantSpecificTablesDDLIT.java |  57 
 .../end2end/TenantSpecificViewIndexSaltedIT.java   |  33 +-
 .../it/java/org/apache/phoenix/end2end/ViewIT.java |  85 ++
 .../org/apache/phoenix/end2end/ViewMetadataIT.java |  34 +++
 .../phoenix/end2end/index/IndexMetadataIT.java |  24 ++
 .../phoenix/end2end/index/PartialIndexIT.java  |  47 +++
 .../index/UncoveredGlobalIndexRegionScannerIT.java |  43 +++
 .../phoenix/end2end/salted/SaltedTableIT.java  |  32 ++
 .../phoenix/end2end/transform/TransformToolIT.java | 144 -
 .../phoenix/iterate/PhoenixQueryTimeoutIT.java |  55 
 .../monitoring/PhoenixTableLevelMetricsIT.java |  14 +
 .../it/resources/compatible_client_versions.json   |   8 +-
 .../src/it/resources/log4j2-test.properties|  45 ---
 .../TestingMapReduceParallelScanGrouper.java   |  10 +
 .../java/org/apache/phoenix/query/BaseTest.java|  44 +++
 .../query/ConnectionQueryServicesImplTest.java |  46 ++-
 .../org/apache/phoenix/query/QueryPlanTest.java|  12 +-
 .../java/org/apache/phoenix/util/TestUtil.java |   4 +-
 .../src/test/resources/log4j2-test.properties  |   8 +-
 pom.xml|  42 ++-
 70 files changed, 2471 insertions(+), 287 deletions(-)

diff --cc 
phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 40da589976,0e78202c43..d4e2fd7552
--- 
a/phoenix-core-client/src/main/java/org/apache/phoe

(phoenix) branch PHOENIX-6883-feature updated (4d42c915e1 -> 124d7dbbf5)

2024-04-08 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 4d42c915e1 PHOENIX-7293 : New Update Cache Frequency config for 
Indexes in PENDING_DISABLE state (#1864)
 add 909f4bc174 PHOENIX-7255 Non-existent artifacts referred in 
compatible_client_versions.json
 add 3524dbd900 PHOENIX-7258: Query Optimizer should pick Index hint even 
for point lookup queries (#1851)
 add 57415bed06 PHOENIX-7006: Configure maxLookbackAge at table level  
(#1751)
 add fcbb742f51 PHOENIX-7275 Update HBase 2.5 default version to 2.5.8
 add 0b9d820187 PHOENIX-7253 Metadata lookup performance improvement for 
range scan queries (#1848)
 add e3c325b039 PHOENIX-7285 Upgade Zookeeper to 3.8.4
 add aa73d9d665 PHOENIX-7250 Fix HBase log level in tests
 add ff37830378 PHOENIX-7248 Add logging excludes to 
hadoop-mapreduce-client-app and hadoop-mapreduce-client-jobclient
 add afdba89b00 PHOENIX-7292 Update .asf.yaml based on HBase
 add bf83c95990 PHOENIX-7291 Bump up omid to 1.1.2 (#1861)
 add f6aec81748 PHOENIX-7295 Fix getTableRegions failing due to 
overlap/inconsistencies on region (#1870)
 add d8f6e6ea53 PHOENIX-7299 :- ScanningResultIterator should not time out 
a query after receiving a valid result (#1872)
 new 124d7dbbf5 Merge branch 'master' into PHOENIX-6883-feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .asf.yaml  |  23 +-
 .../phoenix/compile/ExplainPlanAttributes.java |  21 +-
 .../org/apache/phoenix/compile/QueryCompiler.java  |  17 +-
 .../phoenix/compile/ServerBuildIndexCompiler.java  |   1 +
 .../ServerBuildTransformingTableCompiler.java  |   1 +
 .../BaseScannerRegionObserverConstants.java|   2 +-
 .../coprocessorclient/MetaDataProtocol.java|   2 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |   1 +
 .../phoenix/iterate/BaseResultIterators.java   |  57 +++-
 .../iterate/DefaultParallelScanGrouper.java|  11 +
 .../phoenix/iterate/ParallelScanGrouper.java   |  16 +
 .../phoenix/iterate/ScanningResultIterator.java|   5 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java  |   3 +
 .../apache/phoenix/optimize/QueryOptimizer.java|   5 +-
 .../phoenix/query/ConnectionQueryServices.java |  15 +
 .../phoenix/query/ConnectionQueryServicesImpl.java | 103 +--
 .../query/ConnectionlessQueryServicesImpl.java |  16 +-
 .../query/DelegateConnectionQueryServices.java |   9 +
 .../org/apache/phoenix/query/QueryConstants.java   |   2 +
 .../org/apache/phoenix/query/QueryServices.java|   7 +
 .../org/apache/phoenix/schema/DelegateTable.java   |   6 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  71 -
 .../java/org/apache/phoenix/schema/PTable.java |   5 +
 .../java/org/apache/phoenix/schema/PTableImpl.java |  28 +-
 .../org/apache/phoenix/schema/TableProperty.java   |  24 ++
 .../phoenix/schema/transform/TransformClient.java  |   1 +
 .../java/org/apache/phoenix/util/MetaDataUtil.java |  14 +
 .../java/org/apache/phoenix/util/ScanUtil.java |  15 +
 phoenix-core-client/src/main/protobuf/PTable.proto |   1 +
 .../coprocessor/BaseScannerRegionObserver.java |  50 ++-
 .../coprocessor/GlobalIndexRegionScanner.java  |   4 +-
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  | 121 +++-
 .../UngroupedAggregateRegionObserver.java  |   4 +-
 .../iterate/MapReduceParallelScanGrouper.java  |  48 ++-
 .../PhoenixServerBuildIndexInputFormat.java|   1 +
 .../mapreduce/index/IndexScrutinyMapper.java   |   3 +-
 .../phoenix/mapreduce/index/IndexScrutinyTool.java |  31 +-
 .../mapreduce/util/PhoenixConfigurationUtil.java   |  14 +
 .../org/apache/phoenix/end2end/AlterTableIT.java   | 106 ++-
 .../end2end/BaseTenantSpecificViewIndexIT.java |   4 +-
 .../org/apache/phoenix/end2end/CreateTableIT.java  |  78 +
 .../end2end/ExplainPlanWithStatsDisabledIT.java| 340 +
 .../end2end/IndexRepairRegionScannerIT.java| 111 ---
 .../phoenix/end2end/IndexScrutinyToolBaseIT.java   |   7 +-
 .../end2end/IndexScrutinyWithMaxLookbackIT.java| 120 ++--
 .../end2end/IndexToolForNonTxGlobalIndexIT.java|  61 
 .../phoenix/end2end/MaxLookbackExtendedIT.java |  75 -
 .../org/apache/phoenix/end2end/MaxLookbackIT.java  | 251 +++
 .../end2end/RowValueConstructorOffsetIT.java   |  26 ++
 .../org/apache/phoenix/end2end/TableTTLIT.java |  34 ++-
 .../phoenix/end2end/TenantSpecificTablesDDLIT.java |  57 
 .../end2end/TenantSpecificViewIndexSaltedIT.java   |  33 +-
 .../it/java/org/apac

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7293 : New Update Cache Frequency config for Indexes in PENDING_DISABLE state (#1864)

2024-04-04 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 4d42c915e1 PHOENIX-7293 : New Update Cache Frequency config for 
Indexes in PENDING_DISABLE state (#1864)
4d42c915e1 is described below

commit 4d42c915e18c4f34f195826859f3d6fa86148cdc
Author: palash 
AuthorDate: Thu Apr 4 10:38:16 2024 -0700

PHOENIX-7293 : New Update Cache Frequency config for Indexes in 
PENDING_DISABLE state (#1864)
---
 .../main/java/org/apache/phoenix/query/QueryServices.java|  4 
 .../java/org/apache/phoenix/query/QueryServicesOptions.java  |  2 ++
 .../main/java/org/apache/phoenix/schema/MetaDataClient.java  | 12 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServices.java 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServices.java
index 82d354e285..ef2c182125 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -326,6 +326,10 @@ public interface QueryServices extends SQLCloseable {
 //Update Cache Frequency default config attribute
 public static final String DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB  = 
"phoenix.default.update.cache.frequency";
 
+//Update Cache Frequency for indexes in PENDING_DISABLE state
+public static final String 
UPDATE_CACHE_FREQUENCY_FOR_PENDING_DISABLED_INDEX
+= "phoenix.update.cache.frequency.pending.disable.index";
+
 // whether to validate last ddl timestamps during client operations
 public static final String LAST_DDL_TIMESTAMP_VALIDATION_ENABLED = 
"phoenix.ddl.timestamp.validation.enabled";
 
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index e24763e96c..1f55135c93 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -374,6 +374,8 @@ public class QueryServicesOptions {
 public static final long DEFAULT_UPDATE_CACHE_FREQUENCY = 0;
 public static final int DEFAULT_SMALL_SCAN_THRESHOLD = 100;
 public static final boolean DEFAULT_LAST_DDL_TIMESTAMP_VALIDATION_ENABLED 
= false;
+public static final String 
DEFAULT_UPDATE_CACHE_FREQUENCY_FOR_PENDING_DISABLED_INDEX
+= 
Long.toString(0L);
 
 // default system task handling interval in milliseconds
 public static final long DEFAULT_TASK_HANDLING_INTERVAL_MS = 60*1000; // 1 
min
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index e9550fc482..40da589976 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -768,7 +768,17 @@ public class MetaDataClient {
 // What if the table is created with UPDATE_CACHE_FREQUENCY 
explicitly set to ALWAYS?
 // i.e. explicitly set to 0. We should ideally be checking for 
something like
 // hasUpdateCacheFrequency().
-if (table.getUpdateCacheFrequency() != 0L) {
+//always fetch an Index in PENDING_DISABLE state to retrieve 
server timestamp
+//QueryOptimizer needs that to decide whether the index can be used
+if (PIndexState.PENDING_DISABLE.equals(table.getIndexState())) {
+effectiveUpdateCacheFreq =
+(Long) 
ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue(
+connection.getQueryServices().getProps().get(
+  
QueryServices.UPDATE_CACHE_FREQUENCY_FOR_PENDING_DISABLED_INDEX,
+  
QueryServicesOptions.DEFAULT_UPDATE_CACHE_FREQUENCY_FOR_PENDING_DISABLED_INDEX));
+ucfInfoForLogging = "pending-disable-index-level";
+} else if (table.getUpdateCacheFrequency()
+!= QueryServicesOptions.DEFAULT_UPDATE_CACHE_FREQUENCY) {
 effectiveUpdateCacheFreq = table.getUpdateCacheFrequency();
 ucfInfoForLogging = "table-level";
 } else {



(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7297 : Update cache before retrying if Drop Column encounters a ConcurrentTableMutationException (#1867)

2024-04-01 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 7b71c11061 PHOENIX-7297 : Update cache before retrying if Drop Column 
encounters a ConcurrentTableMutationException (#1867)
7b71c11061 is described below

commit 7b71c110618884f82390f7b13731f708f7d996ae
Author: palash 
AuthorDate: Mon Apr 1 15:45:50 2024 -0700

PHOENIX-7297 : Update cache before retrying if Drop Column encounters a 
ConcurrentTableMutationException (#1867)
---
 .../org/apache/phoenix/schema/MetaDataClient.java  | 23 --
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 6f390006e1..e9550fc482 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -4743,12 +4743,16 @@ public class MetaDataClient {
 
.setColumnName(columnToDrop.getName().getString()).build().buildException();
 }
 columnsToDrop.add(new ColumnRef(columnRef.getTableRef(), 
columnToDrop.getPosition()));
-boolean acquiredMutex = writeCell(null, physicalSchemaName,
-physicalTableName, columnToDrop.toString());
-if (!acquiredMutex) {
-throw new 
ConcurrentTableMutationException(physicalSchemaName, physicalTableName);
+// check if client is already holding a mutex from 
previous retry
+if 
(!acquiredColumnMutexSet.contains(columnToDrop.toString())) {
+boolean acquiredMutex = writeCell(null, 
physicalSchemaName,
+physicalTableName, columnToDrop.toString());
+if (!acquiredMutex) {
+throw new 
ConcurrentTableMutationException(physicalSchemaName,
+
physicalTableName);
+}
+acquiredColumnMutexSet.add(columnToDrop.toString());
 }
-acquiredColumnMutexSet.add(columnToDrop.toString());
 }
 
 dropColumnMutations(table, tableColumnsToDrop);
@@ -4974,7 +4978,14 @@ public class MetaDataClient {
 if (retried) {
 throw e;
 }
-table = connection.getTable(fullTableName);
+if (LOGGER.isDebugEnabled()) {
+LOGGER.debug(LogUtil.addCustomAnnotations(
+"Caught ConcurrentTableMutationException for table 
"
++ 
SchemaUtil.getTableName(e.getSchemaName(), e.getTableName())
++ ". Will update cache and try again...", 
connection));
+}
+updateCache(connection.getTenantId(),
+e.getSchemaName(), e.getTableName(), true);
 retried = true;
 } catch (Throwable e) {
 
TableMetricsManager.updateMetricsForSystemCatalogTableMethod(tableName, 
NUM_METADATA_LOOKUP_FAILURES, 1);



(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7294 : Validate DDL timestamps only for Tables, Views and Indexes (#1865)

2024-03-29 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 8840cb6f81 PHOENIX-7294 : Validate DDL timestamps only for Tables, 
Views and Indexes (#1865)
8840cb6f81 is described below

commit 8840cb6f814a0668877cfd472de71014e2954758
Author: palash 
AuthorDate: Fri Mar 29 19:23:50 2024 -0700

PHOENIX-7294 : Validate DDL timestamps only for Tables, Views and Indexes 
(#1865)
---
 .../phoenix/util/ValidateLastDDLTimestampUtil.java | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
index 7d77e6aa89..bc1ae34f6a 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
@@ -18,9 +18,11 @@
 package org.apache.phoenix.util;
 
 import java.sql.SQLException;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Collectors;
 
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.ServerName;
@@ -35,6 +37,7 @@ import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
+import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.schema.TableRef;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,6 +51,8 @@ public class ValidateLastDDLTimestampUtil {
 
 private static final Logger LOGGER = LoggerFactory
 .getLogger(ValidateLastDDLTimestampUtil.class);
+private static final List ALLOWED_PTABLE_TYPES = 
Arrays.asList(new PTableType[]
+{PTableType.TABLE, PTableType.VIEW, PTableType.INDEX, 
PTableType.SYSTEM});
 
 public static String getInfoString(PName tenantId, List 
tableRefs) {
 StringBuilder sb = new StringBuilder();
@@ -76,13 +81,14 @@ public class ValidateLastDDLTimestampUtil {
  * A random live region server is picked for invoking the RPC to validate 
LastDDLTimestamp.
  * Retry once if there was an error performing the RPC, otherwise throw 
the Exception.
  *
- * @param tableRefs
+ * @param allTableRefs
  * @param doRetry
  * @throws SQLException
  */
 public static void validateLastDDLTimestamp(PhoenixConnection conn,
-List tableRefs,
+List allTableRefs,
 boolean doRetry) throws 
SQLException {
+List tableRefs = filterTableRefs(allTableRefs);
 String infoString = getInfoString(conn.getTenantId(), tableRefs);
 try (Admin admin = conn.getQueryServices().getAdmin()) {
 // get all live region servers
@@ -198,4 +204,16 @@ public class ValidateLastDDLTimestampUtil {
 builder.setTableName(ByteStringer.wrap(tableName.getBytes()));
 builder.setLastDDLTimestamp(lastDDLTimestamp);
 }
+
+/**
+ * Filter out any TableRefs which are not tables, views or indexes.
+ * @param tableRefs
+ * @return
+ */
+private static List filterTableRefs(List tableRefs) {
+List filteredTableRefs = tableRefs.stream()
+.filter(tableRef -> 
ALLOWED_PTABLE_TYPES.contains(tableRef.getTable().getType()))
+.collect(Collectors.toList());
+return filteredTableRefs;
+}
 }



(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7069 disable feature in Permission ITs using HBASE-28391 (#1863)

2024-03-29 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 55d9029789 PHOENIX-7069 disable feature in Permission ITs using 
HBASE-28391 (#1863)
55d9029789 is described below

commit 55d9029789e60bcdab9652be1040a5d94784b316
Author: palash 
AuthorDate: Fri Mar 29 18:58:13 2024 -0700

PHOENIX-7069 disable feature in Permission ITs using HBASE-28391 (#1863)
---
 .../apache/phoenix/end2end/BasePermissionsIT.java  | 50 +-
 .../java/org/apache/phoenix/query/BaseTest.java|  2 +-
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
index 363f672537..d7aea5a252 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BasePermissionsIT.java
@@ -16,6 +16,7 @@
  */
 package org.apache.phoenix.end2end;
 
+import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.phoenix.thirdparty.com.google.common.base.Joiner;
 import org.apache.phoenix.thirdparty.com.google.common.base.Throwables;
 import org.apache.phoenix.thirdparty.com.google.common.collect.Lists;
@@ -145,6 +146,7 @@ public abstract class BasePermissionsIT extends BaseTest {
 private static final int NUM_RECORDS = 5;
 
 boolean isNamespaceMapped;
+boolean isReadAccessEnabledForListDecomRs;
 
 private String schemaName;
 private String tableName;
@@ -159,6 +161,7 @@ public abstract class BasePermissionsIT extends BaseTest {
 BasePermissionsIT(final boolean isNamespaceMapped) throws Exception {
 this.isNamespaceMapped = isNamespaceMapped;
 this.tableName = generateUniqueName();
+isReadAccessEnabledForListDecomRs = 
isReadAccessEnabledForListDecomRs();
 }
 
 static void initCluster(boolean isNamespaceMapped) throws Exception {
@@ -179,11 +182,47 @@ public abstract class BasePermissionsIT extends BaseTest {
 configureNamespacesOnServer(config, isNamespaceMapped);
 configureStatsConfigurations(config);
 config.setBoolean(LocalHBaseCluster.ASSIGN_RANDOM_PORTS, true);
-
+setPhoenixRegionServerEndpoint(config);
 testUtil.startMiniCluster(1);
 superUser1 = User.createUserForTesting(config, SUPER_USER, new 
String[0]);
 superUser2 = User.createUserForTesting(config, "superUser2", new 
String[0]);
 
+/**
+ * CQSI initialization needs to make an Admin API call to fetch a list 
of live region servers.
+ * Permissions were relaxed for that API call in HBASE-28391.
+ * Disable metadata caching re-design on server if API call needs 
ADMIN access.
+ */
+if (!isReadAccessEnabledForListDecomRs()) {
+
config.setLong(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, 0L);
+
config.setBoolean(QueryServices.LAST_DDL_TIMESTAMP_VALIDATION_ENABLED, false);
+
config.setBoolean(QueryServices.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, 
false);
+}
+}
+
+// See https://issues.apache.org/jira/browse/HBASE-28391
+private static boolean isReadAccessEnabledForListDecomRs() {
+// true for 2.4.18+, 2.5.8+
+String hbaseVersion = VersionInfo.getVersion();
+String[] versionArr = hbaseVersion.split("\\.");
+int majorVersion = Integer.parseInt(versionArr[0]);
+int minorVersion = Integer.parseInt(versionArr[1]);
+int patchVersion = Integer.parseInt(versionArr[2].split("-hadoop")[0]);
+if (majorVersion > 2) {
+return true;
+}
+if (majorVersion < 2) {
+return false;
+}
+if (minorVersion > 5) {
+return true;
+}
+if (minorVersion < 4) {
+return false;
+}
+if (minorVersion == 4) {
+return patchVersion >= 18;
+}
+return patchVersion >= 8;
 }
 
 @Before
@@ -341,6 +380,15 @@ public abstract class BasePermissionsIT extends BaseTest {
 props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
 }
 props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, 
Boolean.toString(isNamespaceMapped));
+/**
+ * CQSI initialization needs to make an Admin API call to fetch a list 
of live region servers.
+ * Permissions were relaxed for that API call in HBASE-28391.
+ * Disable metadata caching re-design on client side if API call needs 
ADMIN access.
+ */
+if (!isReadAccessEnabledForListDecomRs) {
+props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATR

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7280 Test failure: ViewMetadataIT#testViewAndTableAndDropCascadeWithIndexes (#1858)

2024-03-19 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 8effca5b0c PHOENIX-7280 Test failure: 
ViewMetadataIT#testViewAndTableAndDropCascadeWithIndexes (#1858)
8effca5b0c is described below

commit 8effca5b0ccc74b3e7c95be979eeb19aee00b160
Author: Rushabh Shah 
AuthorDate: Tue Mar 19 14:36:26 2024 -0700

PHOENIX-7280 Test failure: 
ViewMetadataIT#testViewAndTableAndDropCascadeWithIndexes (#1858)
---
 .../java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 032ffefb3d..6eb7577e95 100644
--- 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -1491,7 +1491,7 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 if (indexType != IndexType.LOCAL) {
 parentTable = getTable(null, 
SchemaUtil.getSchemaNameFromFullName(famName.getBytes()).getBytes(StandardCharsets.UTF_8),
 
SchemaUtil.getTableNameFromFullName(famName.getBytes()).getBytes(StandardCharsets.UTF_8),
 clientTimeStamp, clientVersion);
-if (parentTable == null) {
+if (parentTable == null || 
isTableDeleted(parentTable)) {
 // parentTable is not in the cache. Since famName 
is only logical name, we need to find the physical table.
 try (PhoenixConnection connection = 
QueryUtil.getConnectionOnServer(env.getConfiguration()).unwrap(PhoenixConnection.class))
 {
 parentTable = 
connection.getTableNoCache(famName.getString());
@@ -1501,7 +1501,7 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 }
 }
 
-if (parentTable == null) {
+if (parentTable == null || isTableDeleted(parentTable)) {
 if (indexType == IndexType.LOCAL) {
 PName tablePhysicalName = getPhysicalTableName(
 env.getRegion(),null,



(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7270 : Always resolve table before DDL operations (#1854)

2024-03-14 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 064c80e564 PHOENIX-7270 : Always resolve table before DDL operations 
(#1854)
064c80e564 is described below

commit 064c80e5640005d68eb64678afa2b8653916aaf8
Author: palash 
AuthorDate: Thu Mar 14 20:57:15 2024 -0700

PHOENIX-7270 : Always resolve table before DDL operations (#1854)
---
 .../org/apache/phoenix/compile/FromCompiler.java   |   6 +-
 .../phoenix/cache/ServerMetadataCacheIT.java   | 141 +++--
 2 files changed, 107 insertions(+), 40 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
index ec8b3a7189..15b23438b7 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/compile/FromCompiler.java
@@ -180,7 +180,8 @@ public class FromCompiler {
 NamedTableNode tableNode = NamedTableNode.create(null, baseTable, 
Collections.emptyList());
 // Always use non-tenant-specific connection here
 try {
-SingleTableColumnResolver visitor = new 
SingleTableColumnResolver(connection, tableNode, true);
+SingleTableColumnResolver visitor
+= new SingleTableColumnResolver(connection, tableNode, 
true, true);
 return visitor;
 } catch (TableNotFoundException e) {
 // Used for mapped VIEW, since we won't be able to resolve that.
@@ -280,7 +281,8 @@ public class FromCompiler {
 
 public static ColumnResolver getResolver(SingleTableStatement statement, 
PhoenixConnection connection)
 throws SQLException {
-SingleTableColumnResolver visitor = new 
SingleTableColumnResolver(connection, statement.getTable(), true);
+SingleTableColumnResolver visitor
+= new SingleTableColumnResolver(connection, 
statement.getTable(), true, true);
 return visitor;
 }
 
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java
index 590ca7774a..e85a8b7d92 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java
@@ -35,7 +35,6 @@ import org.apache.phoenix.query.ConnectionQueryServices;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.ColumnNotFoundException;
-import org.apache.phoenix.schema.ConnectionProperty;
 import org.apache.phoenix.schema.PIndexState;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
@@ -85,13 +84,13 @@ import static org.mockito.Mockito.verify;
 public class ServerMetadataCacheIT extends ParallelStatsDisabledIT {
 
 private final Random RANDOM = new Random(42);
-private final long NEVER = (long) 
ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue("NEVER");
 
 private static ServerName serverName;
 
 @BeforeClass
 public static synchronized void doSetup() throws Exception {
 Map props = Maps.newHashMapWithExpectedSize(1);
+props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, 
"NEVER");
 props.put(QueryServices.LAST_DDL_TIMESTAMP_VALIDATION_ENABLED, 
Boolean.toString(true));
 props.put(PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, 
Boolean.toString(true));
 props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
@@ -144,7 +143,7 @@ public class ServerMetadataCacheIT extends 
ParallelStatsDisabledIT {
 try(Connection conn = spyCQS.connect(getUrl(), props)) {
 conn.setAutoCommit(false);
 // Create a test table.
-createTable(conn, tableNameStr, NEVER);
+createTable(conn, tableNameStr);
 pTable = PhoenixRuntime.getTableNoCache(conn,
 tableNameStr);// --> First call to CQSI#getTable
 ServerMetadataCacheTestImpl cache = getServerMetadataCache();
@@ -182,7 +181,7 @@ public class ServerMetadataCacheIT extends 
ParallelStatsDisabledIT {
 try (Connection conn = spyCQS.connect(getUrl(), props)) {
 conn.setAutoCommit(false);
 // Create a test table.
-createTable(conn, tableNameStr, NEVER);
+createTable(conn, tableNameStr);
 // Create view on table.
 String whereClause = " WHERE v1 = 1000";
 String viewNameStr = generateUniqueName();
@@ -220,7 +219,7 @@ public class ServerMetadataCacheIT extends 

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7251 : Refactor server-side code to support multiple ServerMetadataCache for ITs which create multiple RSs or mini clusters (#1845)

2024-03-07 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 7930acadba PHOENIX-7251 : Refactor server-side code to support 
multiple ServerMetadataCache for ITs which create multiple RSs or mini clusters 
(#1845)
7930acadba is described below

commit 7930acadbacbc31b3b51b542c92c1121434ae4d0
Author: palash 
AuthorDate: Thu Mar 7 21:57:45 2024 -0800

PHOENIX-7251 : Refactor server-side code to support multiple 
ServerMetadataCache for ITs which create multiple RSs or mini clusters (#1845)
---
 .../apache/phoenix/cache/ServerMetadataCache.java  | 187 ++---
 ...dataCache.java => ServerMetadataCacheImpl.java} |  64 ++-
 .../coprocessor/PhoenixRegionServerEndpoint.java   |  10 +-
 .../coprocessor/VerifyLastDDLTimestamp.java|  10 +-
 .../phoenix/end2end/BackwardCompatibilityIT.java   |   2 +-
 .../apache/phoenix/end2end/BasePermissionsIT.java  |   1 +
 .../MigrateSystemTablesToSystemNamespaceIT.java|   1 +
 .../PartialResultServerConfigurationIT.java|   1 +
 .../PhoenixRegionServerEndpointTestImpl.java   |  45 +
 .../end2end/ServerMetadataCacheTestImpl.java   |  89 ++
 .../end2end/index/DropIndexDuringUpsertIT.java |   2 +
 .../end2end/index/IndexAsyncThresholdIT.java   |   2 +
 .../index/ReplicationWithWALAnnotationIT.java  |   9 +-
 .../execute/UpsertSelectOverlappingBatchesIT.java  |   2 +
 .../index/FailForUnsupportedHBaseVersionsIT.java   |   2 +
 .../jdbc/HighAvailabilityTestingUtility.java   |   2 +
 .../monitoring/PhoenixTableLevelMetricsIT.java |   3 +
 .../ConnectionQueryServicesMetricsIT.java  |   3 +
 .../phoenix/query/MaxConcurrentConnectionsIT.java  |   2 +
 ...taCacheTest.java => ServerMetadataCacheIT.java} |  76 ++---
 .../hbase/index/write/TestWALRecoveryCaching.java  |   2 +
 .../java/org/apache/phoenix/query/BaseTest.java|  13 +-
 22 files changed, 264 insertions(+), 264 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
index 4e47a1382a..f251dc7123 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
@@ -1,11 +1,10 @@
 /*
- * 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
+ * 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
  *
@@ -17,177 +16,13 @@
  */
 package org.apache.phoenix.cache;
 
-import java.sql.Connection;
 import java.sql.SQLException;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
 
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.util.Bytes;
-import 
org.apache.phoenix.coprocessorclient.metrics.MetricsMetadataCachingSource;
-import 
org.apache.phoenix.coprocessorclient.metrics.MetricsPhoenixCoprocessorSourceFactory;
-import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
-import org.apache.phoenix.schema.PTable;
-import 
org.apache.phoenix.thirdparty.com.google.common.annotations.VisibleForTesting;
-import org.apache.phoenix.thirdparty.com.google.common.cache.Cache;
-import org.apache.phoenix.thirdparty.com.google.common.cache.CacheBuilder;
-import org.apache.phoenix.thirdparty.com.google.common.cache.RemovalListener;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.SchemaUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 /**
- * This manages the cache for all the objects(data table, views, indexes) on 
each region server.
- * Currently, it only stores LAST_DDL_TIMESTAMP in the cache.
+ * Interface for server side metadata cache hosted on each region server.
  */
-public class ServerMetadataCache {
-private static final Logger LOGGER 

(phoenix) branch PHOENIX-6883-feature updated (34ed816fd0 -> 1fceba9d96)

2024-03-07 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 34ed816fd0 PHOENIX-7252 Fix BackwardCompatibilityIT test failures 
(#1846)
 add d4f59cd9ec PHOENIX-7216 Bump Hadoop version to 3.2.4 for 2.5.x profile 
(#1825)
 add 91bf9b3855 PHOENIX-7230 : Optimize rpc call to master if all indexes 
are migrated to new coprocs (#1833)
 add 49ad9db27e PHOENIX-7223 Make Sure Tools Always Close HBase Connections 
on Exit
 add 6a2333174e PHOENIX-7234 Bump org.apache.commons:commons-compress from 
1.21 to 1.26.0 (#1834)
 add 00bb0d0517 PHOENIX-7229 Leverage bloom filters for single key point 
lookups (#1832)
 add d559ff3d4d PHOENIX-7229 BloomFilter metrics usage need revert 
(ADDENDUM)
 add 9934c3db15 PHOENIX-7236 Fix release scripts for 5.2
 add bc1e2e7bea PHOENIX-7229 ADDENDUM for build failure
 add 0ceccde1a1 PHOENIX-7130 Support skipping of shade sources jar creation 
(#1745)
 add e6fb989c5c PHOENIX-7236 Update version to 5.3.0 and fix issues with 
maven-gpg-plugin and gnupg (ADDENDUM) (#1841)
 add 22b0b346e6 PHOENIX-7243 : Add connectionType property to 
ConnectionInfo (#1839)
 new 1fceba9d96 Merge branch 'master' into PHOENIX-6883-feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dev/create-release/README.txt  |   3 +
 dev/create-release/do-release-docker.sh|   8 +-
 dev/create-release/do-release.sh   |   5 +
 dev/create-release/mac-sshd-gpg-agent/Dockerfile   |   2 +-
 dev/create-release/phoenix-rm/Dockerfile   |  48 ---
 dev/create-release/release-util.sh |   4 +-
 phoenix-assembly/pom.xml   |   2 +-
 .../phoenix-client-embedded/pom.xml|   4 +-
 phoenix-client-parent/phoenix-client-lite/pom.xml  |   4 +-
 phoenix-client-parent/pom.xml  |   2 +-
 phoenix-core-client/pom.xml|   2 +-
 .../coprocessorclient/MetaDataProtocol.java|   6 +-
 .../org/apache/phoenix/execute/MutationState.java  |  15 +-
 .../phoenix/iterate/BaseResultIterators.java   |  17 ++-
 .../phoenix/jdbc/AbstractRPCConnectionInfo.java|   4 +-
 .../jdbc/ClusterRoleRecordGeneratorTool.java   |  19 ++-
 .../org/apache/phoenix/jdbc/ConnectionInfo.java|  19 ++-
 .../apache/phoenix/jdbc/MasterConnectionInfo.java  |   8 +-
 .../org/apache/phoenix/jdbc/PhoenixDriver.java |  13 +-
 .../apache/phoenix/jdbc/PhoenixHAAdminTool.java|  63 
 .../org/apache/phoenix/jdbc/RPCConnectionInfo.java |   9 +-
 .../org/apache/phoenix/jdbc/ZKConnectionInfo.java  |   9 +-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  46 +++---
 .../org/apache/phoenix/query/QueryServices.java|   2 +
 .../apache/phoenix/query/QueryServicesOptions.java |   2 +
 .../org/apache/phoenix/schema/tool/SchemaTool.java |  29 ++--
 phoenix-core-server/pom.xml|   2 +-
 .../phoenix/mapreduce/AbstractBulkLoadTool.java| 159 -
 .../apache/phoenix/mapreduce/OrphanViewTool.java   |   2 +
 .../phoenix/mapreduce/index/IndexUpgradeTool.java  |  11 +-
 .../phoenix/schema/stats/UpdateStatisticsTool.java |  19 ++-
 .../util/MergeViewIndexIdSequencesTool.java|  17 +--
 phoenix-core/pom.xml   |   4 +-
 .../apache/phoenix/end2end/CsvBulkLoadToolIT.java  |  41 +++---
 .../apache/phoenix/end2end/PhoenixDriverIT.java|  17 ++-
 .../phoenix/end2end/RegexBulkLoadToolIT.java   |  20 +--
 .../apache/phoenix/jdbc/PhoenixTestDriverIT.java   |  19 +++
 .../apache/phoenix/compile/WhereOptimizerTest.java |  50 +++
 .../java/org/apache/phoenix/util/TestUtil.java |   5 +
 phoenix-hbase-compat-2.4.1/pom.xml |   2 +-
 phoenix-hbase-compat-2.5.0/pom.xml |   2 +-
 phoenix-hbase-compat-2.5.4/pom.xml |   2 +-
 phoenix-mapreduce-byo-shaded-hbase/pom.xml |   4 +-
 phoenix-pherf/pom.xml  |   2 +-
 phoenix-server/pom.xml |   4 +-
 phoenix-tracing-webapp/pom.xml |   2 +-
 pom.xml|  14 +-
 47 files changed, 482 insertions(+), 261 deletions(-)



(phoenix) 01/01: Merge branch 'master' into PHOENIX-6883-feature

2024-03-07 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 1fceba9d9617b0211a1b9b076ba611017cba65ca
Merge: 34ed816fd0 22b0b346e6
Author: Rushabh Shah 
AuthorDate: Thu Mar 7 11:25:33 2024 -0800

Merge branch 'master' into PHOENIX-6883-feature

 dev/create-release/README.txt  |   3 +
 dev/create-release/do-release-docker.sh|   8 +-
 dev/create-release/do-release.sh   |   5 +
 dev/create-release/mac-sshd-gpg-agent/Dockerfile   |   2 +-
 dev/create-release/phoenix-rm/Dockerfile   |  48 ---
 dev/create-release/release-util.sh |   4 +-
 phoenix-assembly/pom.xml   |   2 +-
 .../phoenix-client-embedded/pom.xml|   4 +-
 phoenix-client-parent/phoenix-client-lite/pom.xml  |   4 +-
 phoenix-client-parent/pom.xml  |   2 +-
 phoenix-core-client/pom.xml|   2 +-
 .../coprocessorclient/MetaDataProtocol.java|   6 +-
 .../org/apache/phoenix/execute/MutationState.java  |  15 +-
 .../phoenix/iterate/BaseResultIterators.java   |  17 ++-
 .../phoenix/jdbc/AbstractRPCConnectionInfo.java|   4 +-
 .../jdbc/ClusterRoleRecordGeneratorTool.java   |  19 ++-
 .../org/apache/phoenix/jdbc/ConnectionInfo.java|  19 ++-
 .../apache/phoenix/jdbc/MasterConnectionInfo.java  |   8 +-
 .../org/apache/phoenix/jdbc/PhoenixDriver.java |  13 +-
 .../apache/phoenix/jdbc/PhoenixHAAdminTool.java|  63 
 .../org/apache/phoenix/jdbc/RPCConnectionInfo.java |   9 +-
 .../org/apache/phoenix/jdbc/ZKConnectionInfo.java  |   9 +-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  46 +++---
 .../org/apache/phoenix/query/QueryServices.java|   2 +
 .../apache/phoenix/query/QueryServicesOptions.java |   2 +
 .../org/apache/phoenix/schema/tool/SchemaTool.java |  29 ++--
 phoenix-core-server/pom.xml|   2 +-
 .../phoenix/mapreduce/AbstractBulkLoadTool.java| 159 -
 .../apache/phoenix/mapreduce/OrphanViewTool.java   |   2 +
 .../phoenix/mapreduce/index/IndexUpgradeTool.java  |  11 +-
 .../phoenix/schema/stats/UpdateStatisticsTool.java |  19 ++-
 .../util/MergeViewIndexIdSequencesTool.java|  17 +--
 phoenix-core/pom.xml   |   4 +-
 .../apache/phoenix/end2end/CsvBulkLoadToolIT.java  |  41 +++---
 .../apache/phoenix/end2end/PhoenixDriverIT.java|  17 ++-
 .../phoenix/end2end/RegexBulkLoadToolIT.java   |  20 +--
 .../apache/phoenix/jdbc/PhoenixTestDriverIT.java   |  19 +++
 .../apache/phoenix/compile/WhereOptimizerTest.java |  50 +++
 .../java/org/apache/phoenix/util/TestUtil.java |   5 +
 phoenix-hbase-compat-2.4.1/pom.xml |   2 +-
 phoenix-hbase-compat-2.5.0/pom.xml |   2 +-
 phoenix-hbase-compat-2.5.4/pom.xml |   2 +-
 phoenix-mapreduce-byo-shaded-hbase/pom.xml |   4 +-
 phoenix-pherf/pom.xml  |   2 +-
 phoenix-server/pom.xml |   4 +-
 phoenix-tracing-webapp/pom.xml |   2 +-
 pom.xml|  14 +-
 47 files changed, 482 insertions(+), 261 deletions(-)




(phoenix) branch master updated: PHOENIX-7243 : Add connectionType property to ConnectionInfo (#1839)

2024-03-07 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 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 22b0b346e6 PHOENIX-7243 : Add connectionType property to 
ConnectionInfo (#1839)
22b0b346e6 is described below

commit 22b0b346e6de3f78997ad030eb88306d5c75be1d
Author: palash 
AuthorDate: Thu Mar 7 11:11:49 2024 -0800

PHOENIX-7243 : Add connectionType property to ConnectionInfo (#1839)
---
 .../phoenix/jdbc/AbstractRPCConnectionInfo.java   |  4 ++--
 .../java/org/apache/phoenix/jdbc/ConnectionInfo.java  | 19 ++-
 .../org/apache/phoenix/jdbc/MasterConnectionInfo.java |  8 
 .../org/apache/phoenix/jdbc/RPCConnectionInfo.java|  9 -
 .../org/apache/phoenix/jdbc/ZKConnectionInfo.java |  9 +
 .../org/apache/phoenix/end2end/PhoenixDriverIT.java   | 17 -
 .../org/apache/phoenix/jdbc/PhoenixTestDriverIT.java  | 19 +++
 7 files changed, 68 insertions(+), 17 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/AbstractRPCConnectionInfo.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/AbstractRPCConnectionInfo.java
index 0e4920c4c9..1a62c69fbb 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/AbstractRPCConnectionInfo.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/AbstractRPCConnectionInfo.java
@@ -45,8 +45,8 @@ public abstract class AbstractRPCConnectionInfo extends 
ConnectionInfo {
 }
 
 protected AbstractRPCConnectionInfo(boolean isConnectionless, String 
principal, String keytab,
-User user, String haGroup) {
-super(isConnectionless, principal, keytab, user, haGroup);
+User user, String haGroup, ConnectionType connectionType) {
+super(isConnectionless, principal, keytab, user, haGroup, 
connectionType);
 }
 
 @Override
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java 
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java
index 3acdfa8f6a..945060c153 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java
@@ -36,6 +36,7 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.query.HBaseFactoryProvider;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.slf4j.LoggerFactory;
 
@@ -87,15 +88,17 @@ public abstract class ConnectionInfo {
 protected final String keytab;
 protected final User user;
 protected final String haGroup;
+protected final ConnectionType connectionType;
 
 protected ConnectionInfo(boolean isConnectionless, String principal, 
String keytab, User user,
-String haGroup) {
+String haGroup, ConnectionType connectionType) {
 super();
 this.isConnectionless = isConnectionless;
 this.principal = principal;
 this.keytab = keytab;
 this.user = user;
 this.haGroup = haGroup;
+this.connectionType = connectionType;
 }
 
 protected static String unescape(String escaped) {
@@ -330,6 +333,9 @@ public abstract class ConnectionInfo {
 if (haGroup == null) {
 if (other.haGroup != null) return false;
 } else if (!haGroup.equals(other.haGroup)) return false;
+if (!connectionType.equals(other.connectionType)) {
+return false;
+}
 return true;
 }
 
@@ -342,6 +348,7 @@ public abstract class ConnectionInfo {
 result = prime * result + ((haGroup == null) ? 0 : haGroup.hashCode());
 // `user` is guaranteed to be non-null
 result = prime * result + user.hashCode();
+result = prime * result + connectionType.hashCode();
 return result;
 }
 
@@ -369,6 +376,7 @@ public abstract class ConnectionInfo {
 protected User user;
 protected String haGroup;
 protected boolean doNotLogin = false;
+protected ConnectionType connectionType;
 
 // Only used for building, not part of ConnectionInfo
 protected final String url;
@@ -381,6 +389,10 @@ public abstract class ConnectionInfo {
 this.url = url;
 this.props = props;
 this.info = info;
+this.connectionType = ConnectionType.CLIENT;
+if (info != null && 
Boolean.valueOf(info.getProperty(QueryUtil.IS_SERVER_CONNECTION))) {
+this.connectionType = ConnectionType.SERVER;
+}
 }
 
 protected abstract ConnectionInfo create() throws SQLException;
@@ -561,4 +573,9 @@ public abstra

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7252 Fix BackwardCompatibilityIT test failures (#1846)

2024-03-05 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 34ed816fd0 PHOENIX-7252 Fix BackwardCompatibilityIT test failures 
(#1846)
34ed816fd0 is described below

commit 34ed816fd0ab7f0773e6e975ae39544df0a28d49
Author: Rushabh Shah 
AuthorDate: Tue Mar 5 14:24:16 2024 -0800

PHOENIX-7252 Fix BackwardCompatibilityIT test failures (#1846)
---
 .../src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
index 3864292cbd..9e94f4eb1c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
@@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.phoenix.cache.ServerMetadataCache;
 import org.apache.phoenix.coprocessor.SystemCatalogRegionObserver;
 import org.apache.phoenix.coprocessor.TaskMetaDataEndpoint;
 import 
org.apache.phoenix.end2end.BackwardCompatibilityTestUtil.MavenCoordinates;
@@ -136,6 +137,7 @@ public class BackwardCompatibilityIT {
 DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
 } finally {
 hbaseTestUtil.shutdownMiniCluster();
+ServerMetadataCache.resetCache();
 }
 System.setProperty("java.io.tmpdir", tmpDir);
 assertFalse("refCount leaked", refCountLeaked);



(phoenix) 02/02: Fix merge conflicts with master

2024-02-20 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit ef48b93e02b047a7498d9d45c8631e2d3367c66c
Author: Rushabh Shah 
AuthorDate: Tue Feb 20 13:36:51 2024 -0800

Fix merge conflicts with master
---
 .../test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
index 48042655f3..963b97cc00 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
@@ -69,9 +69,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 



(phoenix) 01/02: Merge branch 'master' into PHOENIX-6883-feature

2024-02-20 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit d7fef5c8537ea4690e2a2b01518dd03f24061c24
Merge: 4f8811b456 8a94074c67
Author: Rushabh Shah 
AuthorDate: Tue Feb 20 13:09:57 2024 -0800

Merge branch 'master' into PHOENIX-6883-feature

 bin/hbase-omid-client-config.yml   |5 +-
 dev/phoenix-personality.sh |9 +-
 phoenix-assembly/pom.xml   |   55 +-
 .../src/build/components/all-common-jars.xml   |   16 +
 phoenix-client-parent/phoenix-client-lite/pom.xml  |  135 ++
 phoenix-client-parent/pom.xml  |2 -
 phoenix-core-client/pom.xml|9 +-
 .../BaseScannerRegionObserverConstants.java|   30 +
 .../ResultSetOutOfScanRangeException.java  |   30 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |1 +
 .../org/apache/phoenix/filter/PagingFilter.java|   24 +-
 .../phoenix/iterate/BaseResultIterators.java   |5 +-
 .../phoenix/iterate/OffsetResultIterator.java  |   47 +-
 .../phoenix/iterate/OrderedResultIterator.java |  212 ++-
 .../phoenix/iterate/ScanningResultIterator.java|   31 +
 .../ScanningResultPostDummyResultCaller.java   |   30 +
 .../ScanningResultPostValidResultCaller.java   |   30 +
 .../phoenix/iterate/TableResultIterator.java   |   36 +-
 .../phoenix/jdbc/AbstractRPCConnectionInfo.java|6 +-
 .../org/apache/phoenix/jdbc/ConnectionInfo.java|   25 +-
 .../apache/phoenix/jdbc/MasterConnectionInfo.java  |   15 +-
 .../org/apache/phoenix/jdbc/RPCConnectionInfo.java |   17 +-
 .../org/apache/phoenix/jdbc/ZKConnectionInfo.java  |   19 +-
 .../phoenix/job/AbstractRoundRobinQueue.java   |   16 +-
 .../phoenix/mapreduce/util/ConnectionUtil.java |   89 +-
 .../util/PhoenixConfigurationUtilHelper.java   |   50 +-
 .../org/apache/phoenix/query/QueryConstants.java   |3 +-
 .../org/apache/phoenix/query/QueryServices.java|   29 +
 .../apache/phoenix/query/QueryServicesOptions.java |   31 +-
 .../phoenix/transaction/OmidTransactionTable.java  |7 +-
 .../java/org/apache/phoenix/util/ByteUtil.java |  124 ++
 .../java/org/apache/phoenix/util/QueryUtil.java|   17 +-
 .../java/org/apache/phoenix/util/ScanUtil.java |  126 +-
 .../java/org/apache/phoenix/util/TupleUtil.java|   44 +-
 .../cache/aggcache/SpillableGroupByCache.java  |   66 +-
 .../coprocessor/BaseScannerRegionObserver.java |   42 +-
 .../apache/phoenix/coprocessor/GroupByCache.java   |1 +
 .../GroupedAggregateRegionObserver.java|  501 -
 .../coprocessor/IndexRebuildRegionScanner.java |   56 +-
 .../coprocessor/IndexRepairRegionScanner.java  |   27 +-
 .../phoenix/coprocessor/IndexerRegionScanner.java  |   31 +-
 .../phoenix/coprocessor/PagingRegionScanner.java   |   35 +-
 .../coprocessor/UncoveredIndexRegionScanner.java   |   76 +-
 .../UngroupedAggregateRegionObserver.java  |   50 +-
 .../UngroupedAggregateRegionScanner.java   |   13 +-
 .../apache/phoenix/index/GlobalIndexChecker.java   |   47 +-
 .../iterate/NonAggregateRegionScannerFactory.java  |  176 +-
 .../phoenix/mapreduce/PhoenixOutputFormat.java |5 +-
 .../phoenix/mapreduce/PhoenixRecordWriter.java |2 +-
 .../mapreduce/util/PhoenixConfigurationUtil.java   |   26 +-
 .../java/org/apache/phoenix/util/ServerUtil.java   |   16 +
 phoenix-core/pom.xml   |   39 +-
 .../end2end/AggregateQueryWithRegionMoves2IT.java  |  136 ++
 .../end2end/AggregateQueryWithRegionMovesIT.java   |  279 +++
 .../end2end/AggregateWithRegionMoves2IT.java   |  124 ++
 .../end2end/AggregateWithRegionMovesIT.java|  537 ++
 .../apache/phoenix/end2end/AppendOnlySchemaIT.java |   27 +-
 .../phoenix/end2end/BackwardCompatibilityIT.java   |   90 +
 .../end2end/BackwardCompatibilityTestUtil.java |   12 +
 .../end2end/BaseAggregateWithRegionMoves2IT.java   |  633 +++
 .../end2end/BaseAggregateWithRegionMoves3IT.java   |  124 ++
 .../end2end/BaseAggregateWithRegionMoves4IT.java   |  136 ++
 .../end2end/BaseAggregateWithRegionMovesIT.java|  998 ++
 .../end2end/BaseOrderByWithRegionMovesIT.java  | 1406 ++
 .../end2end/BaseQueryWithRegionMovesIT.java|  165 ++
 .../phoenix/end2end/ConfigurableCacheIT.java   |3 +-
 .../java/org/apache/phoenix/end2end/GroupByIT.java |   51 +
 .../phoenix/end2end/OrderByWithRegionMovesIT.java  |   14 +-
 .../end2end/OrderByWithServerMemoryLimitIT.java|   13 +-
 .../ParallelStatsDisabledWithRegionMovesIT.java|  310 +++
 .../end2end/ParameterizedIndexUpgradeToolIT.java   |2 +-
 .../org/apache/phoenix/end2end/QueryTimeoutIT.java |   38 +-
 .../apache/phoenix/end2end/QueryWithLimitIT.java   |   67 +-
 .../end2end/RebuildIndexConnectionPropsIT.java 

(phoenix) branch PHOENIX-6883-feature updated (4f8811b456 -> ef48b93e02)

2024-02-20 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 4f8811b456 PHOENIX-7212 : Handle inherited view indexes when 
validating LAST_DDL_TIMESTAMPS (#1823)
 add ed7871eb37 PHOENIX-7160 Change the TSO default port to be compatible 
with Omid 1.1.1 (#1774)
 add a90b87deec PHOENIX-7137 Create phoenix-client-lite shaded JAR without 
server-side dependencies
 add fec83cc3c6 PHOENIX-7139 Create phoenix-mapreduce-byo-shaded-hbase 
artifact
 add 2fc8b33c92 PHOENIX-7156 enabling category-wise integration test 
execution capability (#1770)
 add a45c78943e PHOENIX-7173 Update default HBase versions to 2.4.17 and 
2.5.7 respectively
 add 8106c24c19 PHOENIX-7043 Split FailoverPhoenixConnectionIT
 add 2d7bfe6f1b PHOENIX-7176 QueryTimeoutIT#testQueryTimeout fails with 
incorrect error message
 add 1f7c3d4ee4 PHOENIX-7178 Use skipITs instead of skip to disable 
failsafe tests
 add d331a15bfd PHOENIX-7138 Import netty-bom to make sure all netty 4.1 
modules share the same version
 add d0839b97e1 PHOENIX-7179 Remove HBase 2.3 leftover files (#1795)
 add 8dfb19abce PHOENIX-7163 Update commons-configuration2 to 2.8.0
 add 226a9ba027 Revert "PHOENIX-7163 Update commons-configuration2 to 2.8.0"
 add d936032078 PHOENIX-7176 QueryTimeoutIT#testQueryTimeout fails with 
incorrect error message (addendum: accept exactly 1000ms in timeout check)
 add 3492933940 PHOENIX-7181 Do not declare commons-configuration2 
dependency
 add 25cdd7fbf4 PHOENIX-7171 Update Zookeeper to 3.8.3 when building with 
HBase 2.4+
 add b70f01812f PHOENIX-7175 Set java.io.tmpdir to the maven build 
directory for tests
 add 1671c989a9 PHOENIX-7187 Improvement of Integration test case with 
Explain Plan for Partial Index (#1803)
 add 802d30938a PHOENIX-7194 Yetus does not run tests in phoenix-core if 
phoenix-core-client or phoenix-core-server changes
 add 97c28919d3 PHOENIX-7195 Exclude reload4j dependencies from Hadoop and 
add explicit log4j2 test dependencies
 add 87e3361e1f PHOENIX-7106 Data Integrity issues due to invalid rowkeys 
returned by various coprocessors (#1736)
 add 06f5abc5b9 PHOENIX-6769 Align mockito version with Hadoop and HBase
 add 4ba8a33a03 PHOENIX-7188 Remove Omid TTable.getTableDescriptor() calls
 add d0ed96f2aa PHOENIX-7141 Use relocate by default for phoenix-server 
shading
 add 02944504a0 PHOENIX-7165 getTable should retrieve PTable from server if 
not cached (#1777)
 add 25329d5bce PHOENIX-7189 Update Omid to 1.1.1 (#1818)
 add 3d2e0e4288 PHOENIX-7191 Connectionless CQSs don't work with non-ZK 
registries
 add 354716eed9 PHOENIX-7213 Add option for unlimited 
phoenix.query.QueueSize
 add 185fe32bde PHOENIX-7157 Upgrade to phoenix-thirdparty 2.1.0 (#1771)
 add bf3a6226e6 PHOENIX-7193 Fix cluster override for mapreduce jobs for 
non-ZK registries
 add bd56d7ceea PHOENIX-7218 Drop HBase 2.4.0 support in 5.2
 add 8a94074c67 PHOENIX-7220 Make HBase 2.5 profile the default
 new d7fef5c853 Merge branch 'master' into PHOENIX-6883-feature
 new ef48b93e02 Fix merge conflicts with master

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 bin/hbase-omid-client-config.yml   |5 +-
 dev/phoenix-personality.sh |9 +-
 phoenix-assembly/pom.xml   |   55 +-
 .../src/build/components/all-common-jars.xml   |   16 +
 .../pom.xml|   10 +-
 phoenix-client-parent/pom.xml  |2 -
 phoenix-core-client/pom.xml|9 +-
 .../BaseScannerRegionObserverConstants.java|   30 +
 java => ResultSetOutOfScanRangeException.java} |   22 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |1 +
 .../org/apache/phoenix/filter/PagingFilter.java|   24 +-
 .../phoenix/iterate/BaseResultIterators.java   |5 +-
 .../phoenix/iterate/OffsetResultIterator.java  |   47 +-
 .../phoenix/iterate/OrderedResultIterator.java |  212 ++-
 .../phoenix/iterate/ScanningResultIterator.java|   31 +
 .../ScanningResultPostDummyResultCaller.java}  |   14 +-
 .../ScanningResultPostValidResultCaller.java}  |   14 +-
 .../phoenix/iterate/TableResultIterator.java   |   36 +-
 .../phoenix/jdbc/AbstractRPCConnectionInfo.java|6 +-
 .../org/apache/phoenix/jdbc/ConnectionInfo.java|   25 +-
 .../apache/phoenix/jdbc/MasterConnectionInfo.java  |   15 +-
 .../org/apache/phoenix/jdbc/RPCConnectionInfo.java |   17 +-
 .../org/apache/phoenix/jdbc/Z

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7212 : Handle inherited view indexes when validating LAST_DDL_TIMESTAMPS (#1823)

2024-02-14 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 4f8811b456 PHOENIX-7212 : Handle inherited view indexes when 
validating LAST_DDL_TIMESTAMPS (#1823)
4f8811b456 is described below

commit 4f8811b4562fb062f1bc88416e932ea2be9743ec
Author: palash 
AuthorDate: Wed Feb 14 09:50:43 2024 -0800

PHOENIX-7212 : Handle inherited view indexes when validating 
LAST_DDL_TIMESTAMPS (#1823)
---
 .../org/apache/phoenix/execute/MutationState.java  |  2 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  |  2 +-
 .../phoenix/util/ValidateLastDDLTimestampUtil.java | 60 ---
 .../java/org/apache/phoenix/util/ViewUtil.java |  3 +-
 .../phoenix/cache/ServerMetadataCacheTest.java | 90 ++
 .../apache/phoenix/compile/WhereOptimizerTest.java | 43 +++
 6 files changed, 170 insertions(+), 30 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/MutationState.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/MutationState.java
index 60df3a570f..a4341b91a9 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -1219,7 +1219,7 @@ public class MutationState implements SQLCloseable {
 List tableRefs = new 
ArrayList<>(this.mutationsMap.keySet());
 try {
 ValidateLastDDLTimestampUtil.validateLastDDLTimestamp(
-connection, tableRefs, true, true);
+connection, tableRefs, true);
 } catch (StaleMetadataCacheException e) {
 GlobalClientMetrics
 
.GLOBAL_CLIENT_STALE_METADATA_CACHE_EXCEPTION_COUNTER.increment();
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 aec3b4d78d..fa59125e86 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
@@ -389,7 +389,7 @@ public class PhoenixStatement implements 
PhoenixMonitoredStatement, SQLCloseable
 //plan.getTableRef can be null in some cases 
like EXPLAIN 
 if (shouldValidateLastDdlTimestamp && 
plan.getTableRef() != null) {
 
ValidateLastDDLTimestampUtil.validateLastDDLTimestamp(
-connection, 
Arrays.asList(plan.getTableRef()), false, true);
+connection, 
Arrays.asList(plan.getTableRef()), true);
 }
 
 if (plan.getTableRef() != null
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
index 01d58f2f11..7d77e6aa89 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/util/ValidateLastDDLTimestampUtil.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.RegionServerEndpointProtos;
 import org.apache.phoenix.exception.StaleMetadataCacheException;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PName;
@@ -74,15 +75,14 @@ public class ValidateLastDDLTimestampUtil {
  * Verifies that table metadata for given tables is up-to-date in client 
cache with server.
  * A random live region server is picked for invoking the RPC to validate 
LastDDLTimestamp.
  * Retry once if there was an error performing the RPC, otherwise throw 
the Exception.
+ *
  * @param tableRefs
- * @param isWritePath
  * @param doRetry
  * @throws SQLException
  */
-public static void validateLastDDLTimestamp(
-PhoenixConnection conn, List tableRefs, boolean 
isWritePath, boolean doRetry)
-throws SQLException {
-
+public static void validateLastDDLTimestamp(PhoenixConnection conn,
+List tableRefs,
+boolean doRetry) throws 
SQLException {
 String infoString = getInfoString(conn.getTenantId(), tableRefs);
 try (Admin admin = conn.getQueryServi

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7190 : Store LAST_DDL_TIMESTAMP of all ancestors in a View's PTable (#1807)

2024-02-08 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 39d7e94885 PHOENIX-7190 : Store LAST_DDL_TIMESTAMP of all ancestors in 
a View's PTable (#1807)
39d7e94885 is described below

commit 39d7e94885cb5fc0e86e1d090d4398ade6a071fe
Author: palash 
AuthorDate: Thu Feb 8 14:43:51 2024 -0800

PHOENIX-7190 : Store LAST_DDL_TIMESTAMP of all ancestors in a View's PTable 
(#1807)
---
 .../org/apache/phoenix/schema/DelegateTable.java   |   5 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  72 +--
 .../java/org/apache/phoenix/schema/PTable.java |   4 +
 .../java/org/apache/phoenix/schema/PTableImpl.java |  15 ++-
 .../java/org/apache/phoenix/schema/PTableKey.java  |  13 ++
 .../phoenix/util/ValidateLastDDLTimestampUtil.java |  60 -
 .../org/apache/phoenix/end2end/ViewMetadataIT.java | 117 ++
 .../java/org/apache/phoenix/rpc/UpdateCacheIT.java |   2 +-
 .../phoenix/cache/ServerMetadataCacheTest.java | 134 +
 9 files changed, 371 insertions(+), 51 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/DelegateTable.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/DelegateTable.java
index 1a5d83e728..453a7663d1 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/DelegateTable.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/DelegateTable.java
@@ -413,6 +413,11 @@ public class DelegateTable implements PTable {
 return delegate.getIndexWhere();
 }
 
+@Override
+public Map getAncestorLastDDLTimestampMap() {
+return delegate.getAncestorLastDDLTimestampMap();
+}
+
 @Override
 public Expression getIndexWhereExpression(PhoenixConnection connection)
 throws SQLException {
diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 4878cb5cf4..0d63f089f5 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -716,8 +716,9 @@ public class MetaDataClient {
 // In this case, we update the parent table which 
may in turn pull
 // in indexes to add to this table.
 long resolvedTime = 
TransactionUtil.getResolvedTime(connection, result);
-if (addColumnsAndIndexesFromAncestors(result, 
resolvedTimestamp,
-true, false)) {
+if 
(addColumnsIndexesAndLastDDLTimestampsFromAncestors(result,
+resolvedTimestamp, true, false)) {
+updateIndexesWithAncestorMap(result);
 connection.addTable(result.getTable(), 
resolvedTime);
 } else {
 // if we aren't adding the table, we still 
need to update the
@@ -898,14 +899,14 @@ public class MetaDataClient {
  * @return true if the PTable contained by result was modified and false 
otherwise
  * @throws SQLException if the physical table cannot be found
  */
-private boolean addColumnsAndIndexesFromAncestors(MetaDataMutationResult 
result, Long resolvedTimestamp,
-  boolean 
alwaysAddAncestorColumnsAndIndexes,
-  boolean 
alwaysHitServerForAncestors)
+private boolean addColumnsIndexesAndLastDDLTimestampsFromAncestors(
+MetaDataMutationResult result, 
Long resolvedTimestamp,
+boolean 
alwaysAddAncestorColumnsAndIndexes,
+boolean 
alwaysHitServerForAncestors)
 throws SQLException {
 PTable table = result.getTable();
 boolean hasIndexId = table.getViewIndexId() != null;
-// only need to inherit columns and indexes for view indexes and views
-if ((table.getType()==PTableType.INDEX && hasIndexId)
+if (table.getType() == PTableType.INDEX
 || (table.getType() == PTableType.VIEW && table.getViewType() 
!= ViewType.MAPPED)) {
 String tableName = null;
 try {
@@ -940,8 +941,18 @@ public class MetaDataClient {
 if (!alwaysAddAncestorColumnsAndIndexes && 
!result.wasUpdated() && !parentResult.wasUpdated()) {
 return false;
 }
-result.setTable

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for SYSTEM.CATALOG PTable object (#1779)

2024-01-08 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 01e29020c2 PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for 
SYSTEM.CATALOG PTable object (#1779)
01e29020c2 is described below

commit 01e29020c29bad15b0c7a7636275ca5cc697b569
Author: palash 
AuthorDate: Mon Jan 8 09:47:19 2024 -0800

PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for SYSTEM.CATALOG PTable 
object (#1779)
---
 .../phoenix/coprocessor/MetaDataEndpointImpl.java |  6 ++
 .../apache/phoenix/cache/ServerMetadataCacheTest.java | 19 +++
 2 files changed, 25 insertions(+)

diff --git 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 50ffb9c07b..352ba5d969 100644
--- 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -2506,6 +2506,12 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 builder.setMutationTime(currentTimeStamp);
 //send the newly built table back because we generated the DDL 
timestamp server
 // side and the client doesn't have it.
+if (clientTimeStamp != HConstants.LATEST_TIMESTAMP) {
+// if a client uses a connection with currentSCN=t to 
create the table,
+// the table is created with timestamp 't' but the 
timestamp range in the scan
+// used by buildTable does not include 't' due to how SCN 
is implemented.
+clientTimeStamp += 1;
+}
 PTable newTable = buildTable(tableKey, cacheKey, region,
 clientTimeStamp, clientVersion);
 if (newTable != null) {
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
index cc9d2f49c5..f857b670c8 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
@@ -803,6 +803,25 @@ public class ServerMetadataCacheTest extends 
ParallelStatsDisabledIT {
 }
 }
 
+/**
+ * https://issues.apache.org/jira/browse/PHOENIX-7167
+ * Use the default connection to query system tables to confirm
+ * that the PTable object for SYSTEM tables is correctly bootstrapped.
+ */
+@Test
+public void testSystemTablesBootstrap() throws Exception {
+Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+String url = QueryUtil.getConnectionUrl(props, config);
+ConnectionQueryServices cqs = driver.getConnectionQueryServices(url, 
props);
+
+try (Connection conn = cqs.connect(url, props)) {
+query(conn, PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+query(conn, PhoenixDatabaseMetaData.SYSTEM_TASK_NAME);
+query(conn, PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME);
+query(conn, PhoenixDatabaseMetaData.SYSTEM_LOG_NAME);
+}
+}
+
 /**
  * Test query on index with stale last ddl timestamp.
  * Client-1 creates a table and an index on it. Client-2 queries table to 
populate its cache.



(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7115 Create separate handler thread pool for invalidating server metadata cache (#1748)

2023-12-22 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 83134d9731 PHOENIX-7115 Create separate handler thread pool for 
invalidating server metadata cache (#1748)
83134d9731 is described below

commit 83134d9731ab12072d23573d2c38252489d306bb
Author: Rushabh Shah 
AuthorDate: Fri Dec 22 08:44:40 2023 -0800

PHOENIX-7115 Create separate handler thread pool for invalidating server 
metadata cache (#1748)
---
 .../FailingPhoenixRegionServerEndpoint.java|   4 +-
 .../phoenix/end2end/InvalidateMetadataCacheIT.java |   4 +-
 .../hadoop/hbase/ipc/PhoenixRpcScheduler.java  |  37 +++-
 .../hbase/ipc/PhoenixRpcSchedulerFactory.java  |  14 +-
 ...java => InvalidateMetadataCacheController.java} |  36 ++--
 ... InvalidateMetadataCacheControllerFactory.java} |  26 +--
 .../controller/ServerSideRPCControllerFactory.java |   3 -
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  | 195 +
 .../phoenix/query/ConnectionQueryServices.java |   4 +
 .../phoenix/query/ConnectionQueryServicesImpl.java | 236 +++--
 .../query/ConnectionlessQueryServicesImpl.java |   7 +
 .../query/DelegateConnectionQueryServices.java |   7 +
 .../org/apache/phoenix/query/QueryServices.java|  10 +-
 .../apache/phoenix/query/QueryServicesOptions.java |   2 +
 ...dulerTest.java => PhoenixRpcSchedulerTest.java} |  61 --
 .../phoenix/cache/ServerMetadataCacheTest.java |  26 ++-
 16 files changed, 405 insertions(+), 267 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
index 7e40cfe76f..5f33610c29 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
@@ -27,8 +27,8 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 
-import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
-import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS_DEFAULT;
+import static 
org.apache.phoenix.query.QueryServices.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
+import static 
org.apache.phoenix.query.QueryServices.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS_DEFAULT;
 
 public class FailingPhoenixRegionServerEndpoint extends 
PhoenixRegionServerEndpoint {
 private static final Logger LOGGER = 
LoggerFactory.getLogger(FailingPhoenixRegionServerEndpoint.class);
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
index c0727b9d68..b8d1d55732 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
@@ -34,8 +34,8 @@ import java.util.Map;
 import java.util.Properties;
 
 import static 
org.apache.hadoop.hbase.coprocessor.CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY;
-import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
-import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED;
+import static 
org.apache.phoenix.query.QueryServices.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
+import static 
org.apache.phoenix.query.QueryServices.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.fail;
 
diff --git 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java
 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java
index ea6a5c9719..0a04ad4787 100644
--- 
a/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java
+++ 
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/ipc/PhoenixRpcScheduler.java
@@ -27,12 +27,13 @@ import org.apache.phoenix.query.QueryServicesOptions;
 
 import 
org.apache.phoenix.thirdparty.com.google.common.annotations.VisibleForTesting;
 
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_INVALIDATE_CACHE_HANDLER_COUNT;
+
 /**
  * {@link RpcScheduler} that first checks to see if this is an index or 
metadata update before passing off the
  * call to the delegate {@link RpcScheduler}.
  */
 public class PhoenixRpcScheduler extends CompatPhoenixRpcScheduler {
-
 // copied from org.apache.hadoop.hbase.ipc.SimpleRpcScheduler in HBase 
0.98.4
 private 

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7113 Create a feature flag for invoking MDEI#invalidateServerMetadataCache (#1753)

2023-12-13 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new e5efffb4ed PHOENIX-7113 Create a feature flag for invoking 
MDEI#invalidateServerMetadataCache (#1753)
e5efffb4ed is described below

commit e5efffb4ed16f256d8c27552936a1725672c5fae
Author: Rushabh Shah 
AuthorDate: Wed Dec 13 09:12:04 2023 -0800

PHOENIX-7113 Create a feature flag for invoking 
MDEI#invalidateServerMetadataCache (#1753)
---
 .../apache/phoenix/end2end/InvalidateMetadataCacheIT.java  |  2 ++
 .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java   | 14 +++---
 .../org/apache/phoenix/cache/ServerMetadataCacheTest.java  |  2 ++
 .../src/test/java/org/apache/phoenix/query/BaseTest.java   |  7 ++-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
index f399610a2e..c0727b9d68 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InvalidateMetadataCacheIT.java
@@ -35,6 +35,7 @@ import java.util.Properties;
 
 import static 
org.apache.hadoop.hbase.coprocessor.CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY;
 import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
+import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.fail;
 
@@ -48,6 +49,7 @@ public class InvalidateMetadataCacheIT extends BaseTest {
 Map props = Maps.newHashMapWithExpectedSize(1);
 // to fail fast in case of exception.
 props.put("hbase.client.retries.number", String.valueOf(0));
+props.put(PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, "true");
 props.put(REGIONSERVER_COPROCESSOR_CONF_KEY,
 FailingPhoenixRegionServerEndpoint.class.getName());
 // Setting phoenix metadata cache invalidation timeout to a small 
number to fail fast.
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index d905f6ad5b..c9aa4acb73 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -18,7 +18,6 @@
 package org.apache.phoenix.coprocessor;
 
 import static org.apache.hadoop.hbase.KeyValueUtil.createFirstOnRow;
-import static 
org.apache.hadoop.hbase.coprocessor.CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY;
 import static 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MutationCode.UNABLE_TO_CREATE_CHILD_LINK;
 import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.APPEND_ONLY_SCHEMA_BYTES;
 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARRAY_SIZE_BYTES;
@@ -333,6 +332,8 @@ public class MetaDataEndpointImpl extends MetaDataProtocol 
implements RegionCopr
 "phoenix.metadata.cache.invalidation.timeoutMs";
 // Default to 10 seconds.
 public static final long 
PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS_DEFAULT = 10 * 1000;
+public static final String PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED =
+"phoenix.metadata.invalidate.cache.enabled";
 // KeyValues for Table
 private static final Cell TABLE_TYPE_KV = 
createFirstOnRow(ByteUtil.EMPTY_BYTE_ARRAY,
 TABLE_FAMILY_BYTES, TABLE_TYPE_BYTES);
@@ -3490,12 +3491,11 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 private void 
invalidateServerMetadataCache(List 
requests)
 throws Throwable {
 Configuration conf = env.getConfiguration();
-String value = conf.get(REGIONSERVER_COPROCESSOR_CONF_KEY);
-if (value == null
-|| 
!value.contains(PhoenixRegionServerEndpoint.class.getName())) {
-// PhoenixRegionServerEndpoint is not loaded. We don't have to 
invalidate the cache.
-LOGGER.info("Skip invalidating server metadata cache since 
PhoenixRegionServerEndpoint"
-+ " is not loaded");
+boolean invalidateCacheEnabled = 
conf.getBoolean(PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED,
+false);
+if (!invalidateCacheEnabled) {
+LOGGER.info("Skip invalidating server metadata cache since conf 
property"
++ " p

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7111 : Metrics for server-side metadata cache (#1744)

2023-12-12 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 6ae5e4dc64 PHOENIX-7111 : Metrics for server-side metadata cache 
(#1744)
6ae5e4dc64 is described below

commit 6ae5e4dc645808c56d40896cee14b8ca2972b909
Author: palash 
AuthorDate: Wed Dec 13 00:43:18 2023 +0530

PHOENIX-7111 : Metrics for server-side metadata cache (#1744)
---
 .../apache/phoenix/cache/ServerMetadataCache.java  |   8 +-
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  |  24 ++-
 .../coprocessor/PhoenixRegionServerEndpoint.java   |   6 +
 .../metrics/MetricsMetadataCachingSource.java  | 230 +
 .../metrics/MetricsMetadataCachingSourceImpl.java  | 122 +++
 .../MetricsPhoenixCoprocessorSourceFactory.java|  12 ++
 .../org/apache/phoenix/execute/MutationState.java  |   3 +-
 .../phoenix/cache/ServerMetadataCacheTest.java | 117 +++
 8 files changed, 517 insertions(+), 5 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
index 15ce11e145..33a90af994 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
@@ -24,6 +24,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.coprocessor.metrics.MetricsMetadataCachingSource;
+import 
org.apache.phoenix.coprocessor.metrics.MetricsPhoenixCoprocessorSourceFactory;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.schema.PTable;
 import 
org.apache.phoenix.thirdparty.com.google.common.annotations.VisibleForTesting;
@@ -57,6 +59,7 @@ public class ServerMetadataCache {
 // key is the combination of , value is 
the lastDDLTimestamp
 private final Cache lastDDLTimestampMap;
 private Connection connectionForTesting;
+private MetricsMetadataCachingSource metricsSource;
 
 /**
  * Creates/gets an instance of ServerMetadataCache.
@@ -78,6 +81,8 @@ public class ServerMetadataCache {
 
 private ServerMetadataCache(Configuration conf) {
 this.conf = conf;
+this.metricsSource = MetricsPhoenixCoprocessorSourceFactory
+.getInstance().getMetadataCachingSource();
 long maxTTL = conf.getLong(PHOENIX_COPROC_REGIONSERVER_CACHE_TTL_MS,
 DEFAULT_PHOENIX_COPROC_REGIONSERVER_CACHE_TTL_MS);
 long maxSize = conf.getLong(PHOENIX_COPROC_REGIONSERVER_CACHE_SIZE,
@@ -111,11 +116,12 @@ public class ServerMetadataCache {
 // Lookup in cache if present.
 Long lastDDLTimestamp = lastDDLTimestampMap.getIfPresent(tableKeyPtr);
 if (lastDDLTimestamp != null) {
+metricsSource.incrementRegionServerMetadataCacheHitCount();
 LOGGER.trace("Retrieving last ddl timestamp value from cache for 
tableName: {}",
 fullTableNameStr);
 return lastDDLTimestamp;
 }
-
+metricsSource.incrementRegionServerMetadataCacheMissCount();
 PTable table;
 String tenantIDStr = Bytes.toString(tenantID);
 if (tenantIDStr == null || tenantIDStr.isEmpty()) {
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 3beb426da0..d905f6ad5b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -189,6 +189,8 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.GetVersionRespons
 import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.UpdateIndexStateRequest;
 import org.apache.phoenix.coprocessor.generated.RegionServerEndpointProtos;
+import org.apache.phoenix.coprocessor.metrics.MetricsMetadataCachingSource;
+import 
org.apache.phoenix.coprocessor.metrics.MetricsPhoenixCoprocessorSourceFactory;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
 import org.apache.phoenix.expression.Expression;
@@ -609,6 +611,7 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 private boolean allowSplittableSystemCatalogRollback;
 
 private MetricsMetadataSource metricsSource;
+private MetricsMetadataCachingSource metricsMetadataCachingSource;
 private long metadataCacheInvalidationTimeoutMs;
 public s

(phoenix) 01/01: Merge branch 'master' into PHOENIX-6883-feature

2023-12-10 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 7e6fe7ffc2fdc3fe104fc6785eaab63af1ce21bf
Merge: 4499c2965a b241252307
Author: Rushabh Shah 
AuthorDate: Sun Dec 10 19:20:25 2023 -0800

Merge branch 'master' into PHOENIX-6883-feature

 .../org/apache/phoenix/end2end/AlterTableIT.java   |   75 +-
 .../end2end/BaseTenantSpecificViewIndexIT.java |8 +-
 .../phoenix/end2end/ClientHashAggregateIT.java |   38 +-
 .../phoenix/end2end/CostBasedDecisionIT.java   |   57 +-
 .../java/org/apache/phoenix/end2end/DeleteIT.java  |2 +-
 .../phoenix/end2end/FlappingLocalIndexIT.java  |   16 +-
 .../java/org/apache/phoenix/end2end/InListIT.java  |7 +-
 .../phoenix/end2end/IndexBuildTimestampIT.java |6 +-
 .../apache/phoenix/end2end/IndexExtendedIT.java|4 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java|8 +-
 .../phoenix/end2end/LocalIndexSplitMergeIT.java|   16 +-
 .../phoenix/end2end/MetaDataEndpointImplIT.java|   26 +-
 .../phoenix/end2end/QueryDatabaseMetaDataIT.java   |   50 +
 .../end2end/RebuildIndexConnectionPropsIT.java |4 +-
 .../phoenix/end2end/TenantSpecificViewIndexIT.java |   13 +-
 .../phoenix/end2end/UserDefinedFunctionsIT.java|2 +-
 .../end2end/ViewExtendsPkRestrictionsIT.java   | 1169 
 .../it/java/org/apache/phoenix/end2end/ViewIT.java |   10 +-
 .../java/org/apache/phoenix/end2end/ViewTTLIT.java |   65 +-
 .../apache/phoenix/end2end/index/BaseIndexIT.java  |   23 +-
 .../end2end/index/GlobalIndexOptimizationIT.java   |3 +-
 .../phoenix/end2end/index/IndexMaintenanceIT.java  |8 +-
 .../apache/phoenix/end2end/index/IndexUsageIT.java |   26 +-
 .../apache/phoenix/end2end/index/LocalIndexIT.java |   40 +-
 .../end2end/index/MutableIndexFailureIT.java   |5 +-
 .../phoenix/end2end/index/MutableIndexIT.java  |   25 +-
 .../phoenix/end2end/index/PartialIndexIT.java  |  767 +
 .../index/UncoveredGlobalIndexRegionScannerIT.java |9 +-
 .../apache/phoenix/end2end/index/ViewIndexIT.java  |5 +-
 .../end2end/index/txn/TxWriteFailureIT.java|3 +-
 .../apache/phoenix/end2end/join/BaseJoinIT.java|   10 +
 .../phoenix/end2end/join/HashJoinLocalIndexIT.java |  111 +-
 .../end2end/join/SortMergeJoinLocalIndexIT.java|   22 +-
 .../apache/phoenix/end2end/join/SubqueryIT.java|   40 +-
 .../end2end/join/SubqueryUsingSortMergeJoinIT.java |   30 +-
 .../ConnectionQueryServicesMetricsIT.java  |  366 ++
 phoenix-core/src/main/antlr3/PhoenixSQL.g  |9 +-
 .../phoenix/compile/CreateIndexCompiler.java   |  186 +++-
 .../phoenix/compile/CreateTableCompiler.java   |   61 +
 .../phoenix/compile/ServerBuildIndexCompiler.java  |   20 +-
 .../apache/phoenix/compile/StatementContext.java   |   25 +-
 .../org/apache/phoenix/compile/WhereCompiler.java  |  613 +-
 .../coprocessor/GlobalIndexRegionScanner.java  |   69 +-
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  |   15 +-
 .../phoenix/coprocessor/MetaDataProtocol.java  |2 +-
 .../coprocessor/MetaDataRegionObserver.java|   21 +-
 .../coprocessor/UncoveredIndexRegionScanner.java   |   15 +-
 .../UngroupedAggregateRegionObserver.java  |2 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |9 +-
 .../execute/PhoenixTxIndexMutationGenerator.java   |5 +-
 .../phoenix/expression/ComparisonExpression.java   |  138 ++-
 .../org/apache/phoenix/expression/Expression.java  |   10 +
 .../phoenix/expression/IsNullExpression.java   |   16 +-
 .../phoenix/hbase/index/IndexRegionObserver.java   |   60 +-
 .../org/apache/phoenix/index/IndexMaintainer.java  |  123 +-
 .../org/apache/phoenix/iterate/ExplainTable.java   |   20 +-
 .../phoenix/iterate/OffsetResultIterator.java  |2 +-
 .../phoenix/iterate/RegionScannerFactory.java  |   15 +-
 .../phoenix/iterate/TableResultIterator.java   |   23 +
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |   98 +-
 .../phoenix/jdbc/PhoenixDatabaseMetaData.java  |  507 +
 .../org/apache/phoenix/jdbc/PhoenixResultSet.java  |7 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  |   76 +-
 .../apache/phoenix/log/BaseConnectionLimiter.java  |   15 +-
 .../org/apache/phoenix/log/ConnectionLimiter.java  |4 +
 .../apache/phoenix/monitoring/AtomicMetric.java|   10 +
 .../phoenix/monitoring/CombinableMetric.java   |8 +
 .../phoenix/monitoring/CombinableMetricImpl.java   |   10 +
 .../ConnectionQueryServicesMetric.java}|   29 +-
 ...java => ConnectionQueryServicesMetricImpl.java} |   25 +-
 .../phoenix/monitoring/GlobalMetricImpl.java   |   10 +
 .../java/org/apache/phoenix/monitoring/Metric.java |4 +
 .../phoenix/monitoring/NoOpGlobalMetricImpl.java   |   10 +
 .../apache/phoen

(phoenix) branch PHOENIX-6883-feature updated (4499c2965a -> 7e6fe7ffc2)

2023-12-10 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 4499c2965a PHOENIX-7026 : Validate LAST_DDL_TIMESTAMP for write 
requests (#1726)
 add 5d5aaca213 PHOENIX-7038 : Implement Connection Query Service Metrics 
(#1682)
 add 2feb70fc2e PHOENIX-7032 Partial Global Secondary Indexes (#1701)
 add 20529a62b8 PHOENIX-7102 phoenix-connectors doesn't compile with core 
HEAD
 add 62ccb3b815 PHOENIX-7067 View indexes should be created only on non 
overlapping updatable views (#1709)
 add b64a9736b7 PHOENIX-7095 Implement Statement.closeOnCompletion() and 
fix related close() bugs
 add 5128ad0e7d PHOENIX-7076 : MetaDataRegionObserver#postOpen hook 
improvements (#1735)
 add 1a2f09ced1 PHOENIX-7109 Incorrect query results when using OFFSET
 add da53e659f9 PHOENIX-7121 Do not exclude commons-beanutils from Omid 
dependencies
 add b241252307 PHOENIX-7101 Explain plan to output local index name if it 
is used (#1737)
 new 7e6fe7ffc2 Merge branch 'master' into PHOENIX-6883-feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/phoenix/end2end/AlterTableIT.java   |   75 +-
 .../end2end/BaseTenantSpecificViewIndexIT.java |8 +-
 .../phoenix/end2end/ClientHashAggregateIT.java |   38 +-
 .../phoenix/end2end/CostBasedDecisionIT.java   |   57 +-
 .../java/org/apache/phoenix/end2end/DeleteIT.java  |2 +-
 .../phoenix/end2end/FlappingLocalIndexIT.java  |   16 +-
 .../java/org/apache/phoenix/end2end/InListIT.java  |7 +-
 .../phoenix/end2end/IndexBuildTimestampIT.java |6 +-
 .../apache/phoenix/end2end/IndexExtendedIT.java|4 +-
 .../org/apache/phoenix/end2end/IndexToolIT.java|8 +-
 .../phoenix/end2end/LocalIndexSplitMergeIT.java|   16 +-
 .../phoenix/end2end/MetaDataEndpointImplIT.java|   26 +-
 .../phoenix/end2end/QueryDatabaseMetaDataIT.java   |   50 +
 .../end2end/RebuildIndexConnectionPropsIT.java |4 +-
 .../phoenix/end2end/TenantSpecificViewIndexIT.java |   13 +-
 .../phoenix/end2end/UserDefinedFunctionsIT.java|2 +-
 .../end2end/ViewExtendsPkRestrictionsIT.java   | 1169 
 .../it/java/org/apache/phoenix/end2end/ViewIT.java |   10 +-
 .../java/org/apache/phoenix/end2end/ViewTTLIT.java |   65 +-
 .../apache/phoenix/end2end/index/BaseIndexIT.java  |   23 +-
 .../end2end/index/GlobalIndexOptimizationIT.java   |3 +-
 .../phoenix/end2end/index/IndexMaintenanceIT.java  |8 +-
 .../apache/phoenix/end2end/index/IndexUsageIT.java |   26 +-
 .../apache/phoenix/end2end/index/LocalIndexIT.java |   40 +-
 .../end2end/index/MutableIndexFailureIT.java   |5 +-
 .../phoenix/end2end/index/MutableIndexIT.java  |   25 +-
 .../phoenix/end2end/index/PartialIndexIT.java  |  767 +
 .../index/UncoveredGlobalIndexRegionScannerIT.java |9 +-
 .../apache/phoenix/end2end/index/ViewIndexIT.java  |5 +-
 .../end2end/index/txn/TxWriteFailureIT.java|3 +-
 .../apache/phoenix/end2end/join/BaseJoinIT.java|   10 +
 .../phoenix/end2end/join/HashJoinLocalIndexIT.java |  111 +-
 .../end2end/join/SortMergeJoinLocalIndexIT.java|   22 +-
 .../apache/phoenix/end2end/join/SubqueryIT.java|   40 +-
 .../end2end/join/SubqueryUsingSortMergeJoinIT.java |   30 +-
 .../ConnectionQueryServicesMetricsIT.java  |  366 ++
 phoenix-core/src/main/antlr3/PhoenixSQL.g  |9 +-
 .../phoenix/compile/CreateIndexCompiler.java   |  186 +++-
 .../phoenix/compile/CreateTableCompiler.java   |   61 +
 .../phoenix/compile/ServerBuildIndexCompiler.java  |   20 +-
 .../apache/phoenix/compile/StatementContext.java   |   25 +-
 .../org/apache/phoenix/compile/WhereCompiler.java  |  613 +-
 .../coprocessor/GlobalIndexRegionScanner.java  |   69 +-
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  |   15 +-
 .../phoenix/coprocessor/MetaDataProtocol.java  |2 +-
 .../coprocessor/MetaDataRegionObserver.java|   21 +-
 .../coprocessor/UncoveredIndexRegionScanner.java   |   15 +-
 .../UngroupedAggregateRegionObserver.java  |2 +-
 .../apache/phoenix/exception/SQLExceptionCode.java |9 +-
 .../execute/PhoenixTxIndexMutationGenerator.java   |5 +-
 .../phoenix/expression/ComparisonExpression.java   |  138 ++-
 .../org/apache/phoenix/expression/Expression.java  |   10 +
 .../phoenix/expression/IsNullExpression.java   |   16 +-
 .../phoenix/hbase/index/IndexRegionObserver.java   |   60 +-
 .../org/apache/phoenix/index/IndexMaintainer.java  |  123 +-
 .../org/apache/phoenix/iterate/ExplainTable.java   |   20 +-
 .../phoenix/iterate/Of

(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7026 : Validate LAST_DDL_TIMESTAMP for write requests (#1726)

2023-11-29 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 4499c2965a PHOENIX-7026 : Validate LAST_DDL_TIMESTAMP for write 
requests (#1726)
4499c2965a is described below

commit 4499c2965af9e07491bfab104b94d8be697d0e35
Author: palash 
AuthorDate: Wed Nov 29 23:24:30 2023 +0530

PHOENIX-7026 : Validate LAST_DDL_TIMESTAMP for write requests (#1726)
---
 .../org/apache/phoenix/execute/MutationState.java  |  66 +++-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  | 135 +--
 .../phoenix/monitoring/GlobalClientMetrics.java|   4 +-
 .../org/apache/phoenix/monitoring/MetricType.java  |   3 +
 .../phoenix/util/ValidateLastDDLTimestampUtil.java | 211 ++
 .../phoenix/cache/ServerMetadataCacheTest.java | 440 -
 6 files changed, 708 insertions(+), 151 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index 1cf23d7e0f..1612fe36a0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -68,6 +68,7 @@ import 
org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.exception.StaleMetadataCacheException;
 import org.apache.phoenix.hbase.index.IndexRegionObserver;
 import org.apache.phoenix.hbase.index.exception.IndexWriteException;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
@@ -122,6 +123,7 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.ServerUtil;
 import org.apache.phoenix.util.SizedUtil;
 import org.apache.phoenix.util.TransactionUtil;
+import org.apache.phoenix.util.ValidateLastDDLTimestampUtil;
 import org.apache.phoenix.util.WALAnnotationUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -159,6 +161,7 @@ public class MutationState implements SQLCloseable {
 private long estimatedSize = 0;
 private int[] uncommittedStatementIndexes = EMPTY_STATEMENT_INDEX_ARRAY;
 private boolean isExternalTxContext = false;
+private boolean validateLastDdlTimestamp;
 private Map> txMutations = 
Collections.emptyMap();
 
 private PhoenixTransactionContext phoenixTransactionContext = 
PhoenixTransactionContext.NULL_CONTEXT;
@@ -221,6 +224,8 @@ public class MutationState implements SQLCloseable {
 boolean isMetricsEnabled = connection.isRequestLevelMetricsEnabled();
 this.mutationMetricQueue = isMetricsEnabled ? new MutationMetricQueue()
 : NoOpMutationMetricsQueue.NO_OP_MUTATION_METRICS_QUEUE;
+this.validateLastDdlTimestamp = ValidateLastDDLTimestampUtil
+
.getValidateLastDdlTimestampEnabled(this.connection);
 if (subTask) {
 // this code path is only used while running child scans, we can't 
pass the txContext to child scans
 // as it is not thread safe, so we use the tx member variable
@@ -946,26 +951,33 @@ public class MutationState implements SQLCloseable {
 
.setTableName(table.getTableName().getString()).build().buildException(); }
 }
 long timestamp = result.getMutationTime();
-if (timestamp != QueryConstants.UNSET_TIMESTAMP) {
-serverTimeStamp = timestamp;
-if (result.wasUpdated()) {
-List columns = 
Lists.newArrayListWithExpectedSize(table.getColumns().size());
-for (Map.Entry 
rowEntry : rowKeyToColumnMap.entrySet()) {
-RowMutationState valueEntry = rowEntry.getValue();
-if (valueEntry != null) {
-Map colValues = 
valueEntry.getColumnValues();
-if (colValues != PRow.DELETE_MARKER) {
-for (PColumn column : colValues.keySet()) {
-if (!column.isDynamic()) 
columns.add(column);
+serverTimeStamp = timestamp;
+
+/* when last_ddl_timestamp validation is enabled,
+ we don't know if this table's cache result was force updated
+ during the validation, so always validate columns */
+if ((timestamp != QueryConstants.UNSET_TIMESTAMP && 
result.wasUpdated())
+|| this.validateLastDdlTimestamp) {
+List columns
+= 
Lists.newArrayListWithExpectedSize(table.getColumns().siz

(phoenix) 01/01: Merge with master

2023-10-27 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit a73360deb72853df3cc11c5cada3ce83087e3641
Merge: 0e471bfea0 0a3941f2a2
Author: Rushabh Shah 
AuthorDate: Fri Oct 27 11:00:55 2023 -0700

Merge with master

 bin/phoenix_utils.py   |   8 +-
 bin/sqlline.py |  17 +-
 .../BaseMutationBatchFailedStateMetricIT.java  | 105 +++
 ...ationBatchFailedStateMetricWithAllDeleteIT.java | 109 +++
 ...ationBatchFailedStateMetricWithAllUpsertIT.java | 107 +++
 ...atchFailedStateMetricWithDeleteAndUpsertIT.java | 118 +++
 .../phoenix/end2end/ReadOnlyViewOnReadOnlyIT.java  | 109 +++
 .../apache/phoenix/execute/PartialCommitIT.java| 108 ---
 .../phoenix/jdbc/LoggingConnectionLimiterIT.java   | 349 +
 .../phoenix/jdbc/LoggingHAConnectionLimiterIT.java | 155 +
 .../jdbc/LoggingSingleConnectionLimiterIT.java | 135 
 .../phoenix/compile/CreateTableCompiler.java   |   5 +-
 .../org/apache/phoenix/execute/MutationState.java  |  21 +-
 .../apache/phoenix/iterate/SnapshotScanner.java|   7 +-
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |  30 +-
 .../phoenix/jdbc/PhoenixMonitoredConnection.java   |   2 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  |  32 +-
 .../org/apache/phoenix/log/ActivityLogInfo.java|  62 
 .../apache/phoenix/log/BaseConnectionLimiter.java  | 136 
 .../phoenix/log/ConnectionActivityLogger.java  | 150 +
 .../org/apache/phoenix/log/ConnectionLimiter.java  |  39 +++
 .../phoenix/log/DefaultConnectionLimiter.java  |  64 
 .../phoenix/log/LoggingConnectionLimiter.java  | 181 +++
 .../phoenix/query/ConnectionQueryServices.java |   5 +
 .../phoenix/query/ConnectionQueryServicesImpl.java |  77 +++--
 .../query/DelegateConnectionQueryServices.java |   5 +
 .../org/apache/phoenix/query/QueryServices.java|   4 +
 .../apache/phoenix/query/QueryServicesOptions.java |  10 +-
 pom.xml|   5 +-
 29 files changed, 2059 insertions(+), 96 deletions(-)

diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 711b2771fb,1996577fcb..d68e981d10
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@@ -530,8 -398,10 +534,9 @@@ public class PhoenixStatement implement
  newResultSet(resultIterator, 
plan.getProjector(),
  plan.getContext());
  resultSets.add(rs);
 -setLastQueryPlan(plan);
  setLastResultSet(rs);
  setLastUpdateCount(NO_UPDATE);
+ setLastUpdateTable(tableName == null ? 
TABLE_UNKNOWN : tableName);
  setLastUpdateOperation(stmt.getOperation());
  // If transactional, this will move the read 
pointer forward
  if (connection.getAutoCommit() && !noCommit) {
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index b49432aed0,bf161a9499..e2e5ee4995
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@@ -395,10 -401,11 +402,15 @@@ public class ConnectionQueryServicesImp
  private ServerSideRPCControllerFactory serverSideRPCControllerFactory;
  private boolean localIndexUpgradeRequired;
  
+ private final boolean enableConnectionActivityLogging;
+ private final int loggingIntervalInMins;
+ 
+ private final ConnectionLimiter connectionLimiter;
+ 
 +// writes guarded by "liveRegionServersLock"
 +private volatile List liveRegionServers;
 +private final Object liveRegionServersLock = new Object();
 +
  private static interface FeatureSupported {
  boolean isSupported(ConnectionQueryServices services);
  }



(phoenix) branch PHOENIX-6883-feature updated (0e471bfea0 -> a73360deb7)

2023-10-27 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 0e471bfea0 PHOENIX-7025 : Create a new RPC to validate last ddl 
timestamp for read requests. (#1666)
 add a9fd540fef PHOENIX-7055 Small improvements and bug fixes to sqlline
 add f40921ce33 PHOENIX-7063 Track and account garbage collected phoenix 
connections (#1706)
 add c6539dca43 PHOENIX-7066 Specify -Xms for tests
 add 23607a3695 PHOENIX-7060 Compilation fails on 5.1 with Hbase 2.1 or 2.2
 add 36b5a17bee PHOENIX-7082 Upgrade Jetty to 9.4.53.v20231009
 add 4463f34d0c PHOENIX-5980 : MUTATION_BATCH_FAILED_SIZE metric is 
incorrectly updated for failing delete mutations (#1717)
 add 0a3941f2a2 PHOENIX-7070 : Child View of ReadOnly View is marked as 
updatable View (#1723)
 new a73360deb7 Merge with master

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 bin/phoenix_utils.py   |   8 +-
 bin/sqlline.py |  17 +-
 .../BaseMutationBatchFailedStateMetricIT.java  | 105 +++
 ...ationBatchFailedStateMetricWithAllDeleteIT.java | 109 +++
 ...ationBatchFailedStateMetricWithAllUpsertIT.java | 107 +++
 ...atchFailedStateMetricWithDeleteAndUpsertIT.java | 118 +++
 .../phoenix/end2end/ReadOnlyViewOnReadOnlyIT.java  | 109 +++
 .../apache/phoenix/execute/PartialCommitIT.java| 108 ---
 .../phoenix/jdbc/LoggingConnectionLimiterIT.java   | 349 +
 .../phoenix/jdbc/LoggingHAConnectionLimiterIT.java | 155 +
 .../jdbc/LoggingSingleConnectionLimiterIT.java | 135 
 .../phoenix/compile/CreateTableCompiler.java   |   5 +-
 .../org/apache/phoenix/execute/MutationState.java  |  21 +-
 .../apache/phoenix/iterate/SnapshotScanner.java|   7 +-
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |  30 +-
 .../phoenix/jdbc/PhoenixMonitoredConnection.java   |   2 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  |  32 +-
 .../org/apache/phoenix/log/ActivityLogInfo.java|  62 
 .../apache/phoenix/log/BaseConnectionLimiter.java  | 136 
 .../phoenix/log/ConnectionActivityLogger.java  | 150 +
 .../ConnectionLimiter.java}|  31 +-
 .../phoenix/log/DefaultConnectionLimiter.java  |  64 
 .../phoenix/log/LoggingConnectionLimiter.java  | 181 +++
 .../phoenix/query/ConnectionQueryServices.java |   5 +
 .../phoenix/query/ConnectionQueryServicesImpl.java |  77 +++--
 .../query/DelegateConnectionQueryServices.java |   5 +
 .../org/apache/phoenix/query/QueryServices.java|   4 +
 .../apache/phoenix/query/QueryServicesOptions.java |  10 +-
 pom.xml|   5 +-
 29 files changed, 2036 insertions(+), 111 deletions(-)
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseMutationBatchFailedStateMetricIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MutationBatchFailedStateMetricWithAllDeleteIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MutationBatchFailedStateMetricWithAllUpsertIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/end2end/MutationBatchFailedStateMetricWithDeleteAndUpsertIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/end2end/ReadOnlyViewOnReadOnlyIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/jdbc/LoggingConnectionLimiterIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/jdbc/LoggingHAConnectionLimiterIT.java
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/jdbc/LoggingSingleConnectionLimiterIT.java
 create mode 100644 
phoenix-core/src/main/java/org/apache/phoenix/log/ActivityLogInfo.java
 create mode 100644 
phoenix-core/src/main/java/org/apache/phoenix/log/BaseConnectionLimiter.java
 create mode 100644 
phoenix-core/src/main/java/org/apache/phoenix/log/ConnectionActivityLogger.java
 copy 
phoenix-core/src/main/java/org/apache/phoenix/{query/QueryServicesImpl.java => 
log/ConnectionLimiter.java} (59%)
 create mode 100644 
phoenix-core/src/main/java/org/apache/phoenix/log/DefaultConnectionLimiter.java
 create mode 100644 
phoenix-core/src/main/java/org/apache/phoenix/log/LoggingConnectionLimiter.java



[phoenix] branch PHOENIX-6883-feature updated: PHOENIX-7025 : Create a new RPC to validate last ddl timestamp for read requests. (#1666)

2023-10-16 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 0e471bfea0 PHOENIX-7025 : Create a new RPC to validate last ddl 
timestamp for read requests. (#1666)
0e471bfea0 is described below

commit 0e471bfea0d51c6e027dd06d3154df4d67fe769d
Author: palash 
AuthorDate: Mon Oct 16 13:03:45 2023 -0700

PHOENIX-7025 : Create a new RPC to validate last ddl timestamp for read 
requests. (#1666)
---
 .../apache/phoenix/cache/ServerMetadataCache.java  |   5 +
 .../coprocessor/PhoenixRegionServerEndpoint.java   |   5 +
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  | 246 --
 .../phoenix/query/ConnectionQueryServices.java |   3 +
 .../phoenix/query/ConnectionQueryServicesImpl.java |  29 ++
 .../query/ConnectionlessQueryServicesImpl.java |  10 +
 .../query/DelegateConnectionQueryServices.java |  11 +
 .../org/apache/phoenix/query/QueryServices.java|   3 +
 .../apache/phoenix/query/QueryServicesOptions.java |   1 +
 .../org/apache/phoenix/schema/MetaDataClient.java  |  43 +-
 .../phoenix/cache/ServerMetadataCacheTest.java | 543 ++---
 11 files changed, 775 insertions(+), 124 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
index 055ab1424c..15ce11e145 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/cache/ServerMetadataCache.java
@@ -179,4 +179,9 @@ public class ServerMetadataCache {
 LOGGER.info("Resetting ServerMetadataCache");
 INSTANCE = null;
 }
+
+@VisibleForTesting
+public static void setInstance(ServerMetadataCache cache) {
+INSTANCE = cache;
+}
 }
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixRegionServerEndpoint.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixRegionServerEndpoint.java
index e3448bc718..a114bea095 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixRegionServerEndpoint.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/PhoenixRegionServerEndpoint.java
@@ -73,6 +73,11 @@ public class PhoenixRegionServerEndpoint
 LOGGER.error(errorMsg,  t);
 IOException ioe = ServerUtil.createIOException(errorMsg, t);
 ProtobufUtil.setControllerException(controller, ioe);
+//If an index was dropped and a client tries to query it, we 
will validate table
+//first and encounter stale metadata, if we don't break the 
coproc will run into
+//table not found error since it will not be able to validate 
the dropped index.
+//this should be fine for views too since we will update the 
entire hierarchy.
+break;
 }
 }
 }
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index d73f1cbc15..711b2771fb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -64,15 +64,20 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
-
+import java.util.concurrent.ThreadLocalRandom;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Consistency;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
+import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.call.CallRunner;
 import org.apache.phoenix.compile.BaseMutationPlan;
@@ -102,8 +107,11 @@ import org.apache.phoenix.compile.StatementPlan;
 import org.apache.phoenix.compile.TraceQueryPlan;
 import org.apache.phoenix.compile.UpsertCompiler;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
+import org.apache.phoenix.coprocessor.PhoenixRegionServerEndpoint;
+import org.apache.phoenix.coprocessor.generated.RegionServerEndpointProtos;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.exception.StaleMetadataCacheException;
 import org.apache.phoenix.exception.UpgradeRequiredExc

[phoenix] branch PHOENIX-6883-feature updated: PHOENIX-7056 Update the LAST_DDL_TIMESTAMP of the parent table/view when we add/drop an index. (#1702)

2023-10-12 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 0cf4cb8cd9 PHOENIX-7056 Update the LAST_DDL_TIMESTAMP of the parent 
table/view when we add/drop an index. (#1702)
0cf4cb8cd9 is described below

commit 0cf4cb8cd9da98acc553860b4e92735a4e4bc91e
Author: Rushabh Shah 
AuthorDate: Thu Oct 12 09:45:54 2023 -0700

PHOENIX-7056 Update the LAST_DDL_TIMESTAMP of the parent table/view when we 
add/drop an index. (#1702)
---
 .../InvalidateServerMetadataCacheRequest.java  |  53 
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  | 121 +++
 .../phoenix/cache/ServerMetadataCacheTest.java | 133 +
 3 files changed, 258 insertions(+), 49 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/InvalidateServerMetadataCacheRequest.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/InvalidateServerMetadataCacheRequest.java
new file mode 100644
index 00..93da9ec757
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/InvalidateServerMetadataCacheRequest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.coprocessor;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.util.SchemaUtil;
+
+public class InvalidateServerMetadataCacheRequest {
+private final byte[] tenantId;
+private final byte[] schemaName;
+private final byte[] tableName;
+
+public InvalidateServerMetadataCacheRequest(byte[] tenantId, byte[] 
schemaName,
+byte[] tableName) {
+this.tenantId = tenantId;
+this.schemaName = schemaName;
+this.tableName = tableName;
+}
+
+public byte[] getTenantId() {
+return tenantId;
+}
+
+public byte[] getSchemaName() {
+return schemaName;
+}
+
+public byte[] getTableName() {
+return tableName;
+}
+
+@Override
+public String toString() {
+String fullTableName = SchemaUtil.getTableName(schemaName, tableName);
+return "tenantId = " + Bytes.toString(tenantId)
++ ", table name = " + fullTableName;
+}
+}
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 716bee220f..e69bb147ea 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -2417,6 +2417,18 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
 // table/index/views.
 
tableMetadata.add(MetaDataUtil.getLastDDLTimestampUpdate(tableKey,
 clientTimeStamp, 
EnvironmentEdgeManager.currentTimeMillis()));
+if (tableType == INDEX) {
+// Invalidate the cache on each regionserver for parent 
table/view.
+List requests = new 
ArrayList<>();
+requests.add(new 
InvalidateServerMetadataCacheRequest(tenantIdBytes,
+parentSchemaName, parentTableName));
+invalidateServerMetadataCache(requests);
+long currentTimestamp = 
EnvironmentEdgeManager.currentTimeMillis();
+// If table type is index, then update the last ddl 
timestamp of the parent
+// table or immediate parent view.
+
tableMetadata.add(MetaDataUtil.getLastDDLTimestampUpdate(parentTableKey,
+currentTimestamp, currentTimestamp));
+}
 
 //and if we're doing change detection on this table or view, 
notify the
 //external schema registry and get its schema id
@@ -2771,8 +2783,20 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM

[phoenix] branch PHOENIX-6883-feature updated (8664b60397 -> d47071ad02)

2023-10-02 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 8664b60397 PHOENIX-6968 Create 
PhoenixRegionServerEndpoint#invalidateCache method to invalidate cache. (#1691)
 add 163d11afbd PHOENIX-7057 Potential bug in 
MetadataEndpointImpl#updateIndexState.
 new d47071ad02 Merge branch 'master' into PHOENIX-6883-feature

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[phoenix] 01/01: Merge branch 'master' into PHOENIX-6883-feature

2023-10-02 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit d47071ad02d1250a558e644352288d7d910343cd
Merge: 8664b60397 163d11afbd
Author: Rushabh Shah 
AuthorDate: Mon Oct 2 15:40:58 2023 -0700

Merge branch 'master' into PHOENIX-6883-feature

 .../main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)




[phoenix] branch PHOENIX-6883-feature updated: PHOENIX-6968 Create PhoenixRegionServerEndpoint#invalidateCache method to invalidate cache. (#1691)

2023-10-02 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new 8664b60397 PHOENIX-6968 Create 
PhoenixRegionServerEndpoint#invalidateCache method to invalidate cache. (#1691)
8664b60397 is described below

commit 8664b60397acbc9b30503f7e96fc07491e5f0946
Author: Rushabh Shah 
AuthorDate: Mon Oct 2 15:15:09 2023 -0700

PHOENIX-6968 Create PhoenixRegionServerEndpoint#invalidateCache method to 
invalidate cache. (#1691)
---
 .../FailingPhoenixRegionServerEndpoint.java|  91 
 .../phoenix/end2end/InvalidateMetadataCacheIT.java | 164 +++
 .../end2end/PhoenixRegionServerEndpointIT.java |   3 -
 .../phoenix/end2end/SplitSystemCatalogIT.java  |   1 -
 .../apache/phoenix/cache/ServerMetadataCache.java  |  27 +++
 .../phoenix/coprocessor/MetaDataEndpointImpl.java  | 205 --
 .../coprocessor/PhoenixRegionServerEndpoint.java   |  30 ++-
 .../java/org/apache/phoenix/util/ServerUtil.java   |  15 ++
 .../protobuf/RegionServerEndpointService.proto |  19 +-
 .../phoenix/cache/ServerMetadataCacheTest.java | 231 +
 .../java/org/apache/phoenix/query/BaseTest.java|  18 ++
 11 files changed, 785 insertions(+), 19 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
new file mode 100644
index 00..7e40cfe76f
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FailingPhoenixRegionServerEndpoint.java
@@ -0,0 +1,91 @@
+/*
+ * 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.end2end;
+
+import com.google.protobuf.RpcCallback;
+import com.google.protobuf.RpcController;
+import org.apache.phoenix.coprocessor.PhoenixRegionServerEndpoint;
+import org.apache.phoenix.coprocessor.generated.RegionServerEndpointProtos;
+import org.apache.phoenix.protobuf.ProtobufUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS;
+import static 
org.apache.phoenix.coprocessor.MetaDataEndpointImpl.PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS_DEFAULT;
+
+public class FailingPhoenixRegionServerEndpoint extends 
PhoenixRegionServerEndpoint {
+private static final Logger LOGGER = 
LoggerFactory.getLogger(FailingPhoenixRegionServerEndpoint.class);
+
+private boolean throwException;
+private boolean shouldSleep;
+private boolean failFirstAndThenSucceed;
+private int attempt = 0;
+
+@Override
+public void invalidateServerMetadataCache(RpcController controller,
+RegionServerEndpointProtos.InvalidateServerMetadataCacheRequest 
request,
+
RpcCallback 
done) {
+long metadataCacheInvalidationTimeoutMs = conf.getLong(
+PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS,
+PHOENIX_METADATA_CACHE_INVALIDATION_TIMEOUT_MS_DEFAULT);
+
+if (throwException == true) {
+IOException ioe = new IOException("On purpose");
+ProtobufUtil.setControllerException(controller, ioe);
+return;
+} else if (shouldSleep) {
+try {
+// Sleeping for 2 seconds more than 
metadataCacheInvalidationTimeoutMs.
+Thread.sleep(metadataCacheInvalidationTimeoutMs + 2000);
+} catch (InterruptedException e) {
+LOGGER.warn("Exception while sleeping in 
FailingPhoenixRegionServerEndpoint", e);
+}
+} else if (failFirstAndThenSucceed) {
+if (attempt == 0) {
+IOException ioe = new IOException("On purpose");
+ProtobufUtil.setControllerException(controller, ioe);
+attempt++;
+}
+}
+else {
+LOGGER.info("Invalidating s

[phoenix] branch PHOENIX-6883-feature updated (20ec51edfe -> c4e5869fad)

2023-09-06 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a change to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


from 20ec51edfe Merge branch 'master' into PHOENIX-6883-feature
 add ef4989a262 PHOENIX-7029: Add support for multiple query services in 
PhoenixTestDriver (#1664)
 new c4e5869fad Merge with master

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/phoenix/end2end/CreateTableIT.java  |   2 +-
 .../phoenix/iterate/ChunkedResultIteratorIT.java   |   2 +-
 .../apache/phoenix/jdbc/PhoenixTestDriverIT.java   | 124 +
 .../query/SkipSystemTablesExistenceCheckIT.java|   7 +-
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java |   9 +-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  17 +--
 .../apache/phoenix/compile/QueryMetaDataTest.java  |   3 +-
 .../org/apache/phoenix/jdbc/PhoenixTestDriver.java |  23 +++-
 .../java/org/apache/phoenix/query/BaseTest.java|   2 +-
 9 files changed, 161 insertions(+), 28 deletions(-)
 create mode 100644 
phoenix-core/src/it/java/org/apache/phoenix/jdbc/PhoenixTestDriverIT.java



[phoenix] 01/01: Merge with master

2023-09-06 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit c4e5869fad1d6ac17b7576cee3cc61aeeadcb868
Merge: 20ec51edfe ef4989a262
Author: Rushabh Shah 
AuthorDate: Wed Sep 6 19:16:09 2023 -0700

Merge with master

 .../org/apache/phoenix/end2end/CreateTableIT.java  |   2 +-
 .../phoenix/iterate/ChunkedResultIteratorIT.java   |   2 +-
 .../apache/phoenix/jdbc/PhoenixTestDriverIT.java   | 124 +
 .../query/SkipSystemTablesExistenceCheckIT.java|   7 +-
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java |   9 +-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  17 +--
 .../apache/phoenix/compile/QueryMetaDataTest.java  |   3 +-
 .../org/apache/phoenix/jdbc/PhoenixTestDriver.java |  23 +++-
 .../java/org/apache/phoenix/query/BaseTest.java|   2 +-
 9 files changed, 161 insertions(+), 28 deletions(-)




[phoenix] branch master updated: PHOENIX-7029: Add support for multiple query services in PhoenixTestDriver (#1664)

2023-08-31 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 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 ef4989a262 PHOENIX-7029: Add support for multiple query services in 
PhoenixTestDriver (#1664)
ef4989a262 is described below

commit ef4989a26230f922fe77b2886fb11f2135909b51
Author: palash 
AuthorDate: Thu Aug 31 09:54:08 2023 -0700

PHOENIX-7029: Add support for multiple query services in PhoenixTestDriver 
(#1664)
---
 .../org/apache/phoenix/end2end/CreateTableIT.java  |   2 +-
 .../phoenix/iterate/ChunkedResultIteratorIT.java   |   2 +-
 .../apache/phoenix/jdbc/PhoenixTestDriverIT.java   | 124 +
 .../query/SkipSystemTablesExistenceCheckIT.java|   7 +-
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java |   9 +-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  17 +--
 .../apache/phoenix/compile/QueryMetaDataTest.java  |   3 +-
 .../org/apache/phoenix/jdbc/PhoenixTestDriver.java |  25 -
 .../java/org/apache/phoenix/query/BaseTest.java|   2 +-
 9 files changed, 163 insertions(+), 28 deletions(-)

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 2b30f25b81..ab37d5794f 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
@@ -1150,7 +1150,7 @@ public class CreateTableIT extends 
ParallelStatsDisabledIT {
 String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
 String fullIndexeName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
 // Check system tables priorities.
-try (Admin admin = driver.getConnectionQueryServices(null, 
null).getAdmin();
+try (Admin admin = driver.getConnectionQueryServices(getUrl(), new 
Properties()).getAdmin();
 Connection c = DriverManager.getConnection(getUrl())) {
 ResultSet rs = c.getMetaData().getTables("", 
 "\""+ PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA + 
"\"", 
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/ChunkedResultIteratorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/ChunkedResultIteratorIT.java
index 7ba7e2b78d..d9a4155722 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/ChunkedResultIteratorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/ChunkedResultIteratorIT.java
@@ -52,7 +52,7 @@ public class ChunkedResultIteratorIT
 Properties props = new Properties();
 props.setProperty(QueryServices.RENEW_LEASE_ENABLED, "false");
 props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, "2");
-Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
+Connection conn = DriverManager.getConnection(getUrl(), props);
 String tableName = generateUniqueName();
 
 conn.createStatement().execute("CREATE TABLE " + tableName
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/jdbc/PhoenixTestDriverIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/PhoenixTestDriverIT.java
new file mode 100644
index 00..9dd0d741d9
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/jdbc/PhoenixTestDriverIT.java
@@ -0,0 +1,124 @@
+/*
+ * 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.jdbc;
+
+import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConnectionQueryServices;
+import org.apache.phoenix.schema.PMetaData;
+import org.apache.phoenix.schema.PTableKey;
+import org.apache.phoenix.schema.PTableRef;
+import org.apache.phoenix.schema.TableNotFoundException;
+import org.apache.phoenix.thirdparty.com.google.common.collect.Maps;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.QueryUtil;
+impor

[phoenix] branch PHOENIX-6883-feature updated: PHOENIX-6988 Create new regionserver coprocessor named PhoenixRegionServerEndpoint in Phoenix (#1654)

2023-08-20 Thread shahrs87
This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this 
push:
 new b58ea06ea0 PHOENIX-6988 Create new regionserver coprocessor named 
PhoenixRegionServerEndpoint in Phoenix (#1654)
b58ea06ea0 is described below

commit b58ea06ea0e34f1962c4abb732ed66ccb0aa9cce
Author: Rushabh Shah 
AuthorDate: Sun Aug 20 09:27:20 2023 -0700

PHOENIX-6988 Create new regionserver coprocessor named 
PhoenixRegionServerEndpoint in Phoenix (#1654)
---
 .../end2end/PhoenixRegionServerEndpointIT.java | 195 +
 .../apache/phoenix/cache/ServerMetadataCache.java  |   9 +-
 .../coprocessor/PhoenixRegionServerEndpoint.java   |  76 
 .../coprocessor/VerifyLastDDLTimestamp.java|  71 
 .../apache/phoenix/exception/SQLExceptionCode.java |   3 +
 .../exception/StaleMetadataCacheException.java |  32 
 .../java/org/apache/phoenix/util/ServerUtil.java   |   6 +-
 .../protobuf/RegionServerEndpointService.proto |  42 +
 .../phoenix/cache/ServerMetadataCacheTest.java |   6 +-
 9 files changed, 427 insertions(+), 13 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixRegionServerEndpointIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixRegionServerEndpointIT.java
new file mode 100644
index 00..c3898a2561
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PhoenixRegionServerEndpointIT.java
@@ -0,0 +1,195 @@
+/*
+ * 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.end2end;
+
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.ipc.ServerRpcController;
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.util.ByteStringer;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.coprocessor.PhoenixRegionServerEndpoint;
+import org.apache.phoenix.coprocessor.generated.RegionServerEndpointProtos;
+import org.apache.phoenix.exception.StaleMetadataCacheException;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.thirdparty.com.google.common.collect.Maps;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.ServerUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.nio.charset.StandardCharsets;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.Properties;
+
+import static 
org.apache.hadoop.hbase.coprocessor.CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY;
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+@Category({NeedsOwnMiniClusterTest.class })
+public class PhoenixRegionServerEndpointIT extends BaseTest {
+@BeforeClass
+public static synchronized void doSetup() throws Exception {
+Map props = Maps.newHashMapWithExpectedSize(1);
+props.put(REGIONSERVER_COPROCESSOR_CONF_KEY,
+PhoenixRegionServerEndpoint.class.getName());
+setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+}
+
+// Tests that PhoenixRegionServerEndpoint validates the last ddl timestamp 
for base table.
+@Test
+public void testValidateLastDDLTimestampNoException() throws SQLException {
+HRegionServer regionServer = 
utility.getMiniHBaseCluster().getRegionServer(0);
+PhoenixRegionServerEndpoint coprocessor = 
getPhoenixRegionServerEndpoint(regionServer);
+assertNotNull(coprocessor);
+ServerRpcController controller = new ServerRpcController();
+String tableNameStr = generateUniqueName();
+Properties props = new Properties();
+