Joey Hess [Sat, 12 Oct 2024 14:57:52 +0000 (10:57 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Spencer [Wed, 9 Oct 2024 23:10:17 +0000 (23:10 +0000)]
Added a comment: [FR] Remote Settings for All Clones
annex@9cc004f218c318a28099ff2645959be0fcbc6d94 [Wed, 9 Oct 2024 06:42:40 +0000 (06:42 +0000)]
Added a comment: Support for importtree
matrss [Tue, 8 Oct 2024 07:22:39 +0000 (07:22 +0000)]
Spencer [Tue, 8 Oct 2024 03:58:55 +0000 (03:58 +0000)]
Spencer [Tue, 8 Oct 2024 03:31:05 +0000 (03:31 +0000)]
Spencer [Mon, 7 Oct 2024 21:26:42 +0000 (21:26 +0000)]
Correction: rclonelayout=`lower` is not synonymous with the directory remote, `directory` is.
Spencer [Mon, 7 Oct 2024 20:00:24 +0000 (20:00 +0000)]
Added a comment: How to Clone?
Joey Hess [Mon, 7 Oct 2024 17:54:04 +0000 (13:54 -0400)]
tried a blind alley on streaming special remote download via proxy
This didn't work. In case I want to revisit, here's what I tried.
diff --git a/Annex/Proxy.hs b/Annex/Proxy.hs
index
48222872c1..
e4e526d3dd 100644
--- a/Annex/Proxy.hs
+++ b/Annex/Proxy.hs
@@ -26,16 +26,21 @@ import Logs.UUID
import Logs.Location
import Utility.Tmp.Dir
import Utility.Metered
+import Utility.ThreadScheduler
+import Utility.OpenFd
import Git.Types
import qualified Database.Export as Export
import Control.Concurrent.STM
import Control.Concurrent.Async
+import Control.Concurrent.MVar
import qualified Data.ByteString as B
+import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as L
import qualified System.FilePath.ByteString as P
import qualified Data.Map as M
import qualified Data.Set as S
+import System.IO.Unsafe
proxyRemoteSide :: ProtocolVersion -> Bypass -> Remote -> Annex RemoteSide
proxyRemoteSide clientmaxversion bypass r
@@ -240,21 +245,99 @@ proxySpecialRemote protoversion r ihdl ohdl owaitv oclosedv mexportdb = go
writeVerifyChunk iv h b
storetofile iv h (n - fromIntegral (B.length b)) bs
- proxyget offset af k = withproxytmpfile k $ \tmpfile -> do
+ proxyget offset af k = withproxytmpfile k $ \tmpfile ->
+ let retrieve = tryNonAsync $ Remote.retrieveKeyFile r k af
+ (fromRawFilePath tmpfile) nullMeterUpdate vc
+ in case fromKey keySize k of
+ Just size | size > 0 -> do
+ cancelv <- liftIO newEmptyMVar
+ donev <- liftIO newEmptyMVar
+ streamer <- liftIO $ async $
+ streamdata offset tmpfile size cancelv donev
+ retrieve >>= \case
+ Right _ -> liftIO $ do
+ putMVar donev ()
+ wait streamer
+ Left err -> liftIO $ do
+ putMVar cancelv ()
+ wait streamer
+ propagateerror err
+ _ -> retrieve >>= \case
+ Right _ -> liftIO $ senddata offset tmpfile
+ Left err -> liftIO $ propagateerror err
+ where
-- Don't verify the content from the remote,
-- because the client will do its own verification.
- let vc = Remote.NoVerify
- tryNonAsync (Remote.retrieveKeyFile r k af (fromRawFilePath tmpfile) nullMeterUpdate vc) >>= \case
- Right _ -> liftIO $ senddata offset tmpfile
- Left err -> liftIO $ propagateerror err
+ vc = Remote.NoVerify
+ streamdata (Offset offset) f size cancelv donev = do
+ sendlen offset size
+ waitforfile
+ x <- tryNonAsync $ do
+ fd <- openFdWithMode f ReadOnly Nothing defaultFileFlags
+ h <- fdToHandle fd
+ hSeek h AbsoluteSeek offset
+ senddata' h (getcontents size)
+ case x of
+ Left err -> do
+ throwM err
+ Right res -> return res
+ where
+ -- The file doesn't exist at the start.
+ -- Wait for some data to be written to it as well,
+ -- in case an empty file is first created and then
+ -- overwritten. When there is an offset, wait for
+ -- the file to get that large. Note that this is not used
+ -- when the size is 0.
+ waitforfile = tryNonAsync (fromIntegral <$> getFileSize f) >>= \case
+ Right sz | sz > 0 && sz >= offset -> return ()
+ _ -> ifM (isEmptyMVar cancelv)
+ ( do
+ threadDelaySeconds (Seconds 1)
+ waitforfile
+ , do
+ return ()
+ )
+
+ getcontents n h = unsafeInterleaveIO $ do
+ isdone <- isEmptyMVar donev <||> isEmptyMVar cancelv
+ c <- BS.hGet h defaultChunkSize
+ let n' = n - fromIntegral (BS.length c)
+ let c' = L.fromChunks [BS.take (fromIntegral n) c]
+ if BS.null c
+ then if isdone
+ then return mempty
+ else do
+ -- Wait for more data to be
+ -- written to the file.
+ threadDelaySeconds (Seconds 1)
+ getcontents n h
+ else if n' > 0
+ then do
+ -- unsafeInterleaveIO causes
+ -- this to be deferred until
+ -- data is read from the lazy
+ -- ByteString.
+ cs <- getcontents n' h
+ return $ L.append c' cs
+ else return c'
+
senddata (Offset offset) f = do
size <- fromIntegral <$> getFileSize f
- let n = max 0 (size - offset)
- sendmessage $ DATA (Len n)
+ sendlen offset size
withBinaryFile (fromRawFilePath f) ReadMode $ \h -> do
hSeek h AbsoluteSeek offset
- sendbs =<< L.hGetContents h
+ senddata' h L.hGetContents
+
+ senddata' h getcontents = do
+ sendbs =<< getcontents h
-- Important to keep the handle open until
-- the client responds. The bytestring
-- could still be lazily streaming out to
@@ -272,6 +355,11 @@ proxySpecialRemote protoversion r ihdl ohdl owaitv oclosedv mexportdb = go
Just FAILURE -> return ()
Just _ -> giveup "protocol error"
Nothing -> return ()
+
+ sendlen offset size = do
+ let n = max 0 (size - offset)
+ sendmessage $ DATA (Len n)
+
{- Check if this repository can proxy for a specified remote uuid,
- and if so enable proxying for it. -}
Spencer [Mon, 7 Oct 2024 19:10:19 +0000 (19:10 +0000)]
additional question of spaces in URL
Spencer [Mon, 7 Oct 2024 19:02:17 +0000 (19:02 +0000)]
matrss [Mon, 7 Oct 2024 14:40:19 +0000 (14:40 +0000)]
matrss [Mon, 7 Oct 2024 14:12:23 +0000 (14:12 +0000)]
Added a comment
Joey Hess [Mon, 7 Oct 2024 14:06:12 +0000 (10:06 -0400)]
update
matrss [Mon, 7 Oct 2024 13:59:56 +0000 (13:59 +0000)]
sng@353ca358075d9aa328f60a5439a3cee10f8301fe [Sun, 6 Oct 2024 21:42:13 +0000 (21:42 +0000)]
Added a comment
matrss [Wed, 2 Oct 2024 15:07:54 +0000 (15:07 +0000)]
matrss [Wed, 2 Oct 2024 14:51:58 +0000 (14:51 +0000)]
matrss [Wed, 2 Oct 2024 14:42:37 +0000 (14:42 +0000)]
yarikoptic [Tue, 1 Oct 2024 21:01:40 +0000 (21:01 +0000)]
filing an issue on yt-dlp not used for some reason
Joey Hess [Mon, 30 Sep 2024 23:16:06 +0000 (19:16 -0400)]
add news item for git-annex 10.
20240927
Joey Hess [Mon, 30 Sep 2024 23:15:57 +0000 (19:15 -0400)]
releasing package git-annex version 10.
20240927
Joey Hess [Mon, 30 Sep 2024 21:36:45 +0000 (17:36 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Mon, 30 Sep 2024 21:36:19 +0000 (17:36 -0400)]
fix build with old random
getStdGen used to be an IO not a MonadIO action
Joey Hess [Mon, 30 Sep 2024 18:56:06 +0000 (14:56 -0400)]
fix build with random-1.2
getStdGen worked with that version but initStdGen is newer. For our
purposes, they are equivilant.
Joey Hess [Mon, 30 Sep 2024 15:02:08 +0000 (11:02 -0400)]
fix build with old base
i386ancient has a base too old for NE.singleton
Joey Hess [Fri, 27 Sep 2024 19:31:31 +0000 (15:31 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Fri, 27 Sep 2024 19:30:51 +0000 (15:30 -0400)]
Revert "remove stack-lts-18.13.yaml"
This reverts commit
b0546e8bde5a46767a405fbbc7a3907127533de8.
https://github.com/datalad/git-annex/issues/204 is still not fixed yet
Joey Hess [Fri, 27 Sep 2024 14:01:44 +0000 (10:01 -0400)]
update version for release
mike@2d6d71f56ce2a992244350475251df87c26fe351 [Fri, 27 Sep 2024 12:18:59 +0000 (12:18 +0000)]
removed
mike@2d6d71f56ce2a992244350475251df87c26fe351 [Fri, 27 Sep 2024 12:18:41 +0000 (12:18 +0000)]
Added a comment: corruption using git-annex-remote-rclone
mike@2d6d71f56ce2a992244350475251df87c26fe351 [Fri, 27 Sep 2024 07:39:06 +0000 (07:39 +0000)]
Added a comment: corruption using git-annex-remote-rclone
Joey Hess [Thu, 26 Sep 2024 22:46:12 +0000 (18:46 -0400)]
remove stack-lts-18.13.yaml
windows autobuilder should have been fixed by now
(offline so didn't check)
Joey Hess [Thu, 26 Sep 2024 22:43:59 +0000 (18:43 -0400)]
remove read of the heads
and one tail
Removed head from Utility.PartialPrelude in order to avoid the build
warning with recent ghc versions as well.
Joey Hess [Thu, 26 Sep 2024 22:15:00 +0000 (18:15 -0400)]
use NonEmpty for dirHashes
This avoids 4 uses of head.
Joey Hess [Thu, 26 Sep 2024 21:54:36 +0000 (17:54 -0400)]
Git: use NonEmpty in fullconfig
This is a nice win. Avoids partial functions, by encoding at the type
level the fact that fullconfig is never an empty list.
Joey Hess [Thu, 26 Sep 2024 21:53:00 +0000 (17:53 -0400)]
avoid head
While in some sense this is better, the use of NE.fromList is still
partial.
Joey Hess [Thu, 26 Sep 2024 21:52:19 +0000 (17:52 -0400)]
avoid head
Recent ghc has a deprecation warning on it.
This is not an improvement though. I know these cannot fail, but I can't
prove it to ghc.
Joey Hess [Thu, 26 Sep 2024 21:49:41 +0000 (17:49 -0400)]
avoid head
Seems like generate works fine to generate a single arbitrary value, I
dunno why I used sample' originally.
Joey Hess [Thu, 26 Sep 2024 21:21:22 +0000 (17:21 -0400)]
remove slightly unsafe use of head
If git rev-parse somehow didn't output anything, git-annex would crash
here.
Joey Hess [Thu, 26 Sep 2024 16:26:47 +0000 (12:26 -0400)]
sim: document interruption and concurrency issues
Does not seem worth doing a lot of locking and detection of these
problems.
Joey Hess [Thu, 26 Sep 2024 16:20:37 +0000 (12:20 -0400)]
sim: Add metadata command
Only really needed for completeness, preferred content expressions can
match against metadata.
Joey Hess [Wed, 25 Sep 2024 18:54:55 +0000 (14:54 -0400)]
heading
Joey Hess [Wed, 25 Sep 2024 18:54:21 +0000 (14:54 -0400)]
remove example, which didn't format right in mdwn
Joey Hess [Wed, 25 Sep 2024 18:53:46 +0000 (14:53 -0400)]
formatting
Joey Hess [Wed, 25 Sep 2024 18:50:17 +0000 (14:50 -0400)]
formatting
Joey Hess [Wed, 25 Sep 2024 18:49:48 +0000 (14:49 -0400)]
formatting
Joey Hess [Wed, 25 Sep 2024 18:47:32 +0000 (14:47 -0400)]
sim: support "--" as comment
Using this in my sim files that are also mdwn files to avoid comments
being displayed as headers.
Joey Hess [Wed, 25 Sep 2024 18:43:52 +0000 (14:43 -0400)]
preparing for release later this week
Joey Hess [Wed, 25 Sep 2024 18:42:27 +0000 (14:42 -0400)]
Merge branch 'sim'
Joey Hess [Wed, 25 Sep 2024 18:41:23 +0000 (14:41 -0400)]
export only the parts of aeson that are used
Rather than hiding things not wanted. This fixes a build warning with
aeson-2.2.3 which no longer has a json function.
Joey Hess [Wed, 25 Sep 2024 18:26:32 +0000 (14:26 -0400)]
update
Joey Hess [Wed, 25 Sep 2024 18:23:04 +0000 (14:23 -0400)]
fix tab damage that broke examples formatting in man page
When did vim default to expandtabs for mdwn? No.
Joey Hess [Wed, 25 Sep 2024 18:06:41 +0000 (14:06 -0400)]
support simulating clusters
Without actually simulating cluster implementation at all. Instead, only
the essential fact that cluster gateways know what changes they have
made to each node of a cluster. That is enough for sims like
sizebalanced_cluster.
Joey Hess [Wed, 25 Sep 2024 16:58:26 +0000 (12:58 -0400)]
design for simulating clusters w/o simulating cluster gateways
Joey Hess [Wed, 25 Sep 2024 16:11:03 +0000 (12:11 -0400)]
Revert "sim: add commands for cluster management"
This reverts commit
344141da63a9f6c46b63a52a116c9757fcf80110.
Rethinking this
Joey Hess [Wed, 25 Sep 2024 16:10:55 +0000 (12:10 -0400)]
update
Joey Hess [Wed, 25 Sep 2024 15:07:58 +0000 (11:07 -0400)]
sim: add commands for cluster management
Clusters are not actually simulated yet.
nobodyinperson [Wed, 25 Sep 2024 09:25:42 +0000 (09:25 +0000)]
Added a comment: Re: default preferred content
nadir [Wed, 25 Sep 2024 06:41:27 +0000 (06:41 +0000)]
Joey Hess [Tue, 24 Sep 2024 20:46:09 +0000 (16:46 -0400)]
sim: quiesce before freezing or ending
Probably a good idea for freezing, but especially I hope this fixes a
problem with git-annex sim run that caused it to sometimes crash in
removeDirectoryRecursive with directory not empty, presumably because a
thread was writing there at the same time.
Joey Hess [Tue, 24 Sep 2024 16:01:54 +0000 (12:01 -0400)]
sim: added run subcommand
And a nice sim of random preferred content expressions.
Joey Hess [Tue, 24 Sep 2024 15:47:20 +0000 (11:47 -0400)]
sim: add stepstable
Joey Hess [Tue, 24 Sep 2024 15:23:23 +0000 (11:23 -0400)]
sim: random preferred content expression generation
Joey Hess [Tue, 24 Sep 2024 14:07:09 +0000 (10:07 -0400)]
prevent action or step from simulating running on a special remote
Without any connections, the step command will not try to do any actions
on a special remote.
But even without any connections, it's still possible for a drop action
explicitly run "on" the special remote to do, when numcopies = 0 or
there is a trusted repo. So guard all actions against running on a
special remote too.
Joey Hess [Tue, 24 Sep 2024 14:00:38 +0000 (10:00 -0400)]
fix state overwrite bug
I have needed to excercise a lot of care in threading st through, and I
got it wrong here. Probably using a state monad would be a good idea.
adehnert [Tue, 24 Sep 2024 00:02:21 +0000 (00:02 +0000)]
Added a comment: Settable default preferred content?
Joey Hess [Mon, 23 Sep 2024 20:05:11 +0000 (16:05 -0400)]
update test case for bug
after recent changes broke the test case
the other bug I cannot reproduce though
Joey Hess [Mon, 23 Sep 2024 20:02:39 +0000 (16:02 -0400)]
oops
Joey Hess [Mon, 23 Sep 2024 19:50:47 +0000 (15:50 -0400)]
sim: avoid step looking for new actions every time
Once it has a list of actions, it can perform them all.
A disappointing optimisation at least in my test case, which it sped up
by less than 1 second out of 12. But still it did make it faster.
Joey Hess [Mon, 23 Sep 2024 19:27:45 +0000 (15:27 -0400)]
sped up sim step by about 200%
Noticed that it was quite slow compared with things like action
sendwanted. Guessed that the slowdown is largely due to every step
doing a simulated git pull/push.
So, rather than always doing a pull/push, only do those when no actions
are found without doing a pull/push.
This does mean that step will sometimes experience a split brain
situation, but that seems like a good thing? Because step ought to
explore as many possible scenarios as it reasonably can.
Joey Hess [Mon, 23 Sep 2024 19:04:52 +0000 (15:04 -0400)]
added sim of sizebalanced in a splitbrain situation
Joey Hess [Mon, 23 Sep 2024 19:04:33 +0000 (15:04 -0400)]
allow complex shell commands
Joey Hess [Mon, 23 Sep 2024 18:30:18 +0000 (14:30 -0400)]
fix sizebalanced empty size bug
Fix bug that prevented anything being stored in an empty repository whose
preferred content expression uses sizebalanced.
Joey Hess [Mon, 23 Sep 2024 17:43:55 +0000 (13:43 -0400)]
adds sims collection
Joey Hess [Mon, 23 Sep 2024 17:09:35 +0000 (13:09 -0400)]
sim visit as first-class command
Allows using it in a sim file.
Joey Hess [Mon, 23 Sep 2024 16:28:18 +0000 (12:28 -0400)]
sim: Fix size tracking for balanced preferred content
Joey Hess [Mon, 23 Sep 2024 13:38:56 +0000 (09:38 -0400)]
update
AaronBrooks [Sun, 22 Sep 2024 22:21:32 +0000 (22:21 +0000)]
removed
AaronBrooks [Sun, 22 Sep 2024 22:21:05 +0000 (22:21 +0000)]
Added a comment: reinject files -- more efficiently
AaronBrooks [Sun, 22 Sep 2024 22:19:13 +0000 (22:19 +0000)]
Added a comment: reinject files -- more efficiently
Joey Hess [Fri, 20 Sep 2024 22:11:37 +0000 (18:11 -0400)]
sim: fix state loss bug
Joey Hess [Fri, 20 Sep 2024 20:53:40 +0000 (16:53 -0400)]
puzzling bug
Joey Hess [Fri, 20 Sep 2024 20:52:17 +0000 (16:52 -0400)]
invalidate caches after log changes
This seems like something Annex.Sim would need to happen. And generally
a really good idea.
Joey Hess [Fri, 20 Sep 2024 19:45:05 +0000 (15:45 -0400)]
avoid adding redundant present/notpresent to sim history
Joey Hess [Fri, 20 Sep 2024 19:39:52 +0000 (15:39 -0400)]
bugfixes
sim stabilization works now
Joey Hess [Fri, 20 Sep 2024 19:21:18 +0000 (15:21 -0400)]
sim: better step
On each step, find all the actions that could be done, and pick one of them
to do.
Should detect stability, but that is broken.
Joey Hess [Fri, 20 Sep 2024 19:11:55 +0000 (15:11 -0400)]
set simRootDirectory on restore
It's a relative directory and the cwd may be different. Or the repo
could have been moved.
Joey Hess [Fri, 20 Sep 2024 18:57:55 +0000 (14:57 -0400)]
remove sim log file
Joey Hess [Fri, 20 Sep 2024 15:59:35 +0000 (11:59 -0400)]
update
Joey Hess [Fri, 20 Sep 2024 15:26:40 +0000 (11:26 -0400)]
update
Joey Hess [Fri, 20 Sep 2024 15:05:57 +0000 (11:05 -0400)]
update
Joey Hess [Fri, 20 Sep 2024 14:34:52 +0000 (10:34 -0400)]
sim: implement addtree
Joey Hess [Wed, 18 Sep 2024 13:08:42 +0000 (09:08 -0400)]
comment
Joey Hess [Tue, 17 Sep 2024 18:39:53 +0000 (14:39 -0400)]
sim: tested concurrency over actions
This demonstrates concurrent behavior that looks right. And with a
random seed, the results are deterministic.
init foo
init bar
init backup
connect foo <-> bar
connect foo <-> backup
addmulti 10 testfiles 1mb 1gb foo backup
action foo gitpull backup
wanted foo nothing
wanted bar anything
wanted backup anything
action bar gitpull foo
action foo dropunwanted while action bar getwanted foo
Joey Hess [Tue, 17 Sep 2024 18:29:49 +0000 (14:29 -0400)]
sim: fix get bug
When getting from a remote, have to check that the repo doing the
getting thinks the remote contains the key, but also that the remote
actually does. Before this bug fix, it would get from a repo that used
to have the key, but that had dropped it since the last git pull.
Joey Hess [Tue, 17 Sep 2024 17:49:50 +0000 (13:49 -0400)]
record initial seed in sim log
Unless the log starts with a command that records a seed.
Joey Hess [Tue, 17 Sep 2024 17:43:11 +0000 (13:43 -0400)]
git-annex sim log
Joey Hess [Tue, 17 Sep 2024 17:35:27 +0000 (13:35 -0400)]
sim: implement dropunwantedfrom