ritegarg commented on code in PR #2075:
URL: https://github.com/apache/phoenix/pull/2075#discussion_r2002141309
##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java:
##########
@@ -1055,4 +1061,21 @@ public void
preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean ab
protected boolean isRegionObserverFor(Scan scan) {
return
scan.getAttribute(BaseScannerRegionObserverConstants.UNGROUPED_AGG) != null;
}
+
+ @Override
+ public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
+ MiniBatchOperationInProgress<Mutation>
miniBatchOp) throws IOException {
+ Configuration conf = c.getEnvironment().getConfiguration();
+ if(conf.getBoolean(CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED,
DEFAULT_CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED)) {
+ try {
+ ServerMetadataCache serverMetadataCache =
ServerMetadataCacheImpl.getInstance(c.getEnvironment().getConfiguration());
+ if
(!serverMetadataCache.getClusterRoleRecordsForClusterRole(ClusterRoleRecord.ClusterRole.ACTIVE_TO_STANDBY).isEmpty())
{
+ throw new IOException("Blocking Mutation as Some CRRs are
in ACTIVE_TO_STANDBY state " +
+ "and CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED is
true");
+ }
+ } catch (Exception e) {
Review Comment:
Handle IOException
##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java:
##########
@@ -1055,4 +1061,21 @@ public void
preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean ab
protected boolean isRegionObserverFor(Scan scan) {
return
scan.getAttribute(BaseScannerRegionObserverConstants.UNGROUPED_AGG) != null;
}
+
+ @Override
+ public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
+ MiniBatchOperationInProgress<Mutation>
miniBatchOp) throws IOException {
+ Configuration conf = c.getEnvironment().getConfiguration();
+ if(conf.getBoolean(CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED,
DEFAULT_CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED)) {
+ try {
+ ServerMetadataCache serverMetadataCache =
ServerMetadataCacheImpl.getInstance(c.getEnvironment().getConfiguration());
+ if
(!serverMetadataCache.getClusterRoleRecordsForClusterRole(ClusterRoleRecord.ClusterRole.ACTIVE_TO_STANDBY).isEmpty())
{
+ throw new IOException("Blocking Mutation as Some CRRs are
in ACTIVE_TO_STANDBY state " +
+ "and CLUSTER_ROLE_BASED_MUTATION_BLOCK_ENABLED is
true");
+ }
+ } catch (Exception e) {
Review Comment:
Handle IOException
--
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]