2017-05-26 04:48:44 +08:00
|
|
|
/*
|
|
|
|
* ClientLogEvents.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
*
|
2017-05-26 04:48:44 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef FDBCLIENT_CLIENTLOGEVENTS_H
|
|
|
|
#define FDBCLIENT_CLIENTLOGEVENTS_H
|
|
|
|
|
|
|
|
namespace FdbClientLogEvents {
|
|
|
|
typedef int EventType;
|
|
|
|
enum { GET_VERSION_LATENCY = 0,
|
|
|
|
GET_LATENCY = 1,
|
|
|
|
GET_RANGE_LATENCY = 2,
|
|
|
|
COMMIT_LATENCY = 3,
|
|
|
|
ERROR_GET = 4,
|
|
|
|
ERROR_GET_RANGE = 5,
|
|
|
|
ERROR_COMMIT = 6,
|
|
|
|
|
|
|
|
EVENTTYPEEND // End of EventType
|
|
|
|
};
|
|
|
|
|
2019-07-20 08:31:49 +08:00
|
|
|
typedef int TrasactionPriorityType;
|
|
|
|
enum {
|
|
|
|
PRIORITY_DEFAULT = 0,
|
|
|
|
PRIORITY_BATCH = 1,
|
|
|
|
PRIORITY_IMMEDIATE = 2,
|
|
|
|
PRIORITY_END
|
|
|
|
};
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
struct Event {
|
|
|
|
Event(EventType t, double ts) : type(t), startTs(ts) { }
|
2018-03-06 10:35:26 +08:00
|
|
|
Event() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2018-12-29 02:49:26 +08:00
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) { return serializer(ar, type, startTs); }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
EventType type{ EVENTTYPEEND };
|
|
|
|
double startTs{ 0 };
|
|
|
|
|
2019-07-13 07:12:35 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {}
|
2017-05-26 04:48:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct EventGetVersion : public Event {
|
|
|
|
EventGetVersion(double ts, double lat) : Event(GET_VERSION_LATENCY, ts), latency(lat) { }
|
2018-03-06 10:35:26 +08:00
|
|
|
EventGetVersion() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), latency);
|
2017-05-26 04:48:44 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, latency);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_GetVersion")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-23 03:17:05 +08:00
|
|
|
// Version V2 of EventGetVersion starting at 6.2
|
2019-07-20 08:31:49 +08:00
|
|
|
struct EventGetVersion_V2 : public Event {
|
2020-04-25 02:31:16 +08:00
|
|
|
EventGetVersion_V2(double ts, double lat, TransactionPriority priority) : Event(GET_VERSION_LATENCY, ts), latency(lat) {
|
|
|
|
switch(priority) {
|
|
|
|
// Unfortunately, the enum serialized here disagrees with the enum used elsewhere for the values used by each priority
|
|
|
|
case TransactionPriority::IMMEDIATE:
|
|
|
|
priorityType = PRIORITY_IMMEDIATE;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::DEFAULT:
|
|
|
|
priorityType = PRIORITY_DEFAULT;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::BATCH:
|
|
|
|
priorityType = PRIORITY_BATCH;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
2019-07-20 08:31:49 +08:00
|
|
|
}
|
2020-05-08 07:06:46 +08:00
|
|
|
}
|
2019-07-20 08:31:49 +08:00
|
|
|
EventGetVersion_V2() { }
|
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
|
|
|
return serializer(Event::serialize(ar), latency, priorityType);
|
|
|
|
else
|
|
|
|
return serializer(ar, latency, priorityType);
|
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
TrasactionPriorityType priorityType {PRIORITY_END};
|
|
|
|
|
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
|
|
|
TraceEvent("TransactionTrace_GetVersion")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("PriorityType", priorityType);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-05-04 13:42:06 +08:00
|
|
|
// Version V3 of EventGetVersion starting at 6.3
|
|
|
|
struct EventGetVersion_V3 : public Event {
|
2020-05-08 07:06:46 +08:00
|
|
|
EventGetVersion_V3(double ts, double lat, TransactionPriority priority, Version version) : Event(GET_VERSION_LATENCY, ts), latency(lat), readVersion(version) {
|
|
|
|
switch(priority) {
|
|
|
|
// Unfortunately, the enum serialized here disagrees with the enum used elsewhere for the values used by each priority
|
|
|
|
case TransactionPriority::IMMEDIATE:
|
|
|
|
priorityType = PRIORITY_IMMEDIATE;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::DEFAULT:
|
|
|
|
priorityType = PRIORITY_DEFAULT;
|
|
|
|
break;
|
|
|
|
case TransactionPriority::BATCH:
|
|
|
|
priorityType = PRIORITY_BATCH;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(false);
|
2020-05-04 13:42:06 +08:00
|
|
|
}
|
2020-05-08 07:06:46 +08:00
|
|
|
}
|
2020-05-04 13:42:06 +08:00
|
|
|
EventGetVersion_V3() { }
|
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
|
|
|
return serializer(Event::serialize(ar), latency, priorityType, readVersion);
|
|
|
|
else
|
|
|
|
return serializer(ar, latency, priorityType, readVersion);
|
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
TrasactionPriorityType priorityType {PRIORITY_END};
|
|
|
|
Version readVersion;
|
|
|
|
|
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
|
|
|
TraceEvent("TransactionTrace_GetVersion")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("PriorityType", priorityType)
|
|
|
|
.detail("ReadVersion", readVersion);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
struct EventGet : public Event {
|
2017-08-08 09:45:42 +08:00
|
|
|
EventGet(double ts, double lat, int size, const KeyRef &in_key) : Event(GET_LATENCY, ts), latency(lat), valueSize(size), key(in_key) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventGet() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), latency, valueSize, key);
|
2017-05-26 04:48:44 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, latency, valueSize, key);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
int valueSize;
|
2017-08-08 09:45:42 +08:00
|
|
|
Key key;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_Get")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("ValueSizeBytes", valueSize)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Key", key);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EventGetRange : public Event {
|
2017-08-08 09:45:42 +08:00
|
|
|
EventGetRange(double ts, double lat, int size, const KeyRef &start_key, const KeyRef & end_key) : Event(GET_RANGE_LATENCY, ts), latency(lat), rangeSize(size), startKey(start_key), endKey(end_key) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventGetRange() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), latency, rangeSize, startKey, endKey);
|
2017-05-26 04:48:44 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, latency, rangeSize, startKey, endKey);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
int rangeSize;
|
2017-08-08 09:45:42 +08:00
|
|
|
Key startKey;
|
|
|
|
Key endKey;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_GetRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("RangeSizeBytes", rangeSize)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("StartKey", startKey)
|
|
|
|
.detail("EndKey", endKey);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EventCommit : public Event {
|
2017-11-03 08:00:44 +08:00
|
|
|
EventCommit(double ts, double lat, int mut, int bytes, const CommitTransactionRequest &commit_req) : Event(COMMIT_LATENCY, ts), latency(lat), numMutations(mut), commitBytes(bytes), req(commit_req) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventCommit() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), latency, numMutations, commitBytes, req.transaction, req.arena);
|
2017-05-26 04:48:44 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, latency, numMutations, commitBytes, req.transaction, req.arena);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
int numMutations;
|
|
|
|
int commitBytes;
|
2017-08-02 09:33:39 +08:00
|
|
|
CommitTransactionRequest req; // Only CommitTransactionRef and Arena object within CommitTransactionRequest is serialized
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2017-08-02 09:33:39 +08:00
|
|
|
for (auto &read_range : req.transaction.read_conflict_ranges) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_Commit_ReadConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", read_range.begin)
|
|
|
|
.detail("End", read_range.end);
|
2017-08-02 09:33:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &write_range : req.transaction.write_conflict_ranges) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_Commit_WriteConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", write_range.begin)
|
|
|
|
.detail("End", write_range.end);
|
2017-08-02 09:33:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &mutation : req.transaction.mutations) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_Commit_Mutation")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Mutation", mutation.toString());
|
2017-08-02 09:33:39 +08:00
|
|
|
}
|
2017-08-08 09:45:42 +08:00
|
|
|
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_Commit")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("NumMutations", numMutations)
|
|
|
|
.detail("CommitSizeBytes", commitBytes);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-05-04 13:42:06 +08:00
|
|
|
// Version V2 of EventGetVersion starting at 6.3
|
|
|
|
struct EventCommit_V2 : public Event {
|
|
|
|
EventCommit_V2(double ts, double lat, int mut, int bytes, Version version, const CommitTransactionRequest &commit_req)
|
|
|
|
: Event(COMMIT_LATENCY, ts), latency(lat), numMutations(mut), commitBytes(bytes), commitVersion(version), req(commit_req) { }
|
|
|
|
EventCommit_V2() { }
|
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
|
|
|
return serializer(Event::serialize(ar), latency, numMutations, commitBytes, commitVersion, req.transaction, req.arena);
|
|
|
|
else
|
|
|
|
return serializer(ar, latency, numMutations, commitBytes, commitVersion, req.transaction, req.arena);
|
|
|
|
}
|
|
|
|
|
|
|
|
double latency;
|
|
|
|
int numMutations;
|
|
|
|
int commitBytes;
|
|
|
|
Version commitVersion;
|
|
|
|
CommitTransactionRequest req; // Only CommitTransactionRef and Arena object within CommitTransactionRequest is serialized
|
|
|
|
|
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
|
|
|
for (auto &read_range : req.transaction.read_conflict_ranges) {
|
|
|
|
TraceEvent("TransactionTrace_Commit_ReadConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", read_range.begin)
|
|
|
|
.detail("End", read_range.end);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &write_range : req.transaction.write_conflict_ranges) {
|
|
|
|
TraceEvent("TransactionTrace_Commit_WriteConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", write_range.begin)
|
|
|
|
.detail("End", write_range.end);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &mutation : req.transaction.mutations) {
|
|
|
|
TraceEvent("TransactionTrace_Commit_Mutation")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Mutation", mutation.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
TraceEvent("TransactionTrace_Commit")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("CommitVersion", commitVersion)
|
|
|
|
.detail("Latency", latency)
|
|
|
|
.detail("NumMutations", numMutations)
|
|
|
|
.detail("CommitSizeBytes", commitBytes);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-08-08 09:45:42 +08:00
|
|
|
struct EventGetError : public Event {
|
|
|
|
EventGetError(double ts, int err_code, const KeyRef &in_key) : Event(ERROR_GET, ts), errCode(err_code), key(in_key) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventGetError() { }
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), errCode, key);
|
2017-05-26 04:48:44 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, errCode, key);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2017-08-08 09:45:42 +08:00
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
int errCode;
|
2017-08-08 09:45:42 +08:00
|
|
|
Key key;
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_GetError")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("ErrCode", errCode)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Key", key);
|
2017-08-08 09:45:42 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EventGetRangeError : public Event {
|
|
|
|
EventGetRangeError(double ts, int err_code, const KeyRef &start_key, const KeyRef & end_key) : Event(ERROR_GET_RANGE, ts), errCode(err_code), startKey(start_key), endKey(end_key) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventGetRangeError() { }
|
2017-08-08 09:45:42 +08:00
|
|
|
|
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), errCode, startKey, endKey);
|
2017-08-08 09:45:42 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, errCode, startKey, endKey);
|
2017-08-08 09:45:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int errCode;
|
|
|
|
Key startKey;
|
|
|
|
Key endKey;
|
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_GetRangeError")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("ErrCode", errCode)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("StartKey", startKey)
|
|
|
|
.detail("EndKey", endKey);
|
2017-08-08 09:45:42 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EventCommitError : public Event {
|
2017-11-03 08:00:44 +08:00
|
|
|
EventCommitError(double ts, int err_code, const CommitTransactionRequest &commit_req) : Event(ERROR_COMMIT, ts), errCode(err_code), req(commit_req) { }
|
2018-03-15 03:39:50 +08:00
|
|
|
EventCommitError() { }
|
|
|
|
|
2017-08-08 09:45:42 +08:00
|
|
|
template <typename Ar> Ar& serialize(Ar &ar) {
|
|
|
|
if (!ar.isDeserializing)
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(Event::serialize(ar), errCode, req.transaction, req.arena);
|
2017-08-08 09:45:42 +08:00
|
|
|
else
|
2018-12-29 02:49:26 +08:00
|
|
|
return serializer(ar, errCode, req.transaction, req.arena);
|
2017-08-08 09:45:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int errCode;
|
|
|
|
CommitTransactionRequest req; // Only CommitTransactionRef and Arena object within CommitTransactionRequest is serialized
|
|
|
|
|
2019-07-16 06:01:24 +08:00
|
|
|
void logEvent(std::string id, int maxFieldLength) const {
|
2017-08-08 09:45:42 +08:00
|
|
|
for (auto &read_range : req.transaction.read_conflict_ranges) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_CommitError_ReadConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", read_range.begin)
|
|
|
|
.detail("End", read_range.end);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2017-08-08 09:45:42 +08:00
|
|
|
|
|
|
|
for (auto &write_range : req.transaction.write_conflict_ranges) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_CommitError_WriteConflictRange")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Begin", write_range.begin)
|
|
|
|
.detail("End", write_range.end);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
2017-08-08 09:45:42 +08:00
|
|
|
|
|
|
|
for (auto &mutation : req.transaction.mutations) {
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_CommitError_Mutation")
|
|
|
|
.setMaxEventLength(-1)
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.setMaxFieldLength(maxFieldLength)
|
|
|
|
.detail("Mutation", mutation.toString());
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
|
2019-07-13 07:12:35 +08:00
|
|
|
TraceEvent("TransactionTrace_CommitError")
|
|
|
|
.detail("TransactionID", id)
|
|
|
|
.detail("ErrCode", errCode);
|
2017-05-26 04:48:44 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|