git-annex.git
2 years agoidea
Joey Hess [Mon, 29 Jul 2024 13:11:27 +0000 (09:11 -0400)]
idea

2 years agoremove unused imports
Joey Hess [Mon, 29 Jul 2024 01:11:23 +0000 (21:11 -0400)]
remove unused imports

2 years agoremove uuid from annex+http urls
Joey Hess [Mon, 29 Jul 2024 00:29:42 +0000 (20:29 -0400)]
remove uuid from annex+http urls

Not needed it turns out.

2 years agoset remote's annexUrl automatically
Joey Hess [Mon, 29 Jul 2024 00:13:41 +0000 (20:13 -0400)]
set remote's annexUrl automatically

When the remote repository's git config file
has annex.url set to an annex+http url.

2 years agotodo
Joey Hess [Sun, 28 Jul 2024 21:29:32 +0000 (17:29 -0400)]
todo

2 years agodocumentation for p2phttp
Joey Hess [Sun, 28 Jul 2024 21:19:27 +0000 (17:19 -0400)]
documentation for p2phttp

2 years agoavoid repeatedly parsing the proxy log
Joey Hess [Sun, 28 Jul 2024 20:04:20 +0000 (16:04 -0400)]
avoid repeatedly parsing the proxy log

2 years agoupdate
Joey Hess [Sun, 28 Jul 2024 19:55:24 +0000 (15:55 -0400)]
update

2 years agotodo
Joey Hess [Sun, 28 Jul 2024 19:41:31 +0000 (15:41 -0400)]
todo

2 years agofix hang in PUT of large file to a special remote node of a cluster over http
Joey Hess [Sun, 28 Jul 2024 19:34:59 +0000 (15:34 -0400)]
fix hang in PUT of large file to a special remote node of a cluster over http

2 years agouse closedv rather than separate endv
Joey Hess [Sun, 28 Jul 2024 19:11:31 +0000 (15:11 -0400)]
use closedv rather than separate endv

Doesn't fix any known problem, but this way if the connection does get
closed, it will notice.

2 years agoremove temp file after upload to special remote
Joey Hess [Sun, 28 Jul 2024 18:36:45 +0000 (14:36 -0400)]
remove temp file after upload to special remote

2 years agoMerge remote-tracking branch 'origin/master' into httpproto
Joey Hess [Sun, 28 Jul 2024 18:24:15 +0000 (14:24 -0400)]
Merge remote-tracking branch 'origin/master' into httpproto

2 years agoupdate
Joey Hess [Sun, 28 Jul 2024 18:22:44 +0000 (14:22 -0400)]
update

2 years agoclean shut down of cluster connection when PUT is interrupted
Joey Hess [Sun, 28 Jul 2024 18:15:28 +0000 (14:15 -0400)]
clean shut down of cluster connection when PUT is interrupted

An interrupted `git-annex copy --to` a cluster via the http server,
when repeated, failed. The http server output "transfer already in
progress, or unable to take transfer lock". Apparently a second
connection was opened to the cluster, because the first connection
never got shut down.

Turned out the problem was that when proxying to a cluster, it would read a
short ByteString from the client, and send that to the nodes. But that left the
nodes warning more. Meanwhile, the proxy was expecting a SUCCESS/FAILURE
message from the nodes. So it didn't return, and so the cluster connection
stayed open.

2 years agofix http proxying for a local git remote with a relative path
Joey Hess [Sun, 28 Jul 2024 17:31:30 +0000 (13:31 -0400)]
fix http proxying for a local git remote with a relative path

git-annex-shell expects an absolute path

2 years agofound some bugs with clusters
Joey Hess [Sun, 28 Jul 2024 17:00:05 +0000 (13:00 -0400)]
found some bugs with clusters

2 years agoclusters need enableInteractiveBranchAccess
Joey Hess [Sun, 28 Jul 2024 16:39:42 +0000 (12:39 -0400)]
clusters need enableInteractiveBranchAccess

As seen in commit 770aac97a75f64b86d73240055acffe1a5ed9f1a, a cluster
relies accurate location logs. If long-running processes are serving a
cluster, and one process puts a file, the other process needs to see
what nodes it was stored on when checking if the file is present.

2 years agosmarter BranchState cache invalidation
Joey Hess [Sun, 28 Jul 2024 16:33:32 +0000 (12:33 -0400)]
smarter BranchState cache invalidation

Only invalidate a just-written file in the cache, not the whole cache.

This will avoid the possibly performance impact of cache invalidation
mentioned in commit 770aac97a75f64b86d73240055acffe1a5ed9f1a

2 years agoshare single BranchState amoung all threads
Joey Hess [Sun, 28 Jul 2024 16:17:16 +0000 (12:17 -0400)]
share single BranchState amoung all threads

This fixes a problem when git-annex testremote is run against a cluster
accessed via the http server. Annex.Cluster uses the location log
to find nodes that contain a key when checking if the key is present or getting
it. Just after a key was stored to a cluster node, reading the location log
was not getting the UUID of that node.

Apparently the Annex action that wrote to the location log, and the one
that read from it were run with two different Annex states. The http server
does use several different Annex threads.

BranchState was part of the AnnexState, and so two threads could have
different BranchStates.

Moved BranchState to the AnnexRead, so all threads will see the common state.

This might possibly impact performance. If one thread is writing changes to the
branch, and another thread is reading from the branch, the writing thread will
now invalidate the BranchState's cache, which will cause the reading thread to
need to do extra work. But correctness is surely more important. If did is
found to have impacted performance, it could probably be dealt with by doing
smarter BranchState cache invalidation.

Another way this might impact performance is that the BranchState has a small
cache. If several threads were reading from the branch and relying on the value
they just read still being in the case, now a cache miss will be more likely.
Increasing the BranchState cache to the number of jobs might be a good
idea to amelorate that. But the cache is currently an innefficient list,
so making it large would need changes to the data types.

(Commit 4304f1b6aea19a5c402dc4f9d69aa4ff1c104c9b dealt with a follow-on
effect of the bug fixed here.)

2 years agobetter handling of content not available from cluster
Joey Hess [Sun, 28 Jul 2024 15:09:07 +0000 (11:09 -0400)]
better handling of content not available from cluster

Sending ERROR caused the client to get confused and protocol to freeze.
Better to send empty DATA and indicate it's not valid.

This fixes a hang in git-annex testremote of a cluster accessed via the
http server. That testremote is still failing, for some reason after
storing a test key, the cluster reports it as not present.

2 years agoadd --clusterjobs option and default to 1
Joey Hess [Sun, 28 Jul 2024 14:36:22 +0000 (10:36 -0400)]
add --clusterjobs option and default to 1

The default of 1 is not ideal at all, but it avoids an accidental M*N
causing so much concurrency it becomes unusable.

2 years agocluster support in http API server
Joey Hess [Sun, 28 Jul 2024 14:16:35 +0000 (10:16 -0400)]
cluster support in http API server

Wired it up and it seems to basically work, although the test suite is
not fully passing.

Note that --jobs currently gets multiplied by the number of nodes in the
cluster, which is probably not good.

2 years agoremove duplicate code
Joey Hess [Sun, 28 Jul 2024 13:35:09 +0000 (09:35 -0400)]
remove duplicate code

2 years agotested shutdown of connection to http proxied special remote
Joey Hess [Sun, 28 Jul 2024 13:17:47 +0000 (09:17 -0400)]
tested shutdown of connection to http proxied special remote

I had worried it might not work properly, but it does, the endv works.

2 years agofix PUT to http proxied special remote
Joey Hess [Sun, 28 Jul 2024 13:14:42 +0000 (09:14 -0400)]
fix PUT to http proxied special remote

It was hanging because it never sent FAILURE in the INVALID case.
And putoffset always triggers the INVALID case.

2 years agothoughts on exporttree
Joey Hess [Sat, 27 Jul 2024 23:59:54 +0000 (19:59 -0400)]
thoughts on exporttree

2 years agoupdate
Joey Hess [Sat, 27 Jul 2024 00:44:01 +0000 (20:44 -0400)]
update

2 years agoUNLOCKCONTENT is not a top-level request
Joey Hess [Sat, 27 Jul 2024 00:37:38 +0000 (20:37 -0400)]
UNLOCKCONTENT is not a top-level request

