Skip to content

Commit

Permalink
Fix the controller metric of table size (apache#2637)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjlli authored Mar 19, 2018
1 parent f356425 commit a893483
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public QuotaCheckerResponse isSegmentStorageWithinQuota(@Nonnull File segmentFil
TableSizeReader.SegmentSizeDetails sizeDetails = tableSubtypeSize.segments.get(segmentName);
long existingSegmentSizeBytes = sizeDetails != null ? sizeDetails.estimatedSizeInBytes : 0;

_controllerMetrics.setValueOfTableGauge(tableName, ControllerGauge.OFFLINE_TABLE_ESTIMATED_SIZE, existingSegmentSizeBytes);
// Since tableNameWithType comes with the table type(OFFLINE), thus we guarantee that
// tableSubtypeSize.estimatedSizeInBytes is the offline table size.
_controllerMetrics.setValueOfTableGauge(tableName, ControllerGauge.OFFLINE_TABLE_ESTIMATED_SIZE, tableSubtypeSize.estimatedSizeInBytes);

long estimatedFinalSizeBytes = tableSubtypeSize.estimatedSizeInBytes - existingSegmentSizeBytes + incomingSegmentSizeBytes;
if (estimatedFinalSizeBytes <= allowedStorageBytes) {
Expand Down

0 comments on commit a893483

Please sign in to comment.