Skip to content

fix(dbprovider): fix inflated storage values during backup restore#6855

Open
Che-Zhu wants to merge 1 commit intolabring:mainfrom
Che-Zhu:codex-fix-dbprovider-storage-conversion
Open

fix(dbprovider): fix inflated storage values during backup restore#6855
Che-Zhu wants to merge 1 commit intolabring:mainfrom
Che-Zhu:codex-fix-dbprovider-storage-conversion

Conversation

@Che-Zhu
Copy link
Copy Markdown
Contributor

@Che-Zhu Che-Zhu commented Apr 1, 2026

Summary

  • fix dbprovider storage quantity parsing to keep Gi values unchanged when reading from Kubernetes
  • prevent restore-created databases from inheriting inflated storage values
  • fix database detail and list storage display to use the correct converted size

Root Cause

  • dbprovider used scaledValue(Scale.Mega) / 1024 to convert storage quantities
  • in the shared quantity implementation, Scale.Mega is decimal 10^6, not binary Mi
  • that caused BinarySI values like 1Gi, 2Gi, and 3Gi to be parsed as inflated numbers such as 1.05, 2.10, and 3.15
  • restore then wrote the inflated value back into the new cluster as ${storage}Gi, which made restored database storage larger than the source

Changes

  • replace the storage conversion logic in storageFormatToNum and storageFormatToGi
  • convert storage quantities by reading the raw quantity value and dividing by 1024^3
  • keep the existing rounding behavior and fallback handling

Testing

  • not run (small utility fix; verified the conversion logic manually with 1Gi, 2Gi, 3Gi, 5Gi, and 10Gi)

@Che-Zhu Che-Zhu marked this pull request as ready for review April 1, 2026 03:34
@Che-Zhu Che-Zhu requested a review from a team as a code owner April 1, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant