Skip to content

Commit

Permalink
[misc] avoid reading from end in case of replication configuration wi…
Browse files Browse the repository at this point in the history
…th 2 servers with different versions
  • Loading branch information
rusher committed Jun 5, 2017
1 parent fa3f4a5 commit 0d59d8d
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class ColumnInformation {
4, 4, 4, 4, 0, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
static int lazyPositionFromEnd = 0;

Buffer buffer;
private short charsetNumber;
private long length;
Expand Down Expand Up @@ -135,19 +135,13 @@ public ColumnInformation(Buffer buffer) {
2 filler [00] [00]
*/
if (lazyPositionFromEnd == 0) {
buffer.skipLengthEncodedBytes(); /* catalog */
buffer.skipLengthEncodedBytes(); /* db */
buffer.skipLengthEncodedBytes(); /* table */
buffer.skipLengthEncodedBytes(); /* original table */
buffer.skipLengthEncodedBytes(); /* name */
buffer.skipLengthEncodedBytes(); /* org_name */
buffer.readByte(); //fixlength field
lazyPositionFromEnd = buffer.limit - buffer.position;
} else {
//permit to avoid reading the 6th String encode data, almost never needed
buffer.position = buffer.limit - lazyPositionFromEnd;
}
buffer.skipLengthEncodedBytes(); /* catalog */
buffer.skipLengthEncodedBytes(); /* db */
buffer.skipLengthEncodedBytes(); /* table */
buffer.skipLengthEncodedBytes(); /* original table */
buffer.skipLengthEncodedBytes(); /* name */
buffer.skipLengthEncodedBytes(); /* org_name */
buffer.readByte(); //fixlength field

charsetNumber = buffer.readShort();
length = buffer.readInt();
Expand Down

0 comments on commit 0d59d8d

Please sign in to comment.