git-annex.git
23 months agosped up sim step by about 200%
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.

23 months agoadded sim of sizebalanced in a splitbrain situation
Joey Hess [Mon, 23 Sep 2024 19:04:52 +0000 (15:04 -0400)]
added sim of sizebalanced in a splitbrain situation

23 months agoallow complex shell commands
Joey Hess [Mon, 23 Sep 2024 19:04:33 +0000 (15:04 -0400)]
allow complex shell commands

23 months agofix sizebalanced empty size bug
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.

23 months agoadds sims collection
Joey Hess [Mon, 23 Sep 2024 17:43:55 +0000 (13:43 -0400)]
adds sims collection

23 months agosim visit as first-class command
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.

23 months agosim: Fix size tracking for balanced preferred content
Joey Hess [Mon, 23 Sep 2024 16:28:18 +0000 (12:28 -0400)]
sim: Fix size tracking for balanced preferred content

23 months agoupdate
Joey Hess [Mon, 23 Sep 2024 13:38:56 +0000 (09:38 -0400)]
update

23 months agosim: fix state loss bug
Joey Hess [Fri, 20 Sep 2024 22:11:37 +0000 (18:11 -0400)]
sim: fix state loss bug

23 months agopuzzling bug
Joey Hess [Fri, 20 Sep 2024 20:53:40 +0000 (16:53 -0400)]
puzzling bug

23 months agoinvalidate caches after log changes
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.

23 months agoavoid adding redundant present/notpresent to sim history
Joey Hess [Fri, 20 Sep 2024 19:45:05 +0000 (15:45 -0400)]
avoid adding redundant present/notpresent to sim history

23 months agobugfixes
Joey Hess [Fri, 20 Sep 2024 19:39:52 +0000 (15:39 -0400)]
bugfixes

sim stabilization works now

23 months agosim: better step
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.

23 months agoset simRootDirectory on restore
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.

23 months agoremove sim log file
Joey Hess [Fri, 20 Sep 2024 18:57:55 +0000 (14:57 -0400)]
remove sim log file

23 months agoupdate
Joey Hess [Fri, 20 Sep 2024 15:59:35 +0000 (11:59 -0400)]
update

23 months agoupdate
Joey Hess [Fri, 20 Sep 2024 15:26:40 +0000 (11:26 -0400)]
update

23 months agoupdate
Joey Hess [Fri, 20 Sep 2024 15:05:57 +0000 (11:05 -0400)]
update

23 months agosim: implement addtree
Joey Hess [Fri, 20 Sep 2024 14:34:52 +0000 (10:34 -0400)]
sim: implement addtree

23 months agosim: tested concurrency over actions
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

23 months agosim: fix get bug
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.

23 months agorecord initial seed in sim log
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.

23 months agogit-annex sim log
Joey Hess [Tue, 17 Sep 2024 17:43:11 +0000 (13:43 -0400)]
git-annex sim log

23 months agosim: implement dropunwantedfrom
Joey Hess [Tue, 17 Sep 2024 17:35:27 +0000 (13:35 -0400)]
sim: implement dropunwantedfrom

23 months agofix ActionDropUnwanted
Joey Hess [Tue, 17 Sep 2024 15:55:57 +0000 (11:55 -0400)]
fix ActionDropUnwanted

Now tested working

23 months agosim: add missing parser for action sendwanted
Joey Hess [Tue, 17 Sep 2024 15:40:40 +0000 (11:40 -0400)]
sim: add missing parser for action sendwanted

23 months agosim: fix changing settings bug
Joey Hess [Tue, 17 Sep 2024 15:37:25 +0000 (11:37 -0400)]
sim: fix changing settings bug

23 months agoaddmulti
Joey Hess [Tue, 17 Sep 2024 15:19:59 +0000 (11:19 -0400)]
addmulti

23 months agomove pull/push/sync into getSimActionComponents
Joey Hess [Tue, 17 Sep 2024 14:50:25 +0000 (10:50 -0400)]
move pull/push/sync into getSimActionComponents

As well as being a more pleasing implementation than I managed
yesterday, this allows for those actions to be run concurrently in the
sim.

23 months agosim concurrency
Joey Hess [Tue, 17 Sep 2024 13:33:55 +0000 (09:33 -0400)]
sim concurrency

23 months agoadd
Joey Hess [Tue, 17 Sep 2024 12:31:55 +0000 (08:31 -0400)]
add

23 months agoimplement ActionPull/Pull/Sync
Joey Hess [Mon, 16 Sep 2024 20:58:03 +0000 (16:58 -0400)]
implement ActionPull/Pull/Sync