proxyRequest was treating UNLOCKCONTENT as a separate request.
That made it possible for there to be two different connections to the
proxied remote, with LOCKCONTENT being sent to one, and UNLOCKCONTENT
to the other one. A protocol error.

git-annex testremote now passes against a http proxied remote.

2 years agofix hang at end of PUT to proxied p2p http remote
Joey Hess [Fri, 26 Jul 2024 23:50:15 +0000 (19:50 -0400)]
fix hang at end of PUT to proxied p2p http remote

sendExactly will now be sure to evaluate the whole lazy ByteString.

In this case, the lazy ByteString was exactly the right lenth.
But, it seems that L.take caused it to not actually be fully evaluated.

In servePut, this manifested as gather never being fully evaluated,
which caused the hang.

Very, very subtle, and horrible bug. Clearly the use of lazy ByteString
(or really just laziness) is at fault, and it would be very worth moving
to conduit or whatever to avoid this.

2 years agoupdate
Joey Hess [Fri, 26 Jul 2024 21:15:09 +0000 (17:15 -0400)]
update

2 years agoimplement proxy connection pool
Joey Hess [Fri, 26 Jul 2024 20:34:08 +0000 (16:34 -0400)]
implement proxy connection pool

removeOldestProxyConnectionPool will be innefficient the larger the pool
is. A better data structure could be more efficient. Eg, make each value
in the pool include the timestamp of its oldest element, then the oldest
value can be found and modified, rather than rebuilding the whole Map.

But, for pools of a few hundred items, this should be fine. It's O(n*n log n)
or so.

Also, when more than 1 connection with the same pool key exists,
it's efficient even for larger pools, since removeOldestProxyConnectionPool
is not needed.

The default of 1 idle connection could perhaps be larger.. like the
number of jobs? Otoh, it seems good to ramp up and down the number of
connections, which does happen. With 1, there is at most one stale
connection, which might cause a request to fail.

2 years agoinitial report on keeping association with the remote
yarikoptic [Fri, 26 Jul 2024 20:01:23 +0000 (20:01 +0000)]
initial report on keeping association with the remote

2 years agocloseP2PConnection on interrupted GET
Joey Hess [Fri, 26 Jul 2024 19:50:01 +0000 (15:50 -0400)]
closeP2PConnection on interrupted GET

2 years agoclean up after http p2p proxy GET is interrupted
Joey Hess [Fri, 26 Jul 2024 19:25:15 +0000 (15:25 -0400)]
clean up after http p2p proxy GET is interrupted

There was an annex worker thread that did not get stopped.

It was stuck in ReceiveMessage from the P2PHandleTMVar.

Fixed by making P2PHandleTMVar closeable.

In serveGet, releaseP2PConnection has to come first, else the
annexworker may not shut down, if it's waiting to read from it.

In proxyConnection, call closeRemoteSide in order to wait for the ssh
process (for example).

2 years agoclose proxy remote side when done with it
Joey Hess [Fri, 26 Jul 2024 17:57:28 +0000 (13:57 -0400)]
close proxy remote side when done with it

2 years agooops
Joey Hess [Fri, 26 Jul 2024 17:55:14 +0000 (13:55 -0400)]
oops

2 years agooops
Joey Hess [Fri, 26 Jul 2024 17:54:37 +0000 (13:54 -0400)]
oops

2 years agoclean up protocol version for proxying
Joey Hess [Fri, 26 Jul 2024 17:39:43 +0000 (13:39 -0400)]
clean up protocol version for proxying

The proxy always checks the protocol version of a remote before talking
to it in a version-specific way, so the protocol version in the ProxyParams
is the client's protocol version. The remote will always be at the same or
an older protocol version than the client.

Note that in relayDATAFinish, when the client is at protocol version 0,
the remote must thus be as well, and that's why its version is not
checked in the case for that.

With that clarified, it's evident that, in P2P.Http.State, there's no
need to look at the proxied remote's protocol version at all.

2 years agofix setting protocol version for v0 server
Joey Hess [Fri, 26 Jul 2024 17:24:56 +0000 (13:24 -0400)]
fix setting protocol version for v0 server

Before it was leaving the protocol version at the default, when it
was actually v0.

v0 has only ever been used over tor, which is probably why this bug was
never noticed.

