[
https://issues.apache.org/jira/browse/PHOENIX-6511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17380387#comment-17380387
]
ASF GitHub Bot commented on PHOENIX-6511:
-----------------------------------------
virajjasani commented on a change in pull request #1266:
URL: https://github.com/apache/phoenix/pull/1266#discussion_r669350207
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverSplitFailureIT.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UngroupedAggregateRegionObserverSplitFailureIT extends
BaseUniqueNamesOwnClusterIT {
+ private static HBaseTestingUtility hbaseTestUtil;
+ private static String zkQuorum;
+ private static String url;
+
+ @BeforeClass
+ public static synchronized void doSetup() throws Exception {
+ Configuration conf = HBaseConfiguration.create();
+ hbaseTestUtil = new HBaseTestingUtility(conf);
+ setUpConfigForMiniCluster(conf);
+ hbaseTestUtil.startMiniCluster();
+ // establish url and quorum. Need to use PhoenixDriver and not
PhoenixTestDriver
+ zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
+ url = PhoenixRuntime.JDBC_PROTOCOL +
PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum;
+ DriverManager.registerDriver(PhoenixDriver.INSTANCE);
+ }
+
+ @AfterClass
+ public static synchronized void tearDownAfterClass() throws Exception {
+ if (hbaseTestUtil != null) {
+ hbaseTestUtil.shutdownMiniCluster();
+ }
+ }
+
+ @Test
+ public void testDeleteAfterSplitFailure() throws SQLException, IOException
{
+ String tableName = generateUniqueName();
+ int numRecords = 100;
+ try (Connection conn = DriverManager.getConnection(url)) {
+ conn.createStatement().execute(
+ "CREATE TABLE " + tableName + " (PK1 INTEGER NOT NULL PRIMARY
KEY, KV1 VARCHAR)");
+ int i = 0;
+ String upsert = "UPSERT INTO " + tableName + " VALUES (?, ?)";
+ PreparedStatement stmt = conn.prepareStatement(upsert);
+ while (i < numRecords) {
+ stmt.setInt(1, i);
+ stmt.setString(2, UUID.randomUUID().toString());
+ stmt.executeUpdate();
+ i++;
+ }
+ conn.commit();
+
+ List<HRegion> regions =
+
hbaseTestUtil.getMiniHBaseCluster().getRegions(TableName.valueOf(tableName));
+ for (HRegion region : regions) {
+ UngroupedAggregateRegionObserver obs =
+ (UngroupedAggregateRegionObserver)
region.getCoprocessorHost()
+
.findCoprocessor(UngroupedAggregateRegionObserver.class.getName());
+ ObserverContext ctx = new ObserverContext<>(null);
+
ctx.prepare(region.getCoprocessorHost().findCoprocessorEnvironment(
+ UngroupedAggregateRegionObserver.class.getName()));
Review comment:
nit: Since `preSplit` and `preRollBackSplit` requires
`ObserverContext<RegionCoprocessorEnvironment>` specifically, we can define
`ObserverContext` accordingly here:
```
ObserverContext<RegionCoprocessorEnvironment> ctx = new
ObserverContext<>(null);
ctx.prepare((RegionCoprocessorEnvironment)
region.getCoprocessorHost().findCoprocessorEnvironment(
UngroupedAggregateRegionObserver.class.getName()));
```
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedAggregateRegionObserverSplitFailureIT.java
##########
@@ -0,0 +1,107 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.coprocessor.ObserverContext;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class UngroupedAggregateRegionObserverSplitFailureIT extends
BaseUniqueNamesOwnClusterIT {
+ private static HBaseTestingUtility hbaseTestUtil;
+ private static String zkQuorum;
+ private static String url;
+
+ @BeforeClass
+ public static synchronized void doSetup() throws Exception {
+ Configuration conf = HBaseConfiguration.create();
+ hbaseTestUtil = new HBaseTestingUtility(conf);
+ setUpConfigForMiniCluster(conf);
+ hbaseTestUtil.startMiniCluster();
+ // establish url and quorum. Need to use PhoenixDriver and not
PhoenixTestDriver
+ zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
Review comment:
nit: could be a local variable than a class level field
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Deletes fail in case of failed region split
> -------------------------------------------
>
> Key: PHOENIX-6511
> URL: https://issues.apache.org/jira/browse/PHOENIX-6511
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.16.1
> Reporter: Abhishek Singh Chouhan
> Assignee: Abhishek Singh Chouhan
> Priority: Critical
> Fix For: 4.17.0
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)