Fix Valgrind error of uninitialized data in CommitTransactionRef

This commit is contained in:
Jingyu Zhou 2022-02-18 15:38:19 -08:00
parent e0bf668f94
commit 608dabbf41
2 changed files with 12 additions and 7 deletions

View File

@ -177,18 +177,20 @@ static inline bool isNonAssociativeOp(MutationRef::Type mutationType) {
}
struct CommitTransactionRef {
CommitTransactionRef() : read_snapshot(0), report_conflicting_keys(false) {}
CommitTransactionRef() = default;
CommitTransactionRef(Arena& a, const CommitTransactionRef& from)
: read_conflict_ranges(a, from.read_conflict_ranges), write_conflict_ranges(a, from.write_conflict_ranges),
mutations(a, from.mutations), read_snapshot(from.read_snapshot),
report_conflicting_keys(from.report_conflicting_keys) {}
report_conflicting_keys(from.report_conflicting_keys), lock_aware(from.lock_aware),
spanContext(from.spanContext) {}
VectorRef<KeyRangeRef> read_conflict_ranges;
VectorRef<KeyRangeRef> write_conflict_ranges;
VectorRef<MutationRef> mutations; // metadata mutations
Version read_snapshot;
bool report_conflicting_keys;
bool lock_aware; // set when metadata mutations are present
SpanID spanContext;
Version read_snapshot = 0;
bool report_conflicting_keys = false;
bool lock_aware = false; // set when metadata mutations are present
Optional<SpanID> spanContext;
template <class Ar>
force_inline void serialize(Ar& ar) {

View File

@ -340,7 +340,10 @@ ACTOR Future<Void> resolveBatch(Reference<Resolver> self, ResolveTransactionBatc
// The condition here must match CommitBatch::applyMetadataToCommittedTransactions()
if (reply.committed[t] == ConflictBatch::TransactionCommitted && !self->forceRecovery &&
SERVER_KNOBS->PROXY_USE_RESOLVER_PRIVATE_MUTATIONS && (!isLocked || req.transactions[t].lock_aware)) {
applyMetadataMutations(req.transactions[t].spanContext, resolverData, req.transactions[t].mutations);
SpanID spanContext =
req.transactions[t].spanContext.present() ? req.transactions[t].spanContext.get() : SpanID();
applyMetadataMutations(spanContext, resolverData, req.transactions[t].mutations);
}
TEST(self->forceRecovery); // Resolver detects forced recovery
}