2 years agofix hang in GET from http p2p proxy
Joey Hess [Fri, 26 Jul 2024 16:49:06 +0000 (12:49 -0400)]
fix hang in GET from http p2p proxy

serverP2PConnection = proxyfromclientconn causes serveGet to
signalFullyConsumedByteString to it, which is what it's waiting for

2 years agoimprove comment
Joey Hess [Fri, 26 Jul 2024 16:48:47 +0000 (12:48 -0400)]
improve comment

2 years agoupdate
Joey Hess [Fri, 26 Jul 2024 15:01:45 +0000 (11:01 -0400)]
update

2 years agohttp p2p proxy is now largely working
Joey Hess [Fri, 26 Jul 2024 14:24:23 +0000 (10:24 -0400)]
http p2p proxy is now largely working

2 years agoAdded a comment
m.risse@77eac2c22d673d5f10305c0bade738ad74055f92 [Fri, 26 Jul 2024 11:42:49 +0000 (11:42 +0000)]
Added a comment

2 years agoremove some debugging
Joey Hess [Fri, 26 Jul 2024 01:36:10 +0000 (21:36 -0400)]
remove some debugging

2 years agowip
Joey Hess [Thu, 25 Jul 2024 19:39:57 +0000 (15:39 -0400)]
wip

2 years agouse a record to reduce the huge number of parameters
Joey Hess [Thu, 25 Jul 2024 19:18:06 +0000 (15:18 -0400)]
use a record to reduce the huge number of parameters

2 years agofactored out proxyRequest
Joey Hess [Thu, 25 Jul 2024 19:00:36 +0000 (15:00 -0400)]
factored out proxyRequest

This will allow the HTTP server to keep a connection to a proxied
remote open, and only enter the Annex monad when handling a client
request.

2 years agohttp server support for proxies, incomplete
Joey Hess [Thu, 25 Jul 2024 17:15:05 +0000 (13:15 -0400)]
http server support for proxies, incomplete

Refactored git-annex-shell code so this can use checkCanProxy'.

At this point all that remains is opening a proxy connection,
and using a proxy connection.

2 years agouse annex+http for accessing proxies
Joey Hess [Thu, 25 Jul 2024 16:00:57 +0000 (12:00 -0400)]
use annex+http for accessing proxies

Doesn't work yet on the http server side, which is throwing 502 bad
gateway.

2 years agoless indent
Joey Hess [Thu, 25 Jul 2024 14:12:59 +0000 (10:12 -0400)]
less indent

2 years agop2phttp drop supports checking proof timestamps
Joey Hess [Thu, 25 Jul 2024 14:11:09 +0000 (10:11 -0400)]
p2phttp drop supports checking proof timestamps

At this point the p2phttp implementation is fully complete!

2 years agoadd common parameters to generic get API
Joey Hess [Thu, 25 Jul 2024 00:55:58 +0000 (20:55 -0400)]
add common parameters to generic get API

Honestly this was just done to make the documentation correct. There's
no point in using these parameters. And they're optional.

2 years agofix build without servant
Joey Hess [Wed, 24 Jul 2024 19:12:16 +0000 (15:12 -0400)]
fix build without servant

2 years agotestremote passes on p2phttp remote
Joey Hess [Wed, 24 Jul 2024 18:36:37 +0000 (14:36 -0400)]
testremote passes on p2phttp remote

2 years agoexpire lock after 10 minutes initially
Joey Hess [Wed, 24 Jul 2024 18:25:40 +0000 (14:25 -0400)]
expire lock after 10 minutes initially

Once keeplocked is called, the lock will expire at the end
of that call. But if keeplocked never gets called, this avoids
the lock persisting forever.

2 years agoRemote.Git lockContent works with annex+http urls
Joey Hess [Wed, 24 Jul 2024 17:42:57 +0000 (13:42 -0400)]
Remote.Git lockContent works with annex+http urls

2 years agoRemote.Git removeKey works with annex+http urls
Joey Hess [Wed, 24 Jul 2024 16:33:26 +0000 (12:33 -0400)]
Remote.Git removeKey works with annex+http urls

Does not yet handle drop proof lock timestamp checking.

2 years agoupdate
Joey Hess [Wed, 24 Jul 2024 16:19:53 +0000 (12:19 -0400)]
update

