You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/11/14 09:19:42 UTC

[avro] branch branch-1.11 updated: AVRO-3657: Computation of initial buffer size in OutputBuffer makes no sense (#1960)

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

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 291a9b984 AVRO-3657: Computation of initial buffer size in OutputBuffer makes no sense (#1960)
291a9b984 is described below

commit 291a9b9845ff1118e02e82542162ae4fd262fc19
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Mon Nov 14 11:19:14 2022 +0200

    AVRO-3657: Computation of initial buffer size in OutputBuffer makes no sense (#1960)
    
    Allocate 1.25x more space than the block size
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    (cherry picked from commit 35d462e65754060948a480ee2ffdbd63caaac281)
---
 .../trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java
index 74413b431..a02d0e7fc 100644
--- a/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java
+++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java
@@ -30,7 +30,11 @@ class OutputBuffer extends ByteArrayOutputStream {
   private int bitCount; // position in booleans
 
   public OutputBuffer() {
-    super((BLOCK_SIZE + BLOCK_SIZE) >> 2);
+    this(BLOCK_SIZE + (BLOCK_SIZE >> 2));
+  }
+
+  public OutputBuffer(int size) {
+    super(size);
   }
 
   public boolean isFull() {