Commit graph

42445 commits

Author SHA1 Message Date
Joey Hess
3149a1e2fe
More robust handling of ErrorBusy when writing to sqlite databases
While ErrorBusy and other exceptions were caught and the write retried for
up to 10 seconds, it was still possible for git-annex to eventually
give up and error out without writing to the database. Now it will retry
as long as necessary.

This does mean that, if one git-annex process is suspended just as sqlite
has locked the database for writing, another git-annex that tries to write
it it might get stuck retrying forever. But, that could already happen when
opening the sqlite database, which retries forever on ErrorBusy. This is an
area where git-annex is known to not behave well, there's a todo about the
general case of it.

Sponsored-by: Dartmouth College's Datalad project
2022-10-17 15:56:19 -04:00
Joey Hess
0d762acf7e
update comment, probably not a sqlite bug
Sqlite's page documenting WAL mode changed in Oct 2016 to mention ways
that queries could fail with SQLITE_BUSY.

http://web.archive.org/web/20161009044054/http://www.sqlite.org:80/wal.html

Probably not cooincidentally, I emailed sqlite-users about such a
situation in Feb 2015.
https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg90580.html

Noone ever replied to me, but at least now I understand why it does that.
Since it's documented now, it's no longer a bug.
2022-10-17 15:09:47 -04:00
Joey Hess
f8fe393052
comment 2022-10-17 12:37:57 -04:00
Joey Hess
b953bd0e7b
Merge branch 'master' of ssh://git-annex.branchable.com 2022-10-14 15:14:11 -04:00
AlexPraga
7b9e3dc5fb 2022-10-14 09:32:44 +00:00
AlexPraga
2cad4b95f4 2022-10-14 09:28:38 +00:00
asakurareiko@f3d908c71c009580228b264f63f21c7274df7476
dbca1781d9 Update WSL1 tips 2022-10-13 15:29:12 +00:00
Joey Hess
a8a5d444c5
test v10 2022-10-12 16:13:30 -04:00
Joey Hess
22f9598dfb
Merge branch 'master' of ssh://git-annex.branchable.com 2022-10-12 15:54:12 -04:00
Joey Hess
d5cd1de280
update and open a todo about something I'm pondering 2022-10-12 15:53:56 -04:00
Joey Hess
6fbd337e34
avoid uncessary keys db writes; doubled speed!
When running eg git-annex get, for each file it has to read from and
write to the keys database. But it's reading exclusively from one table,
and writing to a different table. So, it is not necessary to flush the
write to the database before reading. This avoids writing the database
once per file, instead it will buffer 1000 changes before writing.

Benchmarking getting 1000 small files from a local origin,
git-annex get now takes 13.62s, down from 22.41s!
git-annex drop now takes 9.07s, down from 18.63s!
Wowowowowowowow!

(It would perhaps have been better if there were separate databases for
the two tables. At least it would have avoided this complexity. Ah well,
this is better than splitting the table in a annex.version upgrade.)

Sponsored-by: Dartmouth College's Datalad project
2022-10-12 15:33:16 -04:00
Joey Hess
ba7ecbc6a9
avoid flushing keys db queue after each Annex action
The flush was only done Annex.run' to make sure that the queue was flushed
before git-annex exits. But, doing it there means that as soon as one
change gets queued, it gets flushed soon after, which contributes to
excessive writes to the database, slowing git-annex down.
(This does not yet speed git-annex up, but it is a stepping stone to
doing so.)

Database queues do not autoflush when garbage collected, so have to
be flushed explicitly. I don't think it's possible to make them
autoflush (except perhaps if git-annex sqitched to using ResourceT..).
The comment in Database.Keys.closeDb used to be accurate, since the
automatic flushing did mean that all writes reached the database even
when closeDb was not called. But now, closeDb or flushDb needs to be
called before stopping using an Annex state. So, removed that comment.