Somewhat unsatisfying implementation, but all the alternatives were
worse.

23 months agosim: add action repo sync command
Joey Hess [Mon, 16 Sep 2024 20:48:21 +0000 (16:48 -0400)]
sim: add action repo sync command

23 months agosim command fixes
Joey Hess [Thu, 12 Sep 2024 20:39:44 +0000 (16:39 -0400)]
sim command fixes

23 months agogit-annex sim command is working
Joey Hess [Thu, 12 Sep 2024 20:07:44 +0000 (16:07 -0400)]
git-annex sim command is working

Had to add Read instances to Key and NumCopies and some other similar
types. I only expect to use those in serializing a sim. Of course, this
risks that implementation changes break reading old data. For a sim,
that would not be a big problem.

23 months agoimplemented ActionDropUnwanted
Joey Hess [Thu, 12 Sep 2024 14:44:31 +0000 (10:44 -0400)]
implemented ActionDropUnwanted

Not tested yet. This emulates the same checking that is done when
dropping. Note that when dropping from a special remote it is not able
to make a locked copy.

23 months agoconvert simRepoState to use UUID as key
Joey Hess [Thu, 12 Sep 2024 14:08:50 +0000 (10:08 -0400)]
convert simRepoState to use UUID as key

23 months agofully preserve input format of connect and disconnect commands
Joey Hess [Thu, 12 Sep 2024 01:00:51 +0000 (21:00 -0400)]
fully preserve input format of connect and disconnect commands

Just lifted the sim file as a DSL into the type level for that.

23 months agosim file parser and generator
Joey Hess [Wed, 11 Sep 2024 19:59:13 +0000 (15:59 -0400)]
sim file parser and generator

The generator doesn't emit the best possible connect commands,
but it does output something valid. Eg, an input like:

connect A <-> B <-> C <-> D

becomes:

connect A <-> B <-> C
connect C <-> D

Also:

connect A -> B <- C

becomes:

connect A -> B
connect C -> B

Which could be improved.

Also disconnect commands are not prettified at all, but probably there's
no reason to.

23 months agostarted on sim file parser
Joey Hess [Wed, 11 Sep 2024 15:53:25 +0000 (11:53 -0400)]
started on sim file parser

23 months agoimplemented ActionSendWanted
Joey Hess [Wed, 11 Sep 2024 15:04:48 +0000 (11:04 -0400)]
implemented ActionSendWanted

The simulation is nearly finished. Only CommandAddTree and dropping
remain to do.

23 months agoActionGetWanted working
Joey Hess [Wed, 11 Sep 2024 14:32:04 +0000 (10:32 -0400)]
ActionGetWanted working

The sim is now basically working!

23 months agosim: implement ActionGitPush and ActionGitPull
Joey Hess [Tue, 10 Sep 2024 19:37:55 +0000 (15:37 -0400)]
sim: implement ActionGitPush and ActionGitPull

These don't actually need to do any git actions, instead they just merge
the simLocations.

Had to make simLocations use a vector clock, because it is possible for
two simulated repositories to end up with different opinions about the
location of a key. Just like with real git-annex, whichever location
change was made most recently wins out.

The vector clock is simply advanced each time the simulation is run for
a step. Since there is no real parallelism in the sim, that's
sufficient.

23 months agoimplement randomAction
Joey Hess [Mon, 9 Sep 2024 21:20:13 +0000 (17:20 -0400)]
implement randomAction

23 months agoimplement CommandStep
Joey Hess [Mon, 9 Sep 2024 21:04:32 +0000 (17:04 -0400)]
implement CommandStep

and record each SimCommand in simHistory, except for CommandStep where
instead the actions that are generated are recorded.

23 months agoadd action command to git-annex sim
Joey Hess [Mon, 9 Sep 2024 20:06:45 +0000 (16:06 -0400)]
add action command to git-annex sim

step just picks a random action, and this allows finer control over what
happens in the sim

23 months agoset location logs in simulated repos
Joey Hess [Mon, 9 Sep 2024 18:52:24 +0000 (14:52 -0400)]
set location logs in simulated repos

23 months agofix removing simulated file
Joey Hess [Mon, 9 Sep 2024 18:07:52 +0000 (14:07 -0400)]
fix removing simulated file

23 months agocreate simulated files
Joey Hess [Mon, 9 Sep 2024 15:28:30 +0000 (11:28 -0400)]
create simulated files

23 months agoset descriptions for all simulated repos
Joey Hess [Mon, 9 Sep 2024 15:06:42 +0000 (11:06 -0400)]
set descriptions for all simulated repos

