From: Michael Vrable Date: Mon, 14 Jul 2008 21:17:57 +0000 (-0700) Subject: Better cope with null values in the segments_used table. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=b1593251f9c7f207027671960d6a25d695c0424b;p=cumulus.git Better cope with null values in the segments_used table. Treat nulls utilization values as 0.0 for cleaning purposes. These shouldn't come up, but may have been generated due to bugs in the SQLite library, so deal gracefully with them instead of failing with an exception. --- diff --git a/lbs.py b/lbs.py index ee4f445..b8de982 100644 --- a/lbs.py +++ b/lbs.py @@ -583,9 +583,11 @@ class LocalDatabase: info.mtime = row[3] info.age_days = row[4] - # If age is not available for whatever reason, treat it as 0.0. + # If data is not available for whatever reason, treat it as 0.0. if info.age_days is None: info.age_days = 0.0 + if info.used_bytes is None: + info.used_bytes = 0.0 # Benefit calculation: u is the estimated fraction of each segment # which is utilized (bytes belonging to objects still in use