In Remote.Git, change to using quiesce everywhere that it used to use
stopCoProcesses. This means that uses on onLocal in there are just as
slow as before. I considered only calling closeDb on the local git remotes
when git-annex exits. But, the reason that Remote.Git calls stopCoProcesses
in each onLocal is so as not to leave git processes running that have files
open on the remote repo, when it's on removable media. So, it seemed to make
sense to also closeDb after each one, since sqlite may also keep files
open. Although that has not seemed to cause problems with removable
media so far. It was also just easier to quiesce in each onLocal than
once at the end. This does likely leave performance on the floor, so
could be revisited.

In Annex.Content.saveState, there was no reason to close the db,
flushing it is enough.

The rest of the changes are from auditing for Annex.new, and making
sure that quiesce is called, after any action that might possibly need
it.

After that audit, I'm pretty sure that the change to Annex.run' is
safe. The only concern might be that this does let more changes get
queued for write to the db, and if git-annex is interrupted, those will be
lost. But interrupting git-annex can obviously already prevent it from
writing the most recent change to the db, so it must recover from such
lost data... right?

Sponsored-by: Dartmouth College's Datalad project
2022-10-12 14:12:23 -04:00
benjamin.poldrack@d09ccff6d42dd20277610b59867cf7462927b8e3
5bd79e717f Added a comment 2022-10-12 06:12:17 +00:00
Joey Hess
b312b2a30b
update 2022-10-11 15:07:52 -04:00
Joey Hess
c2ad84b423
all keys are still present on versioned remote after import of a tree
When importing from versioned remotes, fix tracking of the content of
deleted files.

Only S3 supports versioning so far, so only it was affected.

But, the draft import/export interface for external remotes also seemed to
need a change, so that versionedExport could be set.
2022-10-11 13:05:40 -04:00
benjamin.poldrack@d09ccff6d42dd20277610b59867cf7462927b8e3
e22c3b3d7c 2022-10-11 09:12:00 +00:00
Joey Hess
b4305315b2
S3: pass fileprefix into getBucket calls
S3: Speed up importing from a large bucket when fileprefix= is set by only
asking for files under the prefix.

getBucket still returns the files with the prefix included, so the rest of
the fileprefix stripping still works unchanged.

Sponsored-by: Dartmouth College's DANDI project
2022-10-10 17:37:26 -04:00
Joey Hess
90f9671e00
future proof AWS.Credentials generation
Avoid breaking when a field is added to the constructor.

Sponsored-by: Dartmouth College's DANDI project
2022-10-10 16:33:21 -04:00
Joey Hess
4a42c69092
take lock in checkLogFile and calcLogFile
move: Fix openFile crash with -J

This does make them a bit slower, although usually the log file is not
very big, so even when it's being rewritten, they will not block for
long taking the lock. Still, little slowdowns may add up when moving a lot
file files.

A less expensive fix would be to use something lower level than openFile
that does not check if the file is already open for write by another
thread. But GHC does not seem to provide anything convenient; even mkFD
checks for a writing thread.

fullLines is no longer necessary since these functions no longer will
read the file while it's being written.

Sponsored-by: Dartmouth College's DANDI project
2022-10-07 13:19:17 -04:00
Joey Hess
85dbc21c1c
fix typo 2022-10-07 12:30:07 -04:00
Joey Hess
e9a1f3f351
Merge branch 'master' of ssh://git-annex.branchable.com 2022-10-07 12:29:32 -04:00
jkniiv
b7d189d6c0 Added a comment 2022-10-06 16:04:41 +00:00
yarikoptic
91c9a27c5a Added a comment 2022-10-06 12:50:01 +00:00
yarikoptic
77825cadfa removed 2022-10-06 12:47:48 +00:00
yarikoptic
04117f0e52 Added a comment 2022-10-06 12:47:17 +00:00
jkniiv
c9bf143fc8 Added a comment 2022-10-06 06:21:40 +00:00
yarikoptic
5761ea969f 2022-10-06 01:37:24 +00:00
yarikoptic
f0a2341e5c initial report on locking issue on move 2022-10-05 21:25:00 +00:00
Joey Hess
95517442d2
update 2022-10-05 13:01:12 -04:00
jules@a6ba859eba6f59bd980f294741b1ad9b7624552a
ee2442bbab Added a comment 2022-10-04 17:59:54 +00:00
Joey Hess
a679ef04ff
comments 2022-10-04 13:36:38 -04:00
Joey Hess
44d763468a
add missing whitespace in warning message 2022-10-04 13:30:22 -04:00
Joey Hess
304ee15a42
comment 2022-10-04 13:06:55 -04:00
Joey Hess
70d2ece381
improve usage
These commands operate on not only remotes, but any way a repository can
be specified, including "here" etc.

