Predicts a lower bound on the serialized size of this RPC. This is to avoid using a dynamic buffer, to avoid re-sizing the buffer. Since we use a static buffer, if the prediction is wrong and turns out to be less than what we need, there will be an exception which will prevent the RPC from being ser
()
| 514 | * prevent the RPC from being serialized. That'd be a severe bug. |
| 515 | */ |
| 516 | private int predictSerializedSize() { |
| 517 | int size = 0; |
| 518 | size += 4; // int: Number of parameters. |
| 519 | size += 1; // byte: Type of the 1st parameter. |
| 520 | size += 3; // vint: region name length (3 bytes => max length = 32768). |
| 521 | size += region.name().length; // The region name. |
| 522 | |
| 523 | size += 1; // byte: Type of the 2nd parameter. |
| 524 | size += 1; // byte: Type again (see HBASE-2877). |
| 525 | size += 1; // byte: Version of Delete. |
| 526 | size += 3; // vint: row key length (3 bytes => max length = 32768). |
| 527 | size += key.length; // The row key. |
| 528 | size += 8; // long: Timestamp. |
| 529 | size += 8; // long: Lock ID. |
| 530 | size += 4; // int: Number of families. |
| 531 | size += 1; // vint: Family length (guaranteed on 1 byte). |
| 532 | if (family == null) { |
| 533 | return size; |
| 534 | } |
| 535 | size += family.length; // The column family. |
| 536 | size += 4; // int: Number of KeyValues for this family. |
| 537 | return size + payloadSize(); |
| 538 | } |
| 539 | |
| 540 | /** Returns the serialized size of all the {@link KeyValue}s in this RPC. */ |
| 541 | @Override |
no test coverage detected