disable journalIgnorable in enableInteractiveBranchAccess
authorJoey Hess <joeyh@joeyh.name>
Fri, 15 Jul 2022 17:43:46 +0000 (13:43 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 15 Jul 2022 17:48:41 +0000 (13:48 -0400)
Fix a reversion that prevented --batch commands (and the assistant)
from noticing data written to the journal by other commands.

I have not identified which commit broke this for sure,
but probably it was aeca7c2207a652c8a72f044204a5c0edb4782aac

--batch commands that wrote to the journal avoided the problem since
journalIgnorable sets unset on write. It's a little bit surprising that
nobody noticed that query --batch commands did not see data written by
other commands.

Sponsored-by: Dartmouth College's DANDI project
Annex/BranchState.hs
CHANGELOG
doc/bugs/batch_commands_miss_journalled_changes_made_while_running.mdwn [new file with mode: 0644]

index c44340977312f31c83557285c714808f13f078de..95d860e467a8cf1507e95e0d207e2afef3d1596c 100644 (file)
@@ -2,7 +2,7 @@
  -
  - Runtime state about the git-annex branch, and a small cache.
  -
- - Copyright 2011-2021 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2022 Joey Hess <id@joeyh.name>
  -
  - Licensed under the GNU AGPL version 3 or higher.
  -}
@@ -92,9 +92,9 @@ journalChanged = do
        -- so avoid an unnecessary write to the MVar that changeState
        -- would do.
        --
-       -- This assumes that another thread is not changing journalIgnorable
+       -- This assumes that another thread is not setting journalIgnorable
        -- at the same time, but since runUpdateOnce is the only
-       -- thing that changes it, and it only runs once, that
+       -- thing that sets it, and it only runs once, that
        -- should not happen.
        st <- getState 
        when (journalIgnorable st) $
@@ -109,8 +109,10 @@ journalChanged = do
  - will be seen.
  -}
 enableInteractiveBranchAccess :: Annex ()
-enableInteractiveBranchAccess = changeState $
-       \s -> s { needInteractiveAccess = True }
+enableInteractiveBranchAccess = changeState $ \s -> s 
+       { needInteractiveAccess = True
+       , journalIgnorable = False
+       }
 
 setCache :: RawFilePath -> L.ByteString -> Annex ()
 setCache file content = changeState $ \s -> s
index 00af5c368d7d3f0e755470440c85a963c6b7d9a7..1c2c561f33b1558424c4b56550a1e778393a2f14 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -17,6 +17,8 @@ git-annex (10.20220625) UNRELEASED; urgency=medium
     find -printf.
   * S3: Avoid writing or checking the uuid file in the S3 bucket when
     importtree=yes or exporttree=yes.
+  * Fix a reversion that prevented --batch commands (and the assistant)
+    from noticing data written to the journal by other commands.
 
  -- Joey Hess <id@joeyh.name>  Tue, 28 Jun 2022 14:49:17 -0400
 
diff --git a/doc/bugs/batch_commands_miss_journalled_changes_made_while_running.mdwn b/doc/bugs/batch_commands_miss_journalled_changes_made_while_running.mdwn
new file mode 100644 (file)
index 0000000..09fc596
--- /dev/null
@@ -0,0 +1,12 @@
+--batch commands are supposed to notice changes that get made to the
+journal while they are running. This way, if two batch commands are run,
+one making changes and the other reading the values, the reader notices the
+changes.
+
+That does not currently happen. Looks like runUpdateOnce runs before 
+enableInteractiveBranchAccess, and so sets journalIgnorable. Only if the
+batch command writes to the journal does journalIgnorable get unset, and
+then the command will notice journalled changes by itself or others.
+But query commands 
+
+> [[fixed|done]] --[[Joey]]