Sponsored-by: Graham Spencer on Patreon
2022-10-03 13:49:42 -04:00
Joey Hess
15f9fcbcb1
avoid combining multiple words provided to trust/untrust/dead
* trust, untrust, semitrust, dead: Fix behavior when provided with
  multiple repositories to operate on.
* trust, untrust, semitrust, dead: When provided with no parameters,
  do not operate on a repository that has an empty name.

The man page and usage already indicated that multiple repos could be
provided to these commands, but they actually used unwords to combine
everything into string, and found a repo matching that string. This was
especially bad when no parameters resulted in the empty string and some
repo happened to have an empty description.

This does change the behavior, and it's possible someone relied on the
current behavior to eg, trust a repo by name with the name not quoted into
a single parameter. But fixing the empty string bug and matching the
documentation are worth breaking that usage.

Note that git-annex init/reinit do still unwords multiple parameters when
provided to them. That is inconsistent behavior, but it certianly seems
possible that something does run git-annex init with an unquoted
description, and I don't think it's worth breaking that just to make it more
consistent with these other commands.

Sponsored-by: Boyd Stephen Smith Jr. on Patreon
2022-10-03 13:48:40 -04:00
Joey Hess
99e4dc8d41
improve wording
This is to improve this case:

joey@darkstar:~/tmp/yyyy>git-annex trust
git-annex: no remote specified

The command does not need to be run with a remote, any repository name
will do, including eg "here".

Sponsored-by: Brock Spratlen on Patreon
2022-10-03 13:32:55 -04:00
Joey Hess
e74c56ed78
add news item for git-annex 10.20221003 2022-10-03 13:24:33 -04:00
Joey Hess
32a44c3813
releasing package git-annex version 10.20221003 2022-10-03 13:24:21 -04:00
Joey Hess
c24ce026d8
change name of option
See https://bugs.debian.org/885987
2022-10-03 13:02:11 -04:00
Joey Hess
9c9174329e
bug report 2022-10-03 13:00:29 -04:00
jkniiv
82dab0749c Added a comment 2022-10-01 08:23:43 +00:00
jkniiv
be0aca9fa0 Added a comment: restage.log was empty indeed 2022-10-01 05:14:17 +00:00
Joey Hess
620ec5ab3e
Merge branch 'master' of ssh://git-annex.branchable.com 2022-09-30 14:04:40 -04:00
Joey Hess
d91c3500ea
add comments 2022-09-30 14:04:33 -04:00
Joey Hess
1328be2013
applied a patch 2022-09-30 14:04:10 -04:00
asakurareiko@f3d908c71c009580228b264f63f21c7274df7476
31f2922e7e 2022-09-30 18:03:50 +00:00
Reiko Asakura
445aa0d93b
Fix annex.adviceNoSshCaching having no effect
git will always return option names in lowercase
2022-09-30 14:03:06 -04:00
Joey Hess
49ee07f93d
fix flush of a closed file handle
Avoids displaying warning about git-annex restage needing to be run in
situations where it does not.

Closing a handle flushes it anyway, so no need for an explict flush. The
handle does get closed twice, but that's fine, the second one does nothing.

Sponsored-by: Dartmouth College's DANDI project
2022-09-30 14:02:31 -04:00
Joey Hess
8d8f7ee884
comment 2022-09-30 13:42:30 -04:00
Joey Hess
9e847d4786
update in response to comment 2022-09-30 13:33:59 -04:00