You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "liaosunny123 (via GitHub)" <gi...@apache.org> on 2023/08/11 03:37:19 UTC

[GitHub] [inlong] liaosunny123 opened a new pull request, #8702: [INLONG-8701][TubeMQ] Fix Master dashboard respond always true when some operation complete

liaosunny123 opened a new pull request, #8702:
URL: https://github.com/apache/inlong/pull/8702

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - Title Example: [INLONG-XYZ][Component] Title of the pull request
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
   
   - Fixes #8701 
   
   ### Motivation
   
   Fix Master dashboard respond always true when some operation complete
   
   ### Modifications
   
   - Add dealing with error logic
   - refactor some unnecessary func ret
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] gosonzhang commented on a diff in pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations

Posted by "gosonzhang (via GitHub)" <gi...@apache.org>.
gosonzhang commented on code in PR #8702:
URL: https://github.com/apache/inlong/pull/8702#discussion_r1292910915


##########
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebBrokerConfHandler.java:
##########
@@ -1045,19 +1045,27 @@ private boolean getBrokerJsonSetInfo(HttpServletRequest req, boolean isAddOp,
     private StringBuilder buildRetInfo(List<BrokerProcessResult> retInfo,
             StringBuilder sBuffer) {
         int totalCnt = 0;
-        WebParameterUtils.buildSuccessWithDataRetBegin(sBuffer);
+        StringBuilder actionMiddleProxy = new StringBuilder();

Review Comment:
   Can this be done with minimal variable creation?



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] liaosunny123 closed pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations

Posted by "liaosunny123 (via GitHub)" <gi...@apache.org>.
liaosunny123 closed pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations
URL: https://github.com/apache/inlong/pull/8702


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] liaosunny123 commented on pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations

Posted by "liaosunny123 (via GitHub)" <gi...@apache.org>.
liaosunny123 commented on PR #8702:
URL: https://github.com/apache/inlong/pull/8702#issuecomment-1676975679

   Transfer to #8717


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] gosonzhang commented on a diff in pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations

Posted by "gosonzhang (via GitHub)" <gi...@apache.org>.
gosonzhang commented on code in PR #8702:
URL: https://github.com/apache/inlong/pull/8702#discussion_r1293081221


##########
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebBrokerConfHandler.java:
##########
@@ -1055,9 +1057,14 @@ private StringBuilder buildRetInfo(List<BrokerProcessResult> retInfo,
                     .append("\",\"success\":").append(entry.isSuccess())
                     .append(",\"errCode\":").append(entry.getErrCode())
                     .append(",\"errInfo\":\"").append(entry.getErrMsg()).append("\"}");
+            if (isSucceed && !entry.isSuccess()) {
+                isSucceed = false;
+                errInfo = entry.getErrMsg();
+                errCode = entry.getErrCode();
+            }
         }
-        WebParameterUtils.buildSuccessWithDataRetEnd(sBuffer, totalCnt);
-        return sBuffer;
+        return WebParameterUtils.buildSuccessOrFailRet(sBuffer, totalCnt, isSucceed, errCode,

Review Comment:
   TubeMQ's http api access is relatively frequent. Based on this, it prioritizes performance loss over readability.
   
   This PR modification, the initial submitted changes are more readable, but it introduces additional resource consumption, it is best to achieve better readability with the least performance loss.
   
   @liaosunny123 



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] gosonzhang commented on a diff in pull request #8702: [INLONG-8701][TubeMQ] Fix the master dashboard response always true for some operations

Posted by "gosonzhang (via GitHub)" <gi...@apache.org>.
gosonzhang commented on code in PR #8702:
URL: https://github.com/apache/inlong/pull/8702#discussion_r1293081221


##########
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebBrokerConfHandler.java:
##########
@@ -1055,9 +1057,14 @@ private StringBuilder buildRetInfo(List<BrokerProcessResult> retInfo,
                     .append("\",\"success\":").append(entry.isSuccess())
                     .append(",\"errCode\":").append(entry.getErrCode())
                     .append(",\"errInfo\":\"").append(entry.getErrMsg()).append("\"}");
+            if (isSucceed && !entry.isSuccess()) {
+                isSucceed = false;
+                errInfo = entry.getErrMsg();
+                errCode = entry.getErrCode();
+            }
         }
-        WebParameterUtils.buildSuccessWithDataRetEnd(sBuffer, totalCnt);
-        return sBuffer;
+        return WebParameterUtils.buildSuccessOrFailRet(sBuffer, totalCnt, isSucceed, errCode,

Review Comment:
   This place introduces bugs, and after this modification, the code will be more error-prone to maintain
   
   TubeMQ's http api access is relatively frequent. Based on this, it prioritizes performance loss over readability.
   
   This PR modification, the initial submitted changes are more readable, but it introduces additional resource consumption, it is best to achieve better readability with the least performance loss.
   
   @liaosunny123 



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org