(phoenix) branch PHOENIX-7001-feature updated: Add an extra delete mutation for CDC

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

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


The following commit(s) were added to refs/heads/PHOENIX-7001-feature by this 
push:
 new da6ddad04e Add an extra delete mutation for CDC
da6ddad04e is described below

commit da6ddad04e253a27ddc898b3a189f8f6934ad93e
Author: Kadir Ozdemir 
AuthorDate: Mon Jan 22 11:35:24 2024 +0530

Add an extra delete mutation for CDC
---
 .../phoenix/hbase/index/IndexRegionObserver.java   | 25 --
 .../org/apache/phoenix/index/IndexMaintainer.java  | 12 +++
 .../src/main/protobuf/ServerCachingService.proto   |  1 +
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
index 593fdbe0d0..702f4da82a 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
@@ -899,6 +899,13 @@ public class IndexRegionObserver implements 
RegionCoprocessor, RegionObserver {
 }
 }
 }
+private Mutation getDeleteIndexMutation(Put dataRowState, IndexMaintainer 
indexMaintainer,
+long ts, ImmutableBytesPtr rowKeyPtr) {
+ValueGetter cdcDataRowVG = new 
IndexUtil.SimpleValueGetter(dataRowState);
+byte[] indexRowKey = indexMaintainer.buildRowKey(cdcDataRowVG, 
rowKeyPtr, null, null, ts);
+return indexMaintainer.buildRowDeleteMutation(indexRowKey,
+IndexMaintainer.DeleteType.ALL_VERSIONS, ts);
+}
 
 /**
  * Generate the index update for a data row from the mutation that are 
obtained by merging the previous data row
@@ -960,13 +967,19 @@ public class IndexRegionObserver implements 
RegionCoprocessor, RegionObserver {
 }
 } else if (currentDataRowState != null
 && 
indexMaintainer.shouldPrepareIndexMutations(currentDataRowState)) {
-ValueGetter currentDataRowVG = new 
IndexUtil.SimpleValueGetter(currentDataRowState);
-byte[] indexRowKeyForCurrentDataRow = 
indexMaintainer.buildRowKey(currentDataRowVG, rowKeyPtr,
-null, null, ts);
-Mutation del = 
indexMaintainer.buildRowDeleteMutation(indexRowKeyForCurrentDataRow,
-IndexMaintainer.DeleteType.ALL_VERSIONS, ts);
 context.indexUpdates.put(hTableInterfaceReference,
-new Pair(del, rowKeyPtr.get()));
+new Pair(getDeleteIndexMutation(currentDataRowState,
+indexMaintainer, ts, rowKeyPtr), 
rowKeyPtr.get()));
+if (indexMaintainer.isCDCIndex()) {
+Put cdcDataRowState = new 
Put(currentDataRowState.getRow());
+
cdcDataRowState.addColumn(indexMaintainer.getDataEmptyKeyValueCF(),
+
indexMaintainer.getEmptyKeyValueQualifierForDataTable(), ts,
+ByteUtil.EMPTY_BYTE_ARRAY);
+context.indexUpdates.put(hTableInterfaceReference,
+new Pair(getDeleteIndexMutation(cdcDataRowState,
+indexMaintainer, ts, rowKeyPtr), 
rowKeyPtr.get()));
+
+}
 }
 }
 }
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java 
b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index c943cb442e..002857b213 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -116,6 +116,7 @@ import 
org.apache.phoenix.thirdparty.com.google.common.collect.Maps;
 import org.apache.phoenix.thirdparty.com.google.common.collect.Sets;
 import org.apache.phoenix.util.BitSet;
 import org.apache.phoenix.util.ByteUtil;
+import org.apache.phoenix.util.CDCUtil;
 import org.apache.phoenix.util.EncodedColumnsUtil;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.ExpressionUtil;
@@ -437,6 +438,7 @@ public class IndexMaintainer implements Writable, 
Iterable {
 private boolean isUncovered;
 private Expression indexWhere;
 private Set indexWhereColumns;
+private boolean isCDCIndex;
 
 protected IndexMaintainer(RowKeySchema dataRowKeySchema, boolean 
isDataTableSalted) {
 this.dataRowKeySchema = dataRowKeySchema;
@@ -674,6 +676,7 @@ public class IndexMaintainer implements Writable, 
Iterable {
 this.indexWhere = index.getIndexWhereExpression(connection);

(phoenix-omid) branch master updated: OMID-272 Support JDK17

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

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix-omid.git


The following commit(s) were added to refs/heads/master by this push:
 new edc79fc3 OMID-272 Support JDK17
edc79fc3 is described below

commit edc79fc3038d326c811ffe342bafccd9245c4ef7
Author: Istvan Toth 
AuthorDate: Fri Jan 19 07:55:12 2024 +0100

OMID-272 Support JDK17
---
 pom.xml| 55 +++
 tso-server/bin/omid.sh | 88 ++
 2 files changed, 143 insertions(+)

diff --git a/pom.xml b/pom.xml
index 89d00561..f9dc9e60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -209,6 +209,37 @@
 hbase-client
 ${hbase.version}
 -Xdoclint:none
+
+
+2200m
+1000m
+-enableassertions -Xmx${surefire.Xmx}
+  -Xms${surefire.Xms} -Djava.security.egd=file:/dev/./urandom 
-Djava.net.preferIPv4Stack=true
+  -Djava.awt.headless=true 
-Djdk.net.URLClassPath.disableClassPathURLCheck=true
+  -Dorg.apache.hbase.thirdparty.io.netty.leakDetection.level=advanced
+  -Dio.netty.eventLoopThreads=3 
-Dio.opentelemetry.context.enableStrictContext=true
+
+
-Dorg.apache.hbase.thirdparty.io.netty.tryReflectionSetAccessible=true
+  --add-modules jdk.unsupported
+  --add-opens java.base/java.io=ALL-UNNAMED
+  --add-opens java.base/java.nio=ALL-UNNAMED
+  --add-opens java.base/sun.nio.ch=ALL-UNNAMED
+  --add-opens java.base/java.lang=ALL-UNNAMED
+  --add-opens java.base/jdk.internal.ref=ALL-UNNAMED
+  --add-opens java.base/java.lang.reflect=ALL-UNNAMED
+  --add-opens java.base/java.util=ALL-UNNAMED
+  --add-opens java.base/java.util.concurrent=ALL-UNNAMED
+  --add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+  --add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED
+  --add-exports java.base/sun.net.dns=ALL-UNNAMED
+  --add-exports 
java.base/sun.net.util=ALL-UNNAMED
+
+
+--add-opens 
java.base/jdk.internal.util.random=ALL-UNNAMED
+${omid-surefire.argLine}
 
 
 
@@ -481,6 +512,30 @@
 
 
 
+
+build-with-jdk11
+
+[11,)
+
+
+
${releaseTarget}
+
+${omid-surefire.jdk11.flags}
+${omid-surefire.argLine}
+
+
+
+
+build-with-jdk17
+
+[17,)
+
+
+${omid-surefire.jdk11.flags}
+${omid-surefire.jdk17.flags}
+${omid-surefire.argLine}
+
+
 
 
 site-deploy
diff --git a/tso-server/bin/omid.sh b/tso-server/bin/omid.sh
index fa5afac5..01e918bb 100755
--- a/tso-server/bin/omid.sh
+++ b/tso-server/bin/omid.sh
@@ -39,6 +39,92 @@ for j in ../lib/*.jar; do
 CLASSPATH=$CLASSPATH:$j
 done
 
+#JVM detection and list of JDK11 options copied from HBase with slight 
modifications
+
+function read_java_version() {
+  # Avoid calling java repeatedly
+  if [ -z "$read_java_version_cached" ]; then
+properties="$("${JAVA_HOME}/bin/java" -XshowSettings:properties -version 
2>&1)"
+read_java_version_cached="$(echo "${properties}" | "${GREP}" 
java.runtime.version | head -1 | "${SED}" -e 's/.* = \([^ ]*\)/\1/')"
+  fi
+  echo "$read_java_version_cached"
+}
+
+# Inspect the system properties exposed by this JVM to identify the major
+# version number. Normalize on the popular version number, thus consider JDK
+# 1.8 as version "8".
+function parse_java_major_version() {
+  complete_version=$1
+  # split off suffix version info like '-b10' or '+10' or '_10'
+  # careful to not use GNU Sed extensions
+  version="$(echo "$complete_version" | "${SED}" -e 's/+/_/g' -e 's/-/_/g' | 
cut -d'_' -f1)"
+  case "$version" in
+  1.*)
+echo "$version" | cut -d'.' -f2
+;;
+  *)
+echo "$version" | cut -d'.' -f1
+;;
+  esac
+}
+
+add_jdk11_jvm_flags() {
+  # Keep in sync with omid-surefire.jdk11.flags in the root pom.xml
+  OMID_OPTS="$OMID_OPTS 
-Dorg.apache.hbase.thirdparty.io.netty.tryReflectionSetAccessible=true 
--add-modules jdk.unsupported --add-opens java.base/java.io=ALL-UNNAMED 
--add-opens java.base/java.nio=ALL-UNNAMED --add-opens 
java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED 
--add-opens java.base/jdk.internal.ref=ALL-UNNAMED --add-opens 
java.base/java.lang.reflect=ALL-UNNAMED --add-opens 
java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL 
[...]
+}
+
+setup_jdk_options()  {
+
+  # We don't actually add any JARs, but this is copied from HBase which does
+  addJDK11Jars=false
+
+  if [ "${OMID_JDK11}" != "" ]; then
+# Use the passed Environment Variable