You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "gyang94 (via GitHub)" <gi...@apache.org> on 2026/09/02 02:52:21 UTC

Re: [PR] [client] Clean up batches when synchronous sends fail [fluss]

gyang94 commented on code in PR #4028:
URL: https://github.com/apache/fluss/pull/4028#discussion_r3910285893


##########
fluss-client/src/main/java/org/apache/fluss/client/write/Sender.java:
##########
@@ -393,20 +393,28 @@ private void sendWriteRequest(int destination, short acks, List<ReadyWriteBatch>
         } else {
             writeBatchByTable.forEach(
                     (tableId, writeBatches) -> {
-                        if (isLogBatches(writeBatches)) {
-                            sendProduceLogRequestAndHandleResponse(
-                                    gateway,
-                                    makeProduceLogRequest(
-                                            tableId, acks, maxRequestTimeoutMs, writeBatches),
-                                    tableId,
-                                    writeBatches);
-                        } else {
-                            sendPutKvRequestAndHandleResponse(
-                                    gateway,
-                                    makePutKvRequest(
-                                            tableId, acks, maxRequestTimeoutMs, writeBatches),
-                                    tableId,
-                                    writeBatches);
+                        try {
+                            if (isLogBatches(writeBatches)) {
+                                sendProduceLogRequestAndHandleResponse(
+                                        gateway,
+                                        makeProduceLogRequest(
+                                                tableId, acks, maxRequestTimeoutMs, writeBatches),
+                                        tableId,
+                                        writeBatches);
+                            } else {
+                                sendPutKvRequestAndHandleResponse(

Review Comment:
   that's right. updated.



##########
fluss-client/src/main/java/org/apache/fluss/client/write/Sender.java:
##########
@@ -393,20 +393,28 @@ private void sendWriteRequest(int destination, short acks, List<ReadyWriteBatch>
         } else {
             writeBatchByTable.forEach(
                     (tableId, writeBatches) -> {
-                        if (isLogBatches(writeBatches)) {
-                            sendProduceLogRequestAndHandleResponse(
-                                    gateway,
-                                    makeProduceLogRequest(
-                                            tableId, acks, maxRequestTimeoutMs, writeBatches),
-                                    tableId,
-                                    writeBatches);
-                        } else {
-                            sendPutKvRequestAndHandleResponse(
-                                    gateway,
-                                    makePutKvRequest(
-                                            tableId, acks, maxRequestTimeoutMs, writeBatches),
-                                    tableId,
-                                    writeBatches);
+                        try {
+                            if (isLogBatches(writeBatches)) {
+                                sendProduceLogRequestAndHandleResponse(
+                                        gateway,
+                                        makeProduceLogRequest(
+                                                tableId, acks, maxRequestTimeoutMs, writeBatches),
+                                        tableId,
+                                        writeBatches);
+                            } else {
+                                sendPutKvRequestAndHandleResponse(
+                                        gateway,
+                                        makePutKvRequest(
+                                                tableId, acks, maxRequestTimeoutMs, writeBatches),
+                                        tableId,
+                                        writeBatches);
+                            }
+                        } catch (Throwable t) {
+                            // A gateway may throw before returning a future, for example when RPC
+                            // encoding runs out of direct memory. No callback is registered in that
+                            // case, so complete the drained batches to release their buffer pages
+                            // and in-flight state.
+                            handleWriteRequestException(t, writeBatches);

Review Comment:
   updated.



-- 
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: issues-unsubscribe@fluss.apache.org

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