File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -235,9 +235,10 @@ ui64 TPartition::MeteringDataSize(const TActorContext& /*ctx*/) const {
235
235
// We assume that DataKyesBody contains an up-to-date set of blobs, their relevance is
236
236
// maintained by the background process. However, the last block may contain several irrelevant
237
237
// messages. Because of them, we throw out the size of the entire blob.
238
- ui64 size = Size () - DataKeysBody[0 ].Size ;
239
- Y_DEBUG_ABORT_UNLESS (size >= 0 , " Metering data size must be positive" );
240
- return std::max<ui64>(size, 0 );
238
+ auto size = Size ();
239
+ auto lastBlobSize = DataKeysBody[0 ].Size ;
240
+ Y_DEBUG_ABORT_UNLESS (size >= lastBlobSize, " Metering data size must be positive" );
241
+ return size >= lastBlobSize ? size - lastBlobSize : 0 ;
241
242
}
242
243
243
244
ui64 TPartition::ReserveSize () const {
@@ -257,7 +258,9 @@ ui64 TPartition::GetUsedStorage(const TActorContext& ctx) {
257
258
const auto duration = now - LastUsedStorageMeterTimestamp;
258
259
LastUsedStorageMeterTimestamp = now;
259
260
260
- ui64 size = std::max<ui64>(MeteringDataSize (ctx) - ReserveSize (), 0 );
261
+ auto dataSize = MeteringDataSize (ctx);
262
+ auto reservedSize = ReserveSize ();
263
+ ui64 size = dataSize > reservedSize ? dataSize - reservedSize : 0 ;
261
264
return size * duration.MilliSeconds () / 1000 / 1_MB; // mb*seconds
262
265
}
263
266
You can’t perform that action at this time.
0 commit comments