You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2026/10/02 12:39:21 UTC

(ignite) branch master updated: IGNITE-29094 Remove useless byte array creation during thin jdbc request (#13634)

This is an automated email from the ASF dual-hosted git repository.

nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 31bb0ef767d IGNITE-29094 Remove useless byte array creation during thin jdbc request (#13634)
31bb0ef767d is described below

commit 31bb0ef767dc27400f8cd130f124306938ed478d
Author: Nikolay <ni...@apache.org>
AuthorDate: Fri Oct 2 15:39:11 2026 +0300

    IGNITE-29094 Remove useless byte array creation during thin jdbc request (#13634)
---
 .../apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
index 0a7fc4f2a15..53146e2fb84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.binary.BinaryReaderEx;
 import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.binary.BinaryWriterEx;
+import org.apache.ignite.internal.binary.streams.BinaryOutputStream;
 import org.apache.ignite.internal.binary.streams.BinaryStreams;
 import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.odbc.ClientListenerNioListener;
@@ -347,7 +348,7 @@ public class JdbcThinTcpIo {
             writer.writeString(connProps.getPassword());
         }
 
-        send(writer.out().arrayCopy());
+        send(writer);
 
         BinaryReaderEx reader = BinaryUtils.reader(ctx, BinaryStreams.inputStream(read()), null, false);
 
@@ -452,7 +453,7 @@ public class JdbcThinTcpIo {
         writer.writeBoolean(connProps.isReplicatedOnly());
         writer.writeBoolean(connProps.isAutoCloseServerCursor());
 
-        send(writer.out().arrayCopy());
+        send(writer);
 
         BinaryReaderEx reader = BinaryUtils.reader(null, BinaryStreams.inputStream(read()), null, false);
 
@@ -593,23 +594,25 @@ public class JdbcThinTcpIo {
         req.writeBinary(writer, protoCtx);
 
         synchronized (connMux) {
-            send(writer.out().arrayCopy());
+            send(writer);
         }
     }
 
     /**
-     * @param req JDBC request bytes.
+     * @param writer Writer with request bytes.
      * @throws IOException On error.
      */
-    private void send(byte[] req) throws IOException {
-        int size = req.length;
+    private void send(BinaryWriterEx writer) throws IOException {
+        BinaryOutputStream stream = writer.out();
+
+        int size = stream.position();
 
         out.write(size & 0xFF);
         out.write((size >> 8) & 0xFF);
         out.write((size >> 16) & 0xFF);
         out.write((size >> 24) & 0xFF);
 
-        out.write(req);
+        out.write(stream.array(), 0, size);
 
         out.flush();
     }