-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INLONG-10463][SDK] Optimization of ultra-long field processing in InlongSDK #11119
base: master
Are you sure you want to change the base?
Conversation
@@ -218,6 +226,9 @@ public SendResult sendMessage(byte[] body, String groupId, String streamId, long | |||
*/ | |||
public SendResult sendMessage(byte[] body, String groupId, String streamId, long dt, String msgUUID, | |||
long timeout, TimeUnit timeUnit, boolean isProxySend) { | |||
if (enableDataTruncation) { | |||
body = truncateData(body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a truncation is made, how can we ensure that the transmitted data is the user-reported data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, do you mean to add data verification function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data content reported by the user cannot be modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to successfully parse incomplete data?
...ng-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/DefaultMessageSender.java
Outdated
Show resolved
Hide resolved
In my opinion, if the transmitted content cannot be parsed after truncation, then the user should not configure the function to allow truncation |
431ee81
Now when the configuration does not allow truncation, if the body exceeds the limit, it will be rejected directly. Specifically for a body of type |
In any case, the SDK should not set truncation, otherwise this operation will modify the data content reported by the business and cause errors |
If it cannot be truncated, is this issue unnecessary? |
It cannot be truncated, this is the premise. How to check whether it is too long requires analysis to see how to modify it appropriately. |
I have fixed it, now if the data is too long, it will directly return |
Fixes #10463
Motivation
Due to dataproxy limitations, a CONNECTION_BREAK error will occur when sending too much data through the SDK. So this PR solves the following problems:
Modifications
MAX_MESSAGE_LENGTH
constant ininlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/ConfigConstants.java
.DataTruncationUtil
to implement data truncation.enableDataTruncation
property toDefaultMessageSender.java
to determine whether to enable the automatic truncation function. And added a configuration function for users to call.sendMessage
andasyncSendMessage
interfaces.Now you can open the automatic truncation function by
sender.enableDataTruncation(true);
And you can also change the default
MAX_MESSAGE_LENGTH
constant atConfigConstants.java
fileVerifying 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:)
Documentation