23 months agosimulated repository construction working
Joey Hess [Mon, 9 Sep 2024 14:59:01 +0000 (10:59 -0400)]
simulated repository construction working

23 months agofinish updateSimRepoState
Joey Hess [Mon, 9 Sep 2024 13:35:42 +0000 (09:35 -0400)]
finish updateSimRepoState

Converted maps to use UUID as key.

Also added mincopies to the sim.

23 months agomaxsize of 0 to disable
Joey Hess [Mon, 9 Sep 2024 13:32:43 +0000 (09:32 -0400)]
maxsize of 0 to disable

2 years agoimplemented cloneSimRepo
Joey Hess [Fri, 6 Sep 2024 18:23:29 +0000 (14:23 -0400)]
implemented cloneSimRepo

Started on updateSimRepoState

2 years agomore work on applySimCommand
Joey Hess [Fri, 6 Sep 2024 16:53:51 +0000 (12:53 -0400)]
more work on applySimCommand

When using an existing repo, copy over all of its config into the sim.

Added CommandTrustLevel.

Start at creating a git clone for a simulated repo, but it's not done
yet.

2 years agorethought sim a bit
Joey Hess [Fri, 6 Sep 2024 16:53:20 +0000 (12:53 -0400)]
rethought sim a bit

2 years agoprevent overwriting a repo in the simulation
Joey Hess [Thu, 5 Sep 2024 20:22:08 +0000 (16:22 -0400)]
prevent overwriting a repo in the simulation

2 years agoalmost finished with applySimCommand
Joey Hess [Thu, 5 Sep 2024 19:22:41 +0000 (15:22 -0400)]
almost finished with applySimCommand

Added checks that repo names are ones that have been added to the sim.

Implemented preferred content etc setting. It does not need to parse the
expression in applySimCommand, instead that can be done when running the
sim. This keeps it pure.

But, it can't be entirely pure because of CommandAddTree. So made it
return an Annex action when necessary.

Moved makeMatcher into Annex.FileMatcher in preparation for using it,
but it's not used yet. Also moved checkPreferredContentExpression.

2 years agoimplement CommandUse in Annex.Sim
Joey Hess [Thu, 5 Sep 2024 14:50:04 +0000 (10:50 -0400)]
implement CommandUse in Annex.Sim

Refactored Remote to keep it pure.

2 years agostarted Annex.Sim
Joey Hess [Wed, 4 Sep 2024 19:10:39 +0000 (15:10 -0400)]
started Annex.Sim

Have most of the sim command handler, but to keep it pure while implementing
the rest will need some refactoring.

It seems likely that running the simulation itself will not be able to be
entirely pure. Preferred content evaluation runs in Annex after all.

Note that the somewhat awkward randomWords is because the i386ancient
build depends on a version of random too old to support generating a
random ByteString on its own.

2 years agodocumentation for git-annex sim
Joey Hess [Wed, 4 Sep 2024 19:03:17 +0000 (15:03 -0400)]
documentation for git-annex sim

command not implemented yet

2 years agoupdate
Joey Hess [Tue, 3 Sep 2024 18:24:32 +0000 (14:24 -0400)]
update

2 years agosim design
Joey Hess [Tue, 3 Sep 2024 18:23:48 +0000 (14:23 -0400)]
sim design

2 years agocorrect comment
Joey Hess [Tue, 3 Sep 2024 18:23:32 +0000 (14:23 -0400)]
correct comment

This is not related to v5 versus newer versions.

2 years agofix typo
Joey Hess [Tue, 3 Sep 2024 18:23:14 +0000 (14:23 -0400)]
fix typo

2 years agotreat "not present" in preferred content as invalid
Joey Hess [Tue, 3 Sep 2024 17:49:34 +0000 (13:49 -0400)]
treat "not present" in preferred content as invalid

Detect when a preferred content expression contains "not present", which
would lead to repeatedly getting and then dropping files, and make it never
match. This also applies to "not balanced" and "not sizebalanced".

--explain will tell the user when this happens

Note that getMatcher calls matchMrun' and does not check for unstable
negated limits. While there is no --present anyway, if there was,
it would not make sense for --not --present to complain about
instability and fail to match.

2 years agoFix --debug display of onlyingroup preferred content expression.
Joey Hess [Tue, 3 Sep 2024 16:38:59 +0000 (12:38 -0400)]
Fix --debug display of onlyingroup preferred content expression.

2 years agoupdate
Joey Hess [Tue, 3 Sep 2024 15:52:54 +0000 (11:52 -0400)]
update

2 years ago2 level toc
Joey Hess [Mon, 2 Sep 2024 20:32:28 +0000 (16:32 -0400)]
2 level toc

