sadanand48 commented on code in PR #9417:
URL: https://github.com/apache/ozone/pull/9417#discussion_r2601092828
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -138,6 +144,30 @@ public OMResponse processRequest(OMRequest request) throws
ServiceException {
return response;
}
+ /**
+ * Logs a warning if the OMResponse size exceeds half of the IPC maximum
+ * response size threshold.
+ *
+ * @param response The OMResponse to check
+ */
+ @VisibleForTesting
+ public void logLargeResponseIfNeeded(OMResponse response) {
+ try {
+ Configuration conf = ozoneManager.getConfiguration();
+ long maxSize = conf.getLong(MAXIMUM_RESPONSE_LENGTH,
MAXIMUM_RESPONSE_LENGTH_DEFAULT);
+ long warnThreshold = maxSize / 2;
Review Comment:
Done.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -138,6 +144,30 @@ public OMResponse processRequest(OMRequest request) throws
ServiceException {
return response;
}
+ /**
+ * Logs a warning if the OMResponse size exceeds half of the IPC maximum
+ * response size threshold.
+ *
+ * @param response The OMResponse to check
+ */
+ @VisibleForTesting
+ public void logLargeResponseIfNeeded(OMResponse response) {
+ try {
+ Configuration conf = ozoneManager.getConfiguration();
Review Comment:
Done.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java:
##########
@@ -138,6 +144,30 @@ public OMResponse processRequest(OMRequest request) throws
ServiceException {
return response;
}
+ /**
+ * Logs a warning if the OMResponse size exceeds half of the IPC maximum
+ * response size threshold.
+ *
+ * @param response The OMResponse to check
+ */
+ @VisibleForTesting
+ public void logLargeResponseIfNeeded(OMResponse response) {
+ try {
+ Configuration conf = ozoneManager.getConfiguration();
+ long maxSize = conf.getLong(MAXIMUM_RESPONSE_LENGTH,
MAXIMUM_RESPONSE_LENGTH_DEFAULT);
+ long warnThreshold = maxSize / 2;
+
+ long respSize = response.getSerializedSize();
+ if (respSize > warnThreshold) {
+ LOG.warn("Large OMResponse detected: cmd={} size={}B threshold={}B ",
+ response.getCmdType(), respSize, warnThreshold);
+ }
+ } catch (Exception e) {
+ // Don't let logging errors disrupt response generation
+ LOG.debug("Failed to log response size", e);
Review Comment:
Done.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]