Skip to content

Commit

Permalink
storage: fix accounting for orig LiveBytes in updateStatsOnResolve
Browse files Browse the repository at this point in the history
This commit fixes a latent bug where `updateStatsOnResolve`'s attempt to
discount the effect of the previous intent's key and value size on the
stats' `LiveBytes` field used the new value's size instead of the old
value's size. I've tracked this back to 92cad17.

This is currently harmless because intent value sizes never change
during intent resolution. However, this may not be the case in the
future. For instance, this will not be the case if we store local
timestamps in an `MVCCValue` wrapper object, as is being explored
in #77342.
  • Loading branch information
nvanbenschoten committed Apr 23, 2022
1 parent 621a046 commit 9c1d084
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/storage/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func updateStatsOnResolve(
// the new intent/value.
if !meta.Deleted {
ms.LiveBytes -= origMetaKeySize + origMetaValSize
ms.LiveBytes -= orig.KeyBytes + meta.ValBytes
ms.LiveBytes -= orig.KeyBytes + orig.ValBytes
}

// IntentAge is always accrued from the intent's own timestamp on.
Expand Down

0 comments on commit 9c1d084

Please sign in to comment.