Browse Source

Update TcpHeader version constant for backport (#50086)

In 7.6 we are adding a int indicating how long the Elasticsearch
variable header is. This commit modifies the version constant indicating
when this int is supported to reflect the fact that this int is
available on 7.6.
Tim Brooks 5 years ago
parent
commit
c5ecbee224

+ 2 - 3
server/src/main/java/org/elasticsearch/transport/TcpHeader.java

@@ -25,9 +25,8 @@ import org.elasticsearch.common.io.stream.StreamOutput;
 import java.io.IOException;
 import java.io.IOException;
 
 
 public class TcpHeader {
 public class TcpHeader {
-
-    // TODO: Change to 7.6 after backport
-    public static final Version VERSION_WITH_HEADER_SIZE = Version.V_8_0_0;
+    
+    public static final Version VERSION_WITH_HEADER_SIZE = Version.V_7_6_0;
 
 
     public static final int MARKER_BYTES_SIZE = 2;
     public static final int MARKER_BYTES_SIZE = 2;
 
 

+ 6 - 6
test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java

@@ -2368,15 +2368,15 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
                 assertEquals(1, transportStats.getRxCount());
                 assertEquals(1, transportStats.getRxCount());
                 assertEquals(2, transportStats.getTxCount());
                 assertEquals(2, transportStats.getTxCount());
                 assertEquals(138, transportStats.getRxSize().getBytes());
                 assertEquals(138, transportStats.getRxSize().getBytes());
-                assertEquals(107, transportStats.getTxSize().getBytes());
+                assertEquals(111, transportStats.getTxSize().getBytes());
             });
             });
             sendResponseLatch.countDown();
             sendResponseLatch.countDown();
             responseLatch.await();
             responseLatch.await();
             stats = serviceC.transport.getStats(); // response has been received
             stats = serviceC.transport.getStats(); // response has been received
             assertEquals(2, stats.getRxCount());
             assertEquals(2, stats.getRxCount());
             assertEquals(2, stats.getTxCount());
             assertEquals(2, stats.getTxCount());
-            assertEquals(159, stats.getRxSize().getBytes());
-            assertEquals(107, stats.getTxSize().getBytes());
+            assertEquals(163, stats.getRxSize().getBytes());
+            assertEquals(111, stats.getTxSize().getBytes());
         } finally {
         } finally {
             serviceC.close();
             serviceC.close();
         }
         }
@@ -2483,7 +2483,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
                 assertEquals(1, transportStats.getRxCount());
                 assertEquals(1, transportStats.getRxCount());
                 assertEquals(2, transportStats.getTxCount());
                 assertEquals(2, transportStats.getTxCount());
                 assertEquals(138, transportStats.getRxSize().getBytes());
                 assertEquals(138, transportStats.getRxSize().getBytes());
-                assertEquals(107, transportStats.getTxSize().getBytes());
+                assertEquals(111, transportStats.getTxSize().getBytes());
             });
             });
             sendResponseLatch.countDown();
             sendResponseLatch.countDown();
             responseLatch.await();
             responseLatch.await();
@@ -2497,8 +2497,8 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
             String failedMessage = "Unexpected read bytes size. The transport exception that was received=" + exception;
             String failedMessage = "Unexpected read bytes size. The transport exception that was received=" + exception;
             // 49 bytes are the non-exception message bytes that have been received. It should include the initial
             // 49 bytes are the non-exception message bytes that have been received. It should include the initial
             // handshake message and the header, version, etc bytes in the exception message.
             // handshake message and the header, version, etc bytes in the exception message.
-            assertEquals(failedMessage, 162 + streamOutput.bytes().length(), stats.getRxSize().getBytes());
-            assertEquals(107, stats.getTxSize().getBytes());
+            assertEquals(failedMessage, 166 + streamOutput.bytes().length(), stats.getRxSize().getBytes());
+            assertEquals(111, stats.getTxSize().getBytes());
         } finally {
         } finally {
             serviceC.close();
             serviceC.close();
         }
         }