Add support for 7.0 and 7.1 in transaction_profiling_analyzer

I painstakingly went through both transaction_profiling_analyzer.py and
fdbclient/ClientLogEvents.h to make sure that we really can read these
versions.
This commit is contained in:
Andrew Noyes 2022-01-19 14:00:21 -08:00
parent e642b2f5bc
commit f4b0de7a56
2 changed files with 16 additions and 2 deletions

View File

@ -48,8 +48,11 @@ PROTOCOL_VERSION_6_0 = 0x0FDB00A570010001
PROTOCOL_VERSION_6_1 = 0x0FDB00B061060001
PROTOCOL_VERSION_6_2 = 0x0FDB00B062010001
PROTOCOL_VERSION_6_3 = 0x0FDB00B063010001
PROTOCOL_VERSION_7_0 = 0x0FDB00B070010001
PROTOCOL_VERSION_7_1 = 0x0FDB00B071010001
supported_protocol_versions = frozenset([PROTOCOL_VERSION_5_2, PROTOCOL_VERSION_6_0, PROTOCOL_VERSION_6_1,
PROTOCOL_VERSION_6_2, PROTOCOL_VERSION_6_3])
PROTOCOL_VERSION_6_2, PROTOCOL_VERSION_6_3, PROTOCOL_VERSION_7_0,
PROTOCOL_VERSION_7_1])
fdb.api_version(520)
@ -166,6 +169,11 @@ class MutationType(Enum):
MIN = 13
SET_VERSION_STAMPED_KEY = 14
SET_VERSION_STAMPED_VALUE = 15
BYTE_MIN = 16
BYTE_MAX = 17
MIN_V2 = 18
AND_V2 = 19
COMPARE_AND_CLEAR = 20
class Mutation(object):
@ -176,7 +184,11 @@ class Mutation(object):
class BaseInfo(object):
"""
Corresponds to FdbClientLogEvents::Event
"""
def __init__(self, bb, protocol_version):
# we already read the EventType, so go straight to start_timestamp
self.start_timestamp = bb.get_double()
if protocol_version >= PROTOCOL_VERSION_6_3:
self.dc_id = bb.get_bytes_with_length()
@ -281,6 +293,7 @@ class ClientTransactionInfo:
protocol_version = bb.get_long()
if protocol_version not in supported_protocol_versions:
raise UnsupportedProtocolVersionError(protocol_version)
# keep in sync with subclasses of FdbClientLogEvents::Event in fdbclient/ClientLogEvents.h
while bb.get_remaining_bytes():
event = bb.get_int()
if event == 0:

View File

@ -37,7 +37,8 @@ enum class EventType {
UNSET
};
enum class TransactionPriorityType { PRIORITY_DEFAULT = 0, PRIORITY_BATCH = 1, PRIORITY_IMMEDIATE = 2, UNSET };
enum class TransactionPriorityType : int { PRIORITY_DEFAULT = 0, PRIORITY_BATCH = 1, PRIORITY_IMMEDIATE = 2, UNSET };
static_assert(sizeof(TransactionPriorityType) == 4, "transaction_profiling_analyzer.py assumes this field has size 4");
struct Event {
Event(EventType t, double ts, const Optional<Standalone<StringRef>>& dc) : type(t), startTs(ts) {