2 years agoupdate
Joey Hess [Wed, 24 Jul 2024 16:18:51 +0000 (12:18 -0400)]
update

2 years agoprogress meter for p2phttp storeKey
Joey Hess [Wed, 24 Jul 2024 16:14:56 +0000 (12:14 -0400)]
progress meter for p2phttp storeKey

2 years agoRemote.Git storeKey works with annex+http urls
Joey Hess [Wed, 24 Jul 2024 16:05:10 +0000 (12:05 -0400)]
Remote.Git storeKey works with annex+http urls

Does not yet update progress meter.

2 years agoupdate
Joey Hess [Wed, 24 Jul 2024 15:13:37 +0000 (11:13 -0400)]
update

2 years agomore generic clientGet
Joey Hess [Wed, 24 Jul 2024 15:10:19 +0000 (11:10 -0400)]
more generic clientGet

2 years agofix slowloris timeout in hashing resume of download of large file
Joey Hess [Wed, 24 Jul 2024 15:03:59 +0000 (11:03 -0400)]
fix slowloris timeout in hashing resume of download of large file

Hash the data that is already present in the file before connecting to
the http server.

2 years agofix meter display on resume
Joey Hess [Wed, 24 Jul 2024 14:28:48 +0000 (10:28 -0400)]
fix meter display on resume

It still needs to be offset, otherwise on resume from 80% it will
display 1%..20%.

Seems that this bug must have affected P2P.Annex as well where it runs
this code, but apparently it didn't affect it in a very user-visible
way. Maybe the transfer log file was updated incorrectly?

2 years agoRemote.Git retrieveKeyFile works with annex+http urls
Joey Hess [Wed, 24 Jul 2024 13:45:14 +0000 (09:45 -0400)]
Remote.Git retrieveKeyFile works with annex+http urls

This includes a bugfix to serveGet, it hung at the end.

2 years agofactor out resumeVerifyFromOffset
Joey Hess [Wed, 24 Jul 2024 13:08:17 +0000 (09:08 -0400)]
factor out resumeVerifyFromOffset

2 years agoavoid needing ifdefs when using P2P.Http.Client
Joey Hess [Wed, 24 Jul 2024 12:33:59 +0000 (08:33 -0400)]
avoid needing ifdefs when using P2P.Http.Client

2 years agoMerge branch 'master' into httpproto
Joey Hess [Wed, 24 Jul 2024 01:17:06 +0000 (21:17 -0400)]
Merge branch 'master' into httpproto

2 years agoPropagate --force to git-annex transferrer
Joey Hess [Wed, 24 Jul 2024 01:16:56 +0000 (21:16 -0400)]
Propagate --force to git-annex transferrer

And other child processes.

2 years agobug
Joey Hess [Wed, 24 Jul 2024 01:02:31 +0000 (21:02 -0400)]
bug

2 years agocache credentials for p2phttp in memory
Joey Hess [Tue, 23 Jul 2024 22:45:02 +0000 (18:45 -0400)]
cache credentials for p2phttp in memory

2 years agoremove uuid from url when calling git credential
Joey Hess [Tue, 23 Jul 2024 22:21:01 +0000 (18:21 -0400)]
remove uuid from url when calling git credential

The user doesn't want to see a uuid in the prompt.

Also, when a http server is proxying, multiple remotes will have the
same base url, and the same password will work for them all.

2 years agouse git credential when p2phttp needs auth
Joey Hess [Tue, 23 Jul 2024 22:11:15 +0000 (18:11 -0400)]
use git credential when p2phttp needs auth

2 years agop2phttp support https
Joey Hess [Tue, 23 Jul 2024 19:37:36 +0000 (15:37 -0400)]
p2phttp support https

2 years agoadd --bind option and listen to both ipv4 and ipv6 by default
Joey Hess [Tue, 23 Jul 2024 19:19:56 +0000 (15:19 -0400)]
add --bind option and listen to both ipv4 and ipv6 by default

2 years agoprotocol version fallback on 404
Joey Hess [Tue, 23 Jul 2024 18:58:49 +0000 (14:58 -0400)]
protocol version fallback on 404

and prettified errors

2 years agoRemote.Git checkpresent works with annex+http urls.
Joey Hess [Tue, 23 Jul 2024 18:31:32 +0000 (14:31 -0400)]
Remote.Git checkpresent works with annex+http urls.

