fix flipped diffUTCTime

fsck --incremental/--more: Fix bug that prevented the incremental fsck
information from being updated every 5 minutes as it was supposed to be; it
was only updated after 1000 files were checked, which may be more files
that are possible to fsck in a given fsck time window.

Thanks to Peter Simons for help with analysis of this bug.

Auditing for other cases of the same mistake, the keys db also had it
backwards. This seems unlikely to really have been a problem;
it would need associated files updates etc to be coming in slowly for some
reason and then be interrupted to cause any problem.

IIRC the design of the keys db assumes that any interruped
operation will be restarted, and so it can lose any buffered database
updates safely.
This commit is contained in:
Joey Hess 2019-10-03 09:54:19 -04:00
parent 40f3f01540
commit 2e6fd5de71
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 7 additions and 2 deletions

View file

@ -14,6 +14,11 @@ git-annex (7.20190913) UNRELEASED; urgency=medium
* Fix bug in handling of annex.largefiles that use largerthan/smallerthan.
When adding a modified file, it incorrectly used the file size of the
old version of the file, not the current size.
* fsck --incremental/--more: Fix bug that prevented the incremental fsck
information from being updated every 5 minutes as it was supposed to be;
it was only updated after 1000 files were checked, which may be more
files that are possible to fsck in a given fsck time window.
Thanks to Peter Simons for help with analysis of this bug.
-- Joey Hess <id@joeyh.name> Thu, 19 Sep 2019 11:11:19 -0400

View file

@ -83,7 +83,7 @@ addDb (FsckHandle h _) k = H.queueDb h checkcommit $
| sz > 1000 = return True
| otherwise = do
now <- getCurrentTime
return $ diffUTCTime lastcommittime now > 300
return $ diffUTCTime now lastcommittime > 300
{- Doesn't know about keys that were just added with addDb. -}
inDb :: FsckHandle -> Key -> IO Bool

View file

@ -57,7 +57,7 @@ queueDb a (WriteHandle h) = H.queueDb h checkcommit a
| sz > 1000 = return True
| otherwise = do
now <- getCurrentTime
return $ diffUTCTime lastcommittime now > 300
return $ diffUTCTime now lastcommittime > 300
addAssociatedFile :: IKey -> TopFilePath -> WriteHandle -> IO ()
addAssociatedFile ik f = queueDb $ do