MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / fixQualifierFlags

Method fixQualifierFlags

src/core/Internal.java:535–544  ·  view source on GitHub ↗

Fix the flags inside the last byte of a qualifier. OpenTSDB used to not rely on the size recorded in the flags being correct, and so for a long time it was setting the wrong size for floating point values (pretending they were encoded on 8 bytes when in fact they were on 4). So overwrite these

(byte flags, final int val_len)

Source from the content-addressed store, hash-verified

533 * @return The least significant byte of the qualifier with correct flags.
534 */
535 public static byte fixQualifierFlags(byte flags, final int val_len) {
536 // Explanation:
537 // (1) Take the last byte of the qualifier.
538 // (2) Zero out all the flag bits but one.
539 // The one we keep is the type (floating point vs integer value).
540 // (3) Set the length properly based on the value we have.
541 return (byte) ((flags & ~(Const.FLAGS_MASK >>> 1)) | (val_len - 1));
542 // ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
543 // (1) (2) (3)
544 }
545
546 /**
547 * Returns whether or not this is a floating value that needs to be fixed.

Callers 3

fixQualifierFlagsMethod · 0.95
checkForFixupMethod · 0.95
extractDataPointsMethod · 0.95

Calls

no outgoing calls

Tested by 1

fixQualifierFlagsMethod · 0.76