2 years agofactor out http server and client into own modules
Joey Hess [Tue, 23 Jul 2024 18:12:03 +0000 (14:12 -0400)]
factor out http server and client into own modules

To avoid a cycle when Remote.Git uses the client.

2 years agostarted wiring p2phttp into Remote.Git
Joey Hess [Tue, 23 Jul 2024 17:53:10 +0000 (13:53 -0400)]
started wiring p2phttp into Remote.Git

but we have a cycle, ugh

2 years agorequire a valid uuid at the end of an annex+http url
Joey Hess [Tue, 23 Jul 2024 16:30:27 +0000 (12:30 -0400)]
require a valid uuid at the end of an annex+http url

2 years agoadd remoteAnnexP2PHttpUrl to RemoveGitConfig
Joey Hess [Tue, 23 Jul 2024 13:55:14 +0000 (09:55 -0400)]
add remoteAnnexP2PHttpUrl to RemoveGitConfig

This is always parsed, when building without servant, a Baseurl is not
generated, and users of it will need to fail.

2 years agostarting support for remote.name.annexUrl set to annex+http
Joey Hess [Tue, 23 Jul 2024 13:12:21 +0000 (09:12 -0400)]
starting support for remote.name.annexUrl set to annex+http

In this case, Remote.Git should not use that url for all access to
the repository. It will only be used for annex operations, which isn't
done yet.

2 years agoupdate servant build flag
Joey Hess [Tue, 23 Jul 2024 12:53:56 +0000 (08:53 -0400)]
update servant build flag

make it work when building w/o assistant

2 years agoupdate
Joey Hess [Tue, 23 Jul 2024 12:53:52 +0000 (08:53 -0400)]
update

2 years agoannex+http urls
Joey Hess [Tue, 23 Jul 2024 12:42:33 +0000 (08:42 -0400)]
annex+http urls

2 years agorefactor
Joey Hess [Tue, 23 Jul 2024 01:19:32 +0000 (21:19 -0400)]
refactor

2 years agofix build
Joey Hess [Tue, 23 Jul 2024 01:19:20 +0000 (21:19 -0400)]
fix build

2 years agoupdate
Joey Hess [Tue, 23 Jul 2024 00:59:45 +0000 (20:59 -0400)]
update

2 years agochange default port to 9417
Joey Hess [Tue, 23 Jul 2024 00:44:48 +0000 (20:44 -0400)]
change default port to 9417

Port 80 would need root, not a good idea, so pick something that might
work by default.

9418 is git protocol's port. 9419 is used by something, but nothing
known uses 9417, so it's as good a default as any.

2 years agoexit cleanly on eg, failure to bind socket
Joey Hess [Tue, 23 Jul 2024 00:37:37 +0000 (20:37 -0400)]
exit cleanly on eg, failure to bind socket

2 years agoP2P protocol is finalized
Joey Hess [Mon, 22 Jul 2024 23:50:08 +0000 (19:50 -0400)]
P2P protocol is finalized

2 years agomake keeplocked client UUID optional
Joey Hess [Mon, 22 Jul 2024 23:48:54 +0000 (19:48 -0400)]
make keeplocked client UUID optional

It's not used, but it makes the protocol simpler if this parameter can
always be sent.

2 years agolocking over http basically working
Joey Hess [Mon, 22 Jul 2024 23:44:26 +0000 (19:44 -0400)]
locking over http basically working

2 years agomake serveKeepLocked check auth just to be safe
Joey Hess [Mon, 22 Jul 2024 23:15:52 +0000 (19:15 -0400)]
make serveKeepLocked check auth just to be safe

2 years agoimplement clientLockContent
Joey Hess [Mon, 22 Jul 2024 22:55:12 +0000 (18:55 -0400)]
implement clientLockContent

2 years agoimplemented serveLockContent (untested)
Joey Hess [Mon, 22 Jul 2024 21:36:56 +0000 (17:36 -0400)]
implemented serveLockContent (untested)

2 years agoimprove clientKeepLocked
Joey Hess [Mon, 22 Jul 2024 20:56:44 +0000 (16:56 -0400)]
improve clientKeepLocked