You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by pi...@apache.org on 2018/02/26 16:31:17 UTC
[geode] branch develop updated: GEODE-4638: Standardize hanlding of
region-not-found errors. (#1492)
This is an automated email from the ASF dual-hosted git repository.
pivotalsarge pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new de2cb20 GEODE-4638: Standardize hanlding of region-not-found errors. (#1492)
de2cb20 is described below
commit de2cb20632fb8200a10238bfff206bb70bb97433
Author: Michael "Sarge" Dodge <md...@pivotal.io>
AuthorDate: Mon Feb 26 08:31:14 2018 -0800
GEODE-4638: Standardize hanlding of region-not-found errors. (#1492)
---
.../ExecuteFunctionOnRegionRequestOperationHandler.java | 8 +++++++-
.../protobuf/v1/operations/GetAllRequestOperationHandler.java | 5 +++--
.../protobuf/v1/operations/GetRequestOperationHandler.java | 5 +++--
.../protobuf/v1/operations/PutAllRequestOperationHandler.java | 4 ++--
.../protobuf/v1/operations/PutRequestOperationHandler.java | 4 ++--
.../protobuf/v1/operations/RemoveRequestOperationHandler.java | 5 +++--
6 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/ExecuteFunctionOnRegionRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/ExecuteFunctionOnRegionRequestOperationHandler.java
index 7c43f5d..4fde3ff 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/ExecuteFunctionOnRegionRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/ExecuteFunctionOnRegionRequestOperationHandler.java
@@ -18,10 +18,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.logging.log4j.Logger;
+
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.internal.exception.InvalidExecutionContextException;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.protocol.protobuf.v1.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.v1.Failure;
import org.apache.geode.internal.protocol.protobuf.v1.FunctionAPI.ExecuteFunctionOnRegionRequest;
@@ -35,6 +38,7 @@ import org.apache.geode.internal.protocol.protobuf.v1.serialization.exception.En
public class ExecuteFunctionOnRegionRequestOperationHandler extends
AbstractFunctionRequestOperationHandler<ExecuteFunctionOnRegionRequest, ExecuteFunctionOnRegionResponse> {
+ private static final Logger logger = LogService.getLogger();
protected Set<Object> parseFilter(ProtobufSerializationService serializationService,
ExecuteFunctionOnRegionRequest request) throws DecodingException {
@@ -62,7 +66,9 @@ public class ExecuteFunctionOnRegionRequestOperationHandler extends
MessageExecutionContext executionContext) throws InvalidExecutionContextException {
final Region<Object, Object> region = executionContext.getCache().getRegion(regionName);
if (region == null) {
- return Failure.of(BasicTypes.ErrorCode.INVALID_REQUEST,
+ logger.error("Received execute-function-on-region request for nonexistent region: {}",
+ regionName);
+ return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
"Region \"" + regionName + "\" not found");
}
return region;
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAllRequestOperationHandler.java
index a672842..9bd64ff 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAllRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetAllRequestOperationHandler.java
@@ -47,8 +47,9 @@ public class GetAllRequestOperationHandler
String regionName = request.getRegionName();
Region region = messageExecutionContext.getCache().getRegion(regionName);
if (region == null) {
- logger.error("Received GetAll request for non-existing region {}", regionName);
- return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR, "Region not found");
+ logger.error("Received get-all request for nonexistent region: {}", regionName);
+ return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
+ "Region \"" + regionName + "\" not found");
}
long startTime = messageExecutionContext.getStatistics().startOperation();
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetRequestOperationHandler.java
index 76f85a0..4b03922 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/GetRequestOperationHandler.java
@@ -43,8 +43,9 @@ public class GetRequestOperationHandler
String regionName = request.getRegionName();
Region region = messageExecutionContext.getCache().getRegion(regionName);
if (region == null) {
- logger.error("Received Get request for non-existing region {}", regionName);
- return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR, "Region not found");
+ logger.error("Received get request for nonexistent region: {}", regionName);
+ return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
+ "Region \"" + regionName + "\" not found");
}
long startOperationTime = messageExecutionContext.getStatistics().startOperation();
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutAllRequestOperationHandler.java
index e331af5..8a6027d 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutAllRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutAllRequestOperationHandler.java
@@ -47,9 +47,9 @@ public class PutAllRequestOperationHandler
Region region = messageExecutionContext.getCache().getRegion(regionName);
if (region == null) {
- logger.error("Received PutAll request for non-existing region {}", regionName);
+ logger.error("Received put-all request for nonexistent region: {}", regionName);
return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
- "Region passed does not exist: " + regionName);
+ "Region \"" + regionName + "\" not found");
}
long startTime = messageExecutionContext.getStatistics().startOperation();
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutRequestOperationHandler.java
index a39fab8..b56e3cc 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/PutRequestOperationHandler.java
@@ -42,9 +42,9 @@ public class PutRequestOperationHandler
String regionName = request.getRegionName();
Region region = messageExecutionContext.getCache().getRegion(regionName);
if (region == null) {
- logger.warn("Received Put request for non-existing region: {}", regionName);
+ logger.error("Received put request for nonexistent region: {}", regionName);
return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
- "Region passed by client did not exist: " + regionName);
+ "Region \"" + regionName + "\" not found");
}
long startTime = messageExecutionContext.getStatistics().startOperation();
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/RemoveRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/RemoveRequestOperationHandler.java
index dbc146d..a852a76 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/RemoveRequestOperationHandler.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/operations/RemoveRequestOperationHandler.java
@@ -43,8 +43,9 @@ public class RemoveRequestOperationHandler
String regionName = request.getRegionName();
Region region = messageExecutionContext.getCache().getRegion(regionName);
if (region == null) {
- logger.error("Received Remove request for non-existing region {}", regionName);
- return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR, "Region not found");
+ logger.error("Received remove request for nonexistent region: {}", regionName);
+ return Failure.of(BasicTypes.ErrorCode.SERVER_ERROR,
+ "Region \"" + regionName + "\" not found");
}
long startTime = messageExecutionContext.getStatistics().startOperation();
--
To stop receiving notification emails like this one, please contact
pivotalsarge@apache.org.