Joey Hess [Thu, 15 Aug 2024 15:50:01 +0000 (11:50 -0400)]
finalize RepoSize database
Including locking on creation, handling of permissions errors, and
setting repo sizes.
I'm confident that locking is not needed while using this database.
Since writes happen in a single transaction. When there are two writers
that are recording sizes based on different git-annex branch commits,
one will overwrite what the other one recorded. Which is fine, it's only
necessary that the database stays consistent with the content of a
git-annex branch commit.
Joey Hess [Wed, 14 Aug 2024 20:04:18 +0000 (16:04 -0400)]
slightly improve hairy types
Joey Hess [Wed, 14 Aug 2024 17:46:44 +0000 (13:46 -0400)]
implement journalledRepoSizes
Plan is to run this when populating Annex.reposizes on demand.
So Annex.reposizes will be up-to-date with the journal, including
crucially journal entries for private repositories. But also
anything that has been written to the journal by another process,
especially if the process was ran with annex.alwayscommit=false.
From there, Annex.reposizes can be kept up to date with changes made
by the running process.
Joey Hess [Wed, 14 Aug 2024 07:19:30 +0000 (03:19 -0400)]
calcBranchRepoSizes without journal files
This will be used to prime the RepoSizes database, which will always
contain values that correpond to information in the git-annex branch, so
without anything from journal files.
Factored out overJournalFileContents which will later be used to
update Annex.reposizes to include information from journal files.
This will be partitcularly important to support private UUIDs which only
ever get to journal files and not to the branch.
Joey Hess [Tue, 13 Aug 2024 19:13:30 +0000 (15:13 -0400)]
plan
Joey Hess [Tue, 13 Aug 2024 19:05:49 +0000 (15:05 -0400)]
improve haddocks
Joey Hess [Tue, 13 Aug 2024 18:15:43 +0000 (14:15 -0400)]
avoid changing git-annex info behavior
5afbea25e7751a8841ac42db3822b81ea68f31c1 changed it to ignore journal
files that did not correspond to a key in the git-annex branch. However,
when there is a private journal, that can happen.
Neither behavior is fully correct, so keep the old incorrect behavior
rather than introducing a new differently incorrect behavior.
I plan to eventually make git-annex info use Annex.reposizes instead of
calculating it itself, and once Annex.reposizes handles this all
correctly, this will be a moot problem.
Joey Hess [Tue, 13 Aug 2024 18:14:47 +0000 (14:14 -0400)]
update
Joey Hess [Tue, 13 Aug 2024 17:46:47 +0000 (13:46 -0400)]
take all repository locations into account for balancing
This fully fixes --rebalance stability, and also deals with an issue
where a file is present in each balanced repository and it didn't want
to remove it from any.
Joey Hess [Tue, 13 Aug 2024 17:32:11 +0000 (13:32 -0400)]
fixed --rebalance stability on drop
Was checking the wrong uuid, oops
Joey Hess [Tue, 13 Aug 2024 17:23:39 +0000 (13:23 -0400)]
avoid counting size of keys that are in the journal twice
In calcRepoSizes and also git-annex info, when a key was in the journal,
it was passed to the callback twice, so the calculated size was wrong.
Joey Hess [Tue, 13 Aug 2024 16:42:04 +0000 (12:42 -0400)]
improve handling of unmerged git-annex branches in readonly repo
git-annex info was displaying a message that didn't make sense in
context.
In calcRepoSizes, it seems better to return the information from the
git-annex branch, rather than giving up. Especially since balanced
preferred content uses it, and we can't just give up evaluating a
preferred content expression if git-annex is to be usable in such a
readonly repo.
Commit
6d7ecd9e5d1571d1dc7e59106f848abccdf7fd0e nobly wanted git-annex
to behave the same with such unmerged branches as it does when it can
merge them. But for the purposes of preferred content, it seems to me
there's a sense that such an unmerged branch is the same as a remote we
have not pulled from. The balanced preferred content will either way
operate under outdated information, and so make not the best choices.
Joey Hess [Tue, 13 Aug 2024 15:47:37 +0000 (11:47 -0400)]
fix typo
Joey Hess [Tue, 13 Aug 2024 15:00:20 +0000 (11:00 -0400)]
take maxsize into account for balanced preferred content
This is very innefficient, it will need to be optimised not to
calculate the sizes of repos every time.
Also, fixed a bug in balancedPicker that caused it to pick a too high
index when some repos were excluded due to being full.
Joey Hess [Mon, 12 Aug 2024 22:57:03 +0000 (18:57 -0400)]
update
Joey Hess [Mon, 12 Aug 2024 22:50:58 +0000 (18:50 -0400)]
add
Joey Hess [Mon, 12 Aug 2024 15:56:52 +0000 (11:56 -0400)]
update
Joey Hess [Mon, 12 Aug 2024 15:19:58 +0000 (11:19 -0400)]
added reposize database
The idea is that upon a merge of the git-annex branch, or a commit to
the git-annex branch, the reposize database will be updated. So it
should always accurately reflect the location log sizes, but it will
often be behind the actual current sizes.
Annex.reposizes will start with the value from the database, and get
updated with each transfer, so it will reflect a process's best
understanding of the current sizes.
When there are multiple processes all transferring to the same repo,
Annex.reposize will not reflect transfers made by the other processes
since the current process started. So when using balanced preferred
content, it may make suboptimal choices, including trying to transfer
content to the repo when another process has already filled it up.
But this is the same as if there are multiple processes running on
ifferent machines, so is acceptable. The reposize will eventually
get an accurate value reflecting changes made by other processes or in
other repos.
Joey Hess [Mon, 12 Aug 2024 14:01:48 +0000 (10:01 -0400)]
update
Joey Hess [Mon, 12 Aug 2024 13:43:14 +0000 (09:43 -0400)]
idea
Joey Hess [Sun, 11 Aug 2024 19:41:26 +0000 (15:41 -0400)]
implement maxsize log and command
* maxsize: New command to tell git-annex how large the expected maximum
size of a repository is.
* vicfg: Include maxsize configuration.
Joey Hess [Sun, 11 Aug 2024 19:40:21 +0000 (15:40 -0400)]
add preciseSize
Joey Hess [Sun, 11 Aug 2024 18:37:18 +0000 (14:37 -0400)]
improve usage
Joey Hess [Sun, 11 Aug 2024 17:29:06 +0000 (13:29 -0400)]
more formal documentation of balancing
Joey Hess [Sat, 10 Aug 2024 20:32:54 +0000 (16:32 -0400)]
use hmac in balanced preferred content
This deals with the possible security problem that someone could make an
unusually low UUID and generate keys that are all constructed to hash to
a number that, mod the number of repositories in the group, == 0.
So balanced preferred content would always put those keys in the
repository with the low UUID as long as the group contains the
number of repositories that the attacker anticipated.
Presumably the attacker than holds the data for ransom? Dunno.
Anyway, the partial solution is to use HMAC (sha256) with all the UUIDs
combined together as the "secret", and the key as the "message". Now any
change in the set of UUIDs in a group will invalidate the attacker's
constructed keys from hashing to anything in particular.
Given that there are plenty of other things someone can do if they can
write to the repository -- including modifying preferred content so only
their repository wants files, and numcopies so other repositories drom
them -- this seems like safeguard enough.
Note that, in balancedPicker, combineduuids is memoized.
Joey Hess [Fri, 9 Aug 2024 20:57:10 +0000 (16:57 -0400)]
todo
Joey Hess [Fri, 9 Aug 2024 20:47:28 +0000 (16:47 -0400)]
todo
Joey Hess [Fri, 9 Aug 2024 18:46:08 +0000 (14:46 -0400)]
wrote git-annex maxsize man page
Joey Hess [Fri, 9 Aug 2024 18:22:05 +0000 (14:22 -0400)]
left off number option
Joey Hess [Fri, 9 Aug 2024 18:16:09 +0000 (14:16 -0400)]
balanced preferred content and --rebalance
This all works fine. But it doesn't check repository sizes yet, and
without repository size checking, once a repository gets full, there
will be no other repository that will want its files.
Use of sha2 seems unncessary, probably alder2 or md5 or crc would have
been enough. Possibly just summing up the bytes of the key mod the number
of repositories would have sufficed. But sha2 is there, and probably
hardware accellerated. I doubt very much there is any security benefit
to using it though. If someone wants to construct a key that will be
balanced onto a given repository, sha2 is certianly not going to stop
them.
Joey Hess [Thu, 8 Aug 2024 20:06:02 +0000 (16:06 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 19:54:22 +0000 (15:54 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 19:53:36 +0000 (15:53 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 19:52:52 +0000 (15:52 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 19:51:36 +0000 (15:51 -0400)]
update for exporttree=yes
Joey Hess [Thu, 8 Aug 2024 19:34:36 +0000 (15:34 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 19:31:57 +0000 (15:31 -0400)]
Merge branch 'exportreeplus'
Joey Hess [Thu, 8 Aug 2024 19:27:11 +0000 (15:27 -0400)]
add news item for git-annex 10.
20240808
Joey Hess [Thu, 8 Aug 2024 19:27:04 +0000 (15:27 -0400)]
releasing package git-annex version 10.
20240808
Joey Hess [Thu, 8 Aug 2024 19:25:08 +0000 (15:25 -0400)]
proxied importtree=yes remotes are untrustworthy
Even without exporttree=yes.
Joey Hess [Thu, 8 Aug 2024 19:13:12 +0000 (15:13 -0400)]
proxied exporttree=yes versionedexport=yes remotes are not untrusted
This removes versionedExport, which was only used by the S3 special
remote. Instead, versionedexport=yes is a common way for remotes to
indicate that they are versioned.
Joey Hess [Thu, 8 Aug 2024 18:43:53 +0000 (14:43 -0400)]
proxied exporttree=yes remotes are untrustworthy
This is not perfect because it does not handle versioned special
remotes, which should not be untrustworthy, but now are when proxied.
The implementation turned out to be easy, because the exporttree field
is a default field, so is available in RemoteConfig even for git
remotes.
Joey Hess [Thu, 8 Aug 2024 18:25:18 +0000 (14:25 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 18:05:05 +0000 (14:05 -0400)]
update
Joey Hess [Thu, 8 Aug 2024 18:03:02 +0000 (14:03 -0400)]
update export db after rename from annexobjects location
This allows git-annex post-receive, on the first push to
the remote to see that it is able to get a key from it in
order to upload it back.
Also avoided actively checking if the source remote contains a key.
The location log is good enough. If the location log is wrong,
the export of that file will fail with an informative message.
Joey Hess [Thu, 8 Aug 2024 16:28:12 +0000 (12:28 -0400)]
post-receive: use the exporttree=yes remote as a source
This handles cases where a single key is used by multiple files in the
exported tree. When using `git-annex push`, the key's content gets
stored in the annexobjects location, and then when the branch is pushed,
it gets renamed from the annexobjects location to the first exported
file. For subsequent exported files, a copy of the content needs to be
made. This causes it to download the key from the remote in order to
upload another copy to it.
This is not needed when using `git push` followed by `git-annex copy --to`
the proxied remote, because the received key is stored at all export
locations then.
Also, fixed handling of the synced branch push, it was exporting master
when synced/master was pushed.
Note that currently, the first push to the remote does not see that it
is able to get a key from it in order to upload it back. It displays
"(not available)". The second push is able to. Since git-annex push
pushes first the synced branch and then the branch, this does end up
with a full export being made, but it is not quite right.
Joey Hess [Thu, 8 Aug 2024 16:04:39 +0000 (12:04 -0400)]
export: Added --from option
This is similar to git-annex copy --from --to, in that it downloads a
local copy, locks it for removal, uploads it, and drops it. Removal of
the temporary local copy is done without verifying numcopies for the
same reason as that command.
I do wonder, looking at this, if there's a race where the local copy
gets used as a copy to allow some other drop in the narrow window after
it is downloaded and before it gets locked for removal. That would need
some other repository to have an out of date location log that says the
repository contains a copy of the key, in order for it to try to use it
as a copy. If there is such a race, git-annex copy/move would also be
vulnerable to it. It would be better to lock it for removal before
starting to download it! That is possible in v10 repositories, which do
use a separate content lock file.
Note that, when the exported tree contains several files that use the
same key, it will be downloaded repeatedly, once per time needed to
upload it. It would be possible to avoid that extra work, but it would
complicate this since the local copy would need to be preserved, locked
for removal, until the end. Also, that would mean that interrupting the
export would leave possibly a lot of temporarily downloaded keys in the
local repository, while currently it can only leave one.
Joey Hess [Thu, 8 Aug 2024 15:59:16 +0000 (11:59 -0400)]
avoid warning in startDispose
When a file never got exported to the remote, and is now being removed
from the exported tree, it tried to rename, which failed, and displayed
an ugly warning:
unexport d m8
rename failed (/home/joey/tmp/bench2/d/m8: renameFile:renamePath:rename: does not exist (No such file or directory)); deleting instead
ok
Joey Hess [Wed, 7 Aug 2024 17:11:06 +0000 (13:11 -0400)]
update proxied exporttree=yes remote on receive of sync branch
Since git-annex sync sends the sync branch first, and only displays the
output of the push to the sync branch, this makes git-annex
post-retrieve's output when updating the exported tree be visible when
syncing.
This also makes syncing with a non-bare repository still update the
exported tree, even when the checked out branch is not able to be
updated. The sync branch gets sent regardless.
Joey Hess [Wed, 7 Aug 2024 17:00:19 +0000 (13:00 -0400)]
avoid trying to export tree to proxied exporttree=yes remotes
This avoids a lot of ugly messages when syncing with such a remote.
The export tree happens on the proxy side.
Joey Hess [Wed, 7 Aug 2024 16:27:24 +0000 (12:27 -0400)]
updateproxy, updatecluster check annexobjects=yes
updateproxy, updatecluster: Prevent using an exporttree=yes special remote
that does not have annexobjects=yes, since it will not work.
Joey Hess [Wed, 7 Aug 2024 15:49:53 +0000 (11:49 -0400)]
update
Joey Hess [Wed, 7 Aug 2024 15:39:29 +0000 (11:39 -0400)]
comment
Joey Hess [Wed, 7 Aug 2024 15:28:21 +0000 (11:28 -0400)]
Merge branch 'master' into exportreeplus
Joey Hess [Wed, 7 Aug 2024 15:24:34 +0000 (11:24 -0400)]
catch ClientError from withClientM
When getting from a P2P HTTP remote, prompt for credentials when required,
instead of failing.
This feels like it might be a bug in servant-client. withClientM's type
suggests it would not throw a ClientError. But it does in this case.
Joey Hess [Wed, 7 Aug 2024 14:47:47 +0000 (10:47 -0400)]
comment
Joey Hess [Wed, 7 Aug 2024 13:38:15 +0000 (09:38 -0400)]
proxy stores received keys to known export locations
This handles the workflow where the branch is first pushed to the proxy,
and then files in the exported tree are later are copied to the proxied remote.
Turns out that the way the export log is structured, nothing needs
to be done to finalize the export once the last key is sent to it. Which
is great because that would have been a lot of complication. On
receiving the push, Command.Export runs and calls recordExportBeginning,
does as much as it can to update the export with the files currently
on it, and then calls recordExportUnderway. At that point, the
export.log records the export as "complete", but it's not really. And
that's fine. The same happens when using `git-annex export` when some
files are not available to send. Other repositories that have
access to the special remote can already retrieve files from it. As
the missing files get copied to the exported remote, all that needs
to be done is record each in the export db.
At this point, proxying to exporttree=yes annexobjects=yes special remotes
is fully working. Except for in the case where multiple files in the
tree use the same key, and the files are sent to the proxied remote
before pushing the tree.
It seems that even special remotes without annexobjects=yes will work if
used with the workflow where the git-annex branch is pushed before
copying files. But not with the `git-annex push` workflow.
matrss [Wed, 7 Aug 2024 12:12:29 +0000 (12:12 +0000)]
Yaroslav Halchenko [Mon, 5 Aug 2024 22:41:43 +0000 (18:41 -0400)]
Refresh standlone patch to avoid fuzz and offsets
Joey Hess [Tue, 6 Aug 2024 18:49:20 +0000 (14:49 -0400)]
remove unused imports
Joey Hess [Tue, 6 Aug 2024 18:46:56 +0000 (14:46 -0400)]
update
Joey Hess [Tue, 6 Aug 2024 18:46:33 +0000 (14:46 -0400)]
Merge branch 'master' into exportreeplus
Joey Hess [Tue, 6 Aug 2024 18:42:46 +0000 (14:42 -0400)]
fixed
Joey Hess [Tue, 6 Aug 2024 18:42:08 +0000 (14:42 -0400)]
Merge remote-tracking branch 'origin/master'
Joey Hess [Tue, 6 Aug 2024 18:38:45 +0000 (14:38 -0400)]
fix file corruption when proxying an upload to a special remote
The file corruption consists of each chunk of the file being duplicated.
Since chunks are typically a fixed size, it would certianly be possible
to get from a corrupted file back to the original file. But this is still
bad data loss.
Reversion was in commit
fcc052bed81dac5a7664b815e3a3cf1ffb1b1659.
Luckily that did not make the most recent release.
Joey Hess [Tue, 6 Aug 2024 18:18:30 +0000 (14:18 -0400)]
proxying to exporttree=yes annexobjects=yes basically working
It works when using git-annex sync/push/assist, or when manually sending
all content to the proxied remote before pushing to the proxy remote.
But when the push comes before the content is sent, sending content does
not update the exported tree.
Joey Hess [Tue, 6 Aug 2024 16:15:18 +0000 (12:15 -0400)]
refine
Joey Hess [Tue, 6 Aug 2024 15:45:45 +0000 (11:45 -0400)]
finalized design for proxying to exporttree=yes annexobjects=yes special remotes
Joey Hess [Tue, 6 Aug 2024 15:13:51 +0000 (11:13 -0400)]
update
matrss [Tue, 6 Aug 2024 12:44:18 +0000 (12:44 +0000)]
Spencer [Mon, 5 Aug 2024 22:17:55 +0000 (22:17 +0000)]
Added a comment: D: Correct
Joey Hess [Sun, 4 Aug 2024 16:18:17 +0000 (12:18 -0400)]
rename from annexobjects location on export
(When possible, of course it may not be there, or it may get renamed from
there for another exported file first. Or the remote may not support
renames.)
This will avoids redundant uploads.
An example case where this is important: Proxying to a exporttree remote,
a file is uploaded to it but is not yet in an exported tree. When the
exported tree is pushed, the remote needs to be updated by exporting to
it. In this case, the proxy doesn't have a copy of the file, so it would
need to download it from annexobjects before uploading it to the final
location. With this optimisation, it can just rename it.
However: If a key is used twice in an exported tree, it seems a proxy
will need to download and reupload anyway. Unless a copy operation is
added to exporttree remotes..
Joey Hess [Sun, 4 Aug 2024 15:58:07 +0000 (11:58 -0400)]
rename to annexobjects location on unexport
This avoids needing to re-upload the file again to get it to the
annexobjects location, which git-annex sync was doing when it was
preferred content.
If the file is not preferred content, sync will drop it from the
annexobjects location.
If the file has been deleted from the tree, it will remain in the
annexobjects location until an unused/dropunused pass is done.
Joey Hess [Sun, 4 Aug 2024 15:34:00 +0000 (11:34 -0400)]
update
Decided not to use the annexobjects location for exportTempName.
There doesn't seem to be any actual benefit to doing that, because an
export that renames to exportTempName always renames it back from that
to another location.
Also the annexobjects directory won't actually help with the paired
rename issue.
Joey Hess [Sun, 4 Aug 2024 15:17:42 +0000 (11:17 -0400)]
strong verification on retrieval from annexobjects location
The file in the annexobjects location may have been renamed from a
previously exported file that got deleted in a subsequent export.
Or it may be renamed to annexobjects temporarily before being renamed to
another name (to handle eg pairwise renames).
But, an exported file is not guaranteed to contain the content of the
key that the local repository last exported there. Another tree could
have been exported from elsewhere in the meantime.
So, files in annexobjects do not necessarily have the content of their
key. And so have to be strongly verified when retrieving. The same as
is done when retrieving exported files.
Joey Hess [Sat, 3 Aug 2024 23:51:03 +0000 (19:51 -0400)]
design work on annexobjects remotes
Joey Hess [Sat, 3 Aug 2024 15:39:23 +0000 (11:39 -0400)]
sync --content with annexobjects=true exporttree remotes
Joey Hess [Fri, 2 Aug 2024 22:50:57 +0000 (18:50 -0400)]
update
Joey Hess [Fri, 2 Aug 2024 22:45:44 +0000 (18:45 -0400)]
Merge branch 'master' into exportreeplus
Joey Hess [Fri, 2 Aug 2024 22:43:10 +0000 (18:43 -0400)]
in unexport, check for annexobjects presence before updating location log
The key may still be in the annexobjects location.
Joey Hess [Fri, 2 Aug 2024 20:45:52 +0000 (16:45 -0400)]
prevent removeKey from annexobjects=yes remote when the key is in the exported tree
Removing the key from the annexobjects location when it's in the
exported tree would leave it in the exported tree, and so succeeding
would update the location log incorrectly. But this also can't remove it
from the exported tree, because that would cause import tree to see a
file got deleted. So, refuse to remove in this situation.
It would be possible to remove from the annexobjects location and then
fail. Then if a key somehow got stored in both the annexobjects location
and the exported tree location(s), the duplicate would be resolved. Not
doing this because first, I don't know how that situation could happen,
and second, it seems wrong for a failed remove to have a side-effect
like that.
Joey Hess [Fri, 2 Aug 2024 18:15:05 +0000 (14:15 -0400)]
status
Joey Hess [Fri, 2 Aug 2024 18:13:29 +0000 (14:13 -0400)]
Remove debug output (to stderr)
Accidentially included in last version. Only happens when running code that
uses remoteUrl.
Joey Hess [Fri, 2 Aug 2024 18:10:34 +0000 (14:10 -0400)]
status
Joey Hess [Fri, 2 Aug 2024 18:07:45 +0000 (14:07 -0400)]
initial support for annexobjects=yes
Works but some commands may need changes to support special remotes
configured this way.
Joey Hess [Fri, 2 Aug 2024 17:13:44 +0000 (13:13 -0400)]
git-remote-annex: use annexLocationsBare
There was no good reason for it to be using annexLocationsNonBare,
and exporttree=yes annexobjects=yes is going to use annexLocationsBare,
so this should as well for consistency.
Since all returned ExportLocations are tried when retrieving objects,
this won't break backwards compatability.
Spencer [Fri, 2 Aug 2024 04:37:11 +0000 (04:37 +0000)]
removed
Spencer [Fri, 2 Aug 2024 04:10:32 +0000 (04:10 +0000)]
Added a comment: Necro
Spencer [Fri, 2 Aug 2024 04:10:14 +0000 (04:10 +0000)]
Added a comment: Necro
dmcardle [Thu, 1 Aug 2024 14:25:18 +0000 (14:25 +0000)]
dmcardle [Thu, 1 Aug 2024 14:23:41 +0000 (14:23 +0000)]
Added a comment
d@403a635aa8eaa8bfa8613acb6a375d9e06ed7001 [Thu, 1 Aug 2024 14:19:25 +0000 (14:19 +0000)]
d@403a635aa8eaa8bfa8613acb6a375d9e06ed7001 [Thu, 1 Aug 2024 13:49:41 +0000 (13:49 +0000)]
Added a comment
Spencer [Wed, 31 Jul 2024 20:10:06 +0000 (20:10 +0000)]
Added a comment: @joey
Joey Hess [Wed, 31 Jul 2024 19:54:14 +0000 (15:54 -0400)]
Avoid loading cluster log at startup
This fixes a problem with datalad's test suite, where loading the cluster
log happened to cause the git-annex branch commits to take a different
shape, with an additional commit.
It's also faster though, since many commands don't need the cluster log.
Just fill Annex.clusters with a thunk.
Sponsored-by: the NIH-funded NICEMAN (ReproNim TR&D3) project
Joey Hess [Wed, 31 Jul 2024 18:07:30 +0000 (14:07 -0400)]
clean up build warnings when built w/o servant
Joey Hess [Wed, 31 Jul 2024 18:05:48 +0000 (14:05 -0400)]
cleanup comments on removed news post
Joey Hess [Wed, 31 Jul 2024 18:05:11 +0000 (14:05 -0400)]
add news item for git-annex 10.
20240731