2 years agoMerge branch 'master' of ssh://git-annex.branchable.com
Joey Hess [Mon, 2 Sep 2024 20:31:31 +0000 (16:31 -0400)]
Merge branch 'master' of ssh://git-annex.branchable.com

2 years agofix number of headers
Joey Hess [Mon, 2 Sep 2024 20:31:03 +0000 (16:31 -0400)]
fix number of headers

2 years ago(no commit message)
lucas.gautheron@f2b5c93a64b028c1ec8698b9c2412ed51ff22040 [Mon, 2 Sep 2024 15:12:02 +0000 (15:12 +0000)]

2 years ago(no commit message)
lucas.gautheron@f2b5c93a64b028c1ec8698b9c2412ed51ff22040 [Mon, 2 Sep 2024 15:08:25 +0000 (15:08 +0000)]

2 years agoadd news item for git-annex 10.20240831
Joey Hess [Sat, 31 Aug 2024 23:50:36 +0000 (19:50 -0400)]
add news item for git-annex 10.20240831

2 years agoreleasing package git-annex version 10.20240831
Joey Hess [Sat, 31 Aug 2024 23:50:26 +0000 (19:50 -0400)]
releasing package git-annex version 10.20240831

2 years agouse Utility.PID
Joey Hess [Fri, 30 Aug 2024 18:56:38 +0000 (14:56 -0400)]
use Utility.PID

fixes build on i386ancient

2 years agofix liveupdate locking
Joey Hess [Fri, 30 Aug 2024 18:49:18 +0000 (14:49 -0400)]
fix liveupdate locking

This fixes the build on windows.

Changed it to use lock pools, which will behave better if two threads
call getLiveRepoSizes at the same time.

Also this should make it work when annex.pidlock is set. In that case,
once the current process locks this file, or anything, any other process
will have to wait on the pid lock. So checkStaleSizeChanges will
correctly identify any other live changes in the database as stale,
since there can only be one git-annex process running.

2 years agofix paste oops
Joey Hess [Fri, 30 Aug 2024 18:35:05 +0000 (14:35 -0400)]
fix paste oops

Wow, I pasted a big thing into entirely the wrong file, but it was in a
comment so it compiled anyway.

2 years agomention sizebalanced as well as balanced
Joey Hess [Fri, 30 Aug 2024 16:06:45 +0000 (12:06 -0400)]
mention sizebalanced as well as balanced

2 years agoavoid locking the journal in readonly repository
Joey Hess [Fri, 30 Aug 2024 15:58:10 +0000 (11:58 -0400)]
avoid locking the journal in readonly repository

The test suite flagged that git-annex info in a readonly repository was
no longer working.

.git/annex/journal.lck: openFd: permission denied

This fixes it, however, in a case where .git/annex/reposize/ is
writable, but .git/annex/journal/ is not, there will still be a
permission denied error. The solution would just be to use consistent
permissions I suppose.

2 years agoupdate
Joey Hess [Fri, 30 Aug 2024 15:14:45 +0000 (11:14 -0400)]
update

2 years agodocument using balanced preferred content in a cluster
Joey Hess [Fri, 30 Aug 2024 15:08:32 +0000 (11:08 -0400)]
document using balanced preferred content in a cluster

2 years agoMerge branch 'master' into balanced
Joey Hess [Fri, 30 Aug 2024 15:01:39 +0000 (11:01 -0400)]
Merge branch 'master' into balanced

2 years agolookupkey: Allow using --ref in a bare repository.
Joey Hess [Fri, 30 Aug 2024 14:48:10 +0000 (10:48 -0400)]
lookupkey: Allow using --ref in a bare repository.

2 years agoAdded a comment
yarikoptic [Thu, 29 Aug 2024 18:35:47 +0000 (18:35 +0000)]
Added a comment

2 years agoerr on the side of larger repository size
Joey Hess [Wed, 28 Aug 2024 18:13:12 +0000 (14:13 -0400)]
err on the side of larger repository size

When a live update is removing a key, it might fail. So only count those
once they have succeeded. When a live update is adding a key, count it
immediately to avoid over-filling a repo.

This also makes the 1 minute delay between stale live changes checks
more defensible, because a stale live change can only cause us to err
more on the side of caution.

2 years agoremove stale live changes from reposize database
Joey Hess [Wed, 28 Aug 2024 17:52:59 +0000 (13:52 -0400)]
remove stale live changes from reposize database

Reorganized the reposize database directory, and split up a column.

checkStaleSizeChanges needs to run before needLiveUpdate,
otherwise the process won't be holding a lock on its pid file, and
another process could go in and expire the live update it records. It
just so happens that they do get called in the correct order, since
checking balanced preferred content calls getLiveRepoSizes before
needLiveUpdate.

