File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2133,6 +2133,21 @@ func (b *BulkOpSummary) Add(other BulkOpSummary) {
2133
2133
}
2134
2134
}
2135
2135
2136
+ // DeepCopy returns a deep copy of the original BulkOpSummary.
2137
+ func (b * BulkOpSummary ) DeepCopy () BulkOpSummary {
2138
+ cpy := BulkOpSummary {
2139
+ DataSize : b .DataSize ,
2140
+ SSTDataSize : b .SSTDataSize ,
2141
+ }
2142
+ if b .EntryCounts != nil {
2143
+ cpy .EntryCounts = make (map [uint64 ]int64 , len (b .EntryCounts ))
2144
+ for k , v := range b .EntryCounts {
2145
+ cpy .EntryCounts [k ] = v
2146
+ }
2147
+ }
2148
+ return cpy
2149
+ }
2150
+
2136
2151
// MustSetValue is like SetValue, except it resets the enum and panics if the
2137
2152
// provided value is not a valid variant type.
2138
2153
func (e * RangeFeedEvent ) MustSetValue (value interface {}) {
Original file line number Diff line number Diff line change @@ -1935,6 +1935,7 @@ message BulkOpSummary {
1935
1935
// generation logic is also available in the BulkOpSummaryID helper. It does
1936
1936
// not take MVCC range tombstones into account.
1937
1937
map <uint64 , int64 > entry_counts = 5 ;
1938
+ // Please update BulkOpSummary.DeepCopy() if new fields are added.
1938
1939
}
1939
1940
1940
1941
// ExportResponse is the response to an Export() operation.
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ func distImport(
176
176
}
177
177
178
178
accumulatedBulkSummary .Lock ()
179
- prog .Summary = accumulatedBulkSummary .BulkOpSummary
179
+ prog .Summary = accumulatedBulkSummary .BulkOpSummary . DeepCopy ()
180
180
accumulatedBulkSummary .Unlock ()
181
181
return overall / float32 (len (from ))
182
182
},
You can’t perform that action at this time.
0 commit comments