Commit Graph

1966 Commits

Author SHA1 Message Date
Colin Walters
ee4e393fa1 repo: Store pending objects in prefixed subdirectory
I was hitting a bug in libguestfs/guestmount/FUSE where it blew up
with EINVAL on directories containing lots of files (more than
32000?).  We really want to use prefixed subdirs just like the real
objects/ directory does.

This allows us to share more code between the paths, is more
efficient, etc.
2015-02-15 15:30:19 -05:00
Colin Walters
49bdbf1db0 repo: Fix major performance regression with --scan-hardlinks
gnome-continuous uses the ostree_repo_scan_hardlinks() mode to
avoid re-checksumming everything.  However, when I ported the commit
code to use openat() and friends, this optimization was lost.

Re add it.  The difference is about 15s versus 5 minutes.
2015-02-13 16:36:07 -05:00
Colin Walters
64363c26ac pull-local: Fix regression with absolute paths
Don't add cwd unless the path is relative.
2015-02-13 11:39:36 -05:00
Colin Walters
9cc9804195 Change pull-local to just be a wrapper for pull with file:///
This follows up from the previous commit; now that pull knows how to
do the efficient link() or copy for local files, we can just have
pull-local call into ostree_repo_pull().

As part of this:
 - pull() can also accept a file:/// URI instead
   of a remote name (since pull local supports anonymous pulls)
 - pull() knows an "override-remote-name" option, since pull-local
   supported writing a ref out even if there wasn't a remote with
   that name
2015-02-08 04:43:06 -05:00
Colin Walters
ab3bf493dd pull: Optimize file:/// URIs to skip libsoup and hardlink if possible
It's always been suboptimal to have both pull and pull-local; as we go
beyond the raw object data into things like deltas and summary files,
the logic to perform e.g. mirroring should only be in one place.

This will be used by Pulp's OSTree content plugin at least to perform
promotions.
2015-02-06 10:02:57 -05:00
Colin Walters
be4ad54800 Add an internal API to get a read fd for a content object
This will be used by the static deltas work.
2015-02-05 21:50:26 -05:00
Colin Walters
1fdecbd263 pull: Copy the upstream summary file when doing a pull --mirror
While it could be regenerated downstream, there might be other
metadata upstream, and the goal here is a mirror.

https://bugzilla.gnome.org/show_bug.cgi?id=739377
2015-02-05 21:24:21 -05:00
Colin Walters
fab1e113db When mirroring, write content directly, do not verify
When doing a pull --mirror from an archive-z2 repository into another
archive-z2 repository, currently we gunzip/checksum/gzip each content
object.  The re-gzip process in particular is fairly expensive.

This does assume that the upstream content is trusted and correct.
It'd be nice in the future to do at least a CRC check, if not the full
checksum.  (Could we append CRC data to the end of filez objects?)

We could also choose to only do this optimization if fetching over
TLS.

before: 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 62 seconds
after : 1626 metadata, 20320 content objects fetched; 299634 KiB transferred in 11 seconds
2015-02-05 21:24:21 -05:00
Colin Walters
247866a9bc Add an internal API to stream content objects
For future delta work where we do more interesting things than just
"tar of new objects", this lays the groundwork for doing streaming
writes into content objects.

It's also more efficient, as we avoid many intermediate allocations
and virtual calls.  Just a single `g_output_stream_write_all` for the
splice case.

Conflicts:
	src/libostree/ostree-repo-private.h
	src/libostree/ostree-repo-static-delta-processing.c
2015-02-05 19:15:27 -05:00
Colin Walters
65afe1110d util: Add an API to atomic-replace a file, dirfd relative, optional fsync
This can be used in other places too, but I plan to use it to write
the summary file.
2015-02-05 16:59:52 -05:00
Colin Walters
3b8ed12ab2 repo: Hold an fd "repo_dir_fd" open for the toplevel too
We could just make everything relative to this, but the objects/ and
tmp/ are accessed very often, so I think it's worth holding individual
fds.