The 1 minute delay between checks is arbitrary, but will avoid excess
work. The downside of it is that, if a process is dropping a file and
gets interrupted, for 1 minute another process can expect a repository
will soon be smaller than it is. And so a process might send data to a
repository when a file is not really going to be dropped from it. But
note that can already happen if a drop takes some time in eg locking and
then fails. So it seems possible that live updates should only be
allowed to increase, rather than decrease the size of a repository.

2 years agocombine 2 queries
Joey Hess [Wed, 28 Aug 2024 15:00:59 +0000 (11:00 -0400)]
combine 2 queries

2 years agoavoid reposize database locking overhead when not needed
Joey Hess [Wed, 28 Aug 2024 14:52:34 +0000 (10:52 -0400)]
avoid reposize database locking overhead when not needed

Only when the preferred content expression being matched uses balanced
preferred content is this overhead needed.

It might be possible to eliminate the locking entirely. Eg, check the
live changes before and after the action and re-run if they are not
stable. For now, this is good enough, it avoids existing preferred
content getting slow. If balanced preferred content turns out to be too
slow to check, that could be tried later.

2 years agoAdded a comment
matrss [Wed, 28 Aug 2024 14:11:36 +0000 (14:11 +0000)]
Added a comment

2 years agoAdded a comment: Needed to retrieve single file metadata from bare repo
mih [Wed, 28 Aug 2024 13:58:30 +0000 (13:58 +0000)]
Added a comment: Needed to retrieve single file metadata from bare repo

2 years agoAdded a comment
matrss [Wed, 28 Aug 2024 08:47:33 +0000 (08:47 +0000)]
Added a comment

2 years agofix a deadlock when not using --auto
Joey Hess [Tue, 27 Aug 2024 19:47:57 +0000 (15:47 -0400)]
fix a deadlock when not using --auto

Live update never gets started, but then it still waited for it to
finish.

This only deadlocked with -J4 or so, not without -J. Unsure why.

2 years agoavoid nub
Joey Hess [Tue, 27 Aug 2024 19:00:10 +0000 (15:00 -0400)]
avoid nub

There will not usually be many live changes, but usually does not mean
ever, and O(N^2) is best avoided.

2 years agothoughts
Joey Hess [Tue, 27 Aug 2024 18:59:13 +0000 (14:59 -0400)]
thoughts

2 years agolocking in checkLiveUpdate
Joey Hess [Tue, 27 Aug 2024 17:07:06 +0000 (13:07 -0400)]
locking in checkLiveUpdate

This makes sure that two threads don't check balanced preferred content at the
same time, so each thread always sees a consistent picture of what is
happening.

This does add a fairly expensive file level lock to every check of
preferred content, in commands that use prepareLiveUpdate. It would
be good to only do that when live updates are actually needed, eg when
the preferred content expression uses balanced preferred content.

2 years agoclosing in on finishing live reposizes
Joey Hess [Tue, 27 Aug 2024 15:04:27 +0000 (11:04 -0400)]
closing in on finishing live reposizes

Fixed successfullyFinishedLiveSizeChange to not update the rolling total
when a redundant change is in RecentChanges.

Made setRepoSizes clear RecentChanges that are no longer needed.
It might be possible to clear those earlier, this is only a convenient
point to do it.

The reason it's safe to clear RecentChanges here is that, in order for a
live update to call successfullyFinishedLiveSizeChange, a change must be
made to a location log. If a RecentChange gets cleared, and just after
that a new live update is started, making the same change, the location
log has already been changed (since the RecentChange exists), and
so when the live update succeeds, it won't call
successfullyFinishedLiveSizeChange. The reason it doesn't
clear RecentChanges when there is a reduntant live update is because
I didn't want to think through whether or not all races are avoided in
that case.

The rolling total in SizeChanges is never cleared. Instead,
calcJournalledRepoSizes gets the initial value of it, and then
getLiveRepoSizes subtracts that initial value from the current value.
Since the rolling total can only be updated by updateRepoSize,
which is called with the journal locked, locking the journal in
calcJournalledRepoSizes ensures that the database does not change while
reading the journal.

2 years agouse live reposizes in balanced preferred content
Joey Hess [Tue, 27 Aug 2024 14:17:43 +0000 (10:17 -0400)]
use live reposizes in balanced preferred content

2 years agofixed the build
Joey Hess [Tue, 27 Aug 2024 13:18:25 +0000 (09:18 -0400)]
fixed the build

Manually tested getLiveRepoSizes and it is working correctly.