Skip to content

Commit

Permalink
Fix data race of DeltaIndex::toString (#5948) (#5954)
Browse files Browse the repository at this point in the history
close #5947
  • Loading branch information
ti-chi-bot authored Oct 10, 2022
1 parent 7668a60 commit ca39013
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dbms/src/Storages/DeltaMerge/DeltaIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,13 @@ class DeltaIndex

String toString()
{
std::stringstream s;
s << "{placed rows:" << placed_rows << ", deletes:" << placed_deletes << ", delta tree: " << delta_tree->numEntries() << "|"
<< delta_tree->numInserts() << "|" << delta_tree->numDeletes() << "}";
return s.str();
std::scoped_lock lock(mutex);
return fmt::format("<placed_rows={} placed_deletes={} tree_entries={} tree_inserts={} tree_deletes={}>",
placed_rows,
placed_deletes,
delta_tree->numEntries(),
delta_tree->numInserts(),
delta_tree->numDeletes());
}

UInt64 getId() const { return id; }
Expand Down

0 comments on commit ca39013

Please sign in to comment.