This fd can cover everything else: refs, deltas, etc.
2015-02-05 14:15:34 -05:00
Colin Walters
e739677ea1 prepare-root: Update comments 2015-02-04 05:32:45 -05:00
Daniel Drake
4f75d4ea0b prepare-root: avoid double-stacked /sysroot mount
prepare-root works with the mount that has been set up at /sysroot.
It creates a bind-mount within /sysroot (the deployment) and then moves
that mount to /sysroot.

Now we have 2 mounts both at /sysroot, and once we do switch_root, we will
never be able to unmount both of them. I'm not sure if this is ultimately
a kernel bug, but either way, ostree could do a bit more tidying up
after itself.
http://thread.gmane.org/gmane.linux.file-systems/92411

Easy way to reproduce:
1. Boot with rd.break param
2. At initramfs shell, run: ostree-prepare-root /sysroot
3. Observe two /sysroot mounts in /proc/mounts

Fix this by setting up the mounts at /sysroot.tmp, and unmounting the
original /sysroot before our new mount is MS_MOVEd on top of it.
2015-02-03 20:28:37 -05:00
Colin Walters
89a8b9b85a packaging: Add man5 pages 2015-02-03 20:28:37 -05:00
Giuseppe Scrivano
cfc344fbb0 tests: Add tests for ot-unix-utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:42:41 +01:00
Giuseppe Scrivano
a7b362998d configure.ac: Enable option subdir-objects for automake
It silences an automake warning and keep the rootdir cleaner.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:15:35 +01:00
Giuseppe Scrivano
53122dd2f9 tests: Move test-varint and test-rollsum under "make check"
"make check" tests are always enabled and they do not require to be
installed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:14:52 +01:00
Giuseppe Scrivano
6a3959c895 syntax-check: Remove empty lines at the end of file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 15:07:56 +01:00
Giuseppe Scrivano
27a45e2edb pull: use a single per-transaction syncfs instead of fsync
Do not write directly to objects/ but maintain pulled files under tmp/
with a "tmpobject-$CHECKSUM.$OBJTYPE" name until they are syncfs'ed to
disk.

Move them under objects/ at ostree_repo_commit_transaction cleanup
time.

Before (test done on a local network):

$ LANG=C sudo time ./ostree --repo=repo pull origin master

0 metadata, 3 content objects fetched; 83820 KiB; 4 delta parts
fetched, transferred in 417 seconds
16.42user 6.73system 6:57.19elapsed 5%CPU (0avgtext+0avgdata
248428maxresident)k
24inputs+794472outputs (0major+233968minor)pagefaults 0swaps

After:

$ LANG=C sudo time ./ostree --repo=repo pull origin master

0 metadata, 3 content objects fetched; 83820 KiB; 4 delta parts
fetched, transferred in 9 seconds
14.70user 2.87system 0:09.99elapsed 175%CPU (0avgtext+0avgdata
256168maxresident)k
0inputs+794472outputs (0major+164333minor)pagefaults 0swaps

https://bugzilla.gnome.org/show_bug.cgi?id=728065

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 14:03:42 -05:00
Giuseppe Scrivano
10642cd732 Replace "==" with "=" in shell script test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
505ce19972 Do not interleave spaces and tabs
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
e8cbd4b8c5 Remove magic argument numbers to exit(2)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
ea4683ba06 Remove unused <dirent.h>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
7154193ae0 Remove unused include <assert.h>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
e36d3bb25e syntax-check: quote the first argument to AC_DEFINE
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
b726796f41 Remove trailing dot from error message
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
42e8cd2691 Add infrastructure for "make syntax-check"
New files copied from the gnulib project.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
bb5d7bcf3a Fix repeated words.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Giuseppe Scrivano
7ebf7676cb Fix make distcheck
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-30 15:27:36 +01:00
Colin Walters
5b4500faf6 pull: (trivial) Fix English in function name
s/writed/written/
2015-01-25 09:14:21 -05:00
Colin Walters
94e2ac0253 Release 2015.3 2015-01-23 14:54:38 -05:00
Colin Walters
6ce80f9685 Explicitly label .origin files as configuration
subscription-manager has a daemon that runs in a confined domain,
and it doesn't have permission to write usr_t, which is the default
label of /ostree/deploy/$osname/deploy.

A better long term fix is probably to move the origin file into the
deployment root as /etc/ostree/origin.conf or so.

In the meantime, let's ensure the .origin files are labeled as
configuration.
2015-01-23 12:44:06 -05:00
Colin Walters
8f4999c854 build: Add --disable-static-deltas
Since they're unstable, we want to allow organizations shipping ostree
now to be future proof against any changes.
2015-01-22 21:21:34 -05:00
Colin Walters
f2e4830409 pull: Further extend static delta progress
With deltas, we have an accurate total size, among other things.
2015-01-22 09:07:13 -05:00
Colin Walters
e40b86221a pull: Distingiush delta pulls from loose better 2015-01-22 09:07:13 -05:00
Colin Walters
549f1ec7df commit: Fix segfault on async writes if object exists and checksum requested
If an object already existed and we somehow tried to pull it, the
caller would still expect a returned checksum.

This appears to happen with static deltas for some reason; we might be
including duplicate metadata objects.  Regardless, this is a bug that
should be fixed.
2015-01-21 21:17:47 -05:00
Colin Walters
28e5e6f27f traverse: Fix transfer on hash table
Otherwise, bindings try to erroneously unref the key/values as well.
2015-01-21 11:59:32 -05:00
Colin Walters
8195fd18e2 deltas: Use trusted writes
We have a chain of checksums from the root up until here.  While doing
checksums of the objects individually would be a good redundancy check
for test cases and the like, when doing a pull there's no good reason
to burn cycles on SHA256.
2015-01-20 23:28:26 -05:00
Colin Walters
6d1de23f87 deltas: Drop async content writes
This caused deadlocks and/or EMFILE due to the interaction between
threads and fds.  What we really want here is a better pull-based
model for parsing content objects.

Another idea would be to change static deltas so that content objects
have a special opcode that includes their metadata first, and then do
rollsums etc. only over actual content.
2015-01-20 23:21:26 -05:00
Colin Walters
d49fc876bb deltas: Unlink temporary metadata files before processing
Leaking them is bad.
2015-01-20 23:16:30 -05:00
Giuseppe Scrivano
4991e9ab6a static-delta: limit the number of writes in process to 1
This will avoid too many open files at the same time that could cause
an EMFILE error.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit bc092b06f0e34e93f7d6102957bf55fd7ffd1b9e)
2015-01-20 09:51:02 -05:00
Alexander Larsson
638431045c static delta generation: Separate max chunk size from min fallback size
There is no particular reason these have to be the same.

https://bugzilla.gnome.org/show_bug.cgi?id=721799
2015-01-20 14:45:45 +01:00
Colin Walters
6bbfa5f85a admin: Add set-origin command
See projectatomic/rpm-ostree#42 for rationale. There are two high
level use cases:

 - If the OS comes unconfigured, this is a way to point it at a repo of your choice.
 - To switch between repositories while keeping the same branch easily.
2015-01-19 13:55:20 -05:00
Colin Walters
886913abdc sysroot: Add ostree_sysroot_write_origin_file() API
We want to allow admins to change the origin file without doing a new
deployment, so this will be part of a future "admin set-origin"
command.
2015-01-19 13:45:11 -05:00
Colin Walters
1d216a8c60 cmdline: (cleanup) Add internal helper to parse key=value options
This will be used by a later "ostree admin set-origin" as well.
2015-01-19 13:45:11 -05:00
Colin Walters
0eac91a253 admin: (cleanup) Add internal API to find a deployment given an index
At some point, we might want to expose a uniform way to refer
to deployments by an index.  At the moment undeploy is the only
command that does.

I plan to introduce another command which optionally takes an index,
so prepare a helper function for this.
2015-01-19 13:45:11 -05:00
Giuseppe Scrivano
ce957f8649 editor: honor arguments environment variable
My EDITOR looks like "EDITOR=emacs -nw", ensure that it is honored.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-16 09:21:30 -05:00
Giuseppe Scrivano
f2ae405f9f static-delta: do not accept both --from=REV and --empty for generate
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-01-15 22:54:56 -05:00
Matthew Barnes
4841d9a935 doc: Manpage love for static-delta command 2015-01-15 15:49:49 -05:00
Colin Walters
2f9567ad56 deltas: Use *at() for writes
Yet another GFile* user goes away in a performance sensitive path.
2015-01-14 22:29:45 -05:00