about summary refs log tree commit diff
path: root/src/libstore/local-store.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-07-20 nix-copy-closure: Add -v flagEelco Dolstra1-1/+3
And make exportPath() less spammy by default.
2015-07-20 More cleanupEelco Dolstra1-11/+3
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra1-73/+73
2015-06-22 Use posix_fallocate to create /nix/var/nix/db/reservedEelco Dolstra1-1/+11
2015-05-13 cygwin: explicitly include required c headersRok Garbas1-0/+1
2015-04-07 Revert /nix/store permission back to 01775Eelco Dolstra1-1/+1
This broke NixOS VM tests. Mostly reverts 27b7b94923d2f207781b438bb7a57669bddf7d2b, 5ce50cd99e740d0d0f18c30327ae687be9356553, afa433e58c3fe6029660a43fdc2073c9d15b4210.
2015-03-25 addToStore(): Take explicit name argumentEelco Dolstra1-2/+2
2015-01-08 Doh^2Eelco Dolstra1-1/+1
2015-01-08 DohEelco Dolstra1-3/+3
2015-01-08 Set /nix/store permission to 1737Eelco Dolstra1-4/+6
I.e., not readable to the nixbld group. This improves purity a bit for non-chroot builds, because it prevents a builder from enumerating store paths (i.e. it can only access paths it knows about).
2014-12-29 LocalStore initialization: Don't die if build-users-group doesn't existShea Levy1-11/+12
See NixOS/nixpkgs@9245516
2014-12-12 Shut up a Valgrind warningEelco Dolstra1-1/+1
2014-12-10 Don't wait for PID -1Eelco Dolstra1-1/+2
The pid field can be -1 if forking the substituter process failed.
2014-11-19 Clean up temp roots in a more C++ wayEelco Dolstra1-0/+9
2014-10-14 Improved error message when encountering unsupported file typesEelco Dolstra1-3/+3
Fixes #269.
2014-08-20 Use proper quotes everywhereEelco Dolstra1-64/+64
2014-08-05 Remove unnecessary call to addTempRoot()Eelco Dolstra1-1/+0
2014-08-01 Make readDirectory() return inode / file typeEelco Dolstra1-11/+9
2014-07-10 Replace message "importing path <...>" with "exporting path <...>"Eelco Dolstra1-2/+2
This causes nix-copy-closure to show what it's doing before rather than after.
2014-07-10 Refactoring: Move all fork handling into a higher-order functionEelco Dolstra1-25/+10
C++11 lambdas ftw.
2014-07-10 Remove maybeVforkEelco Dolstra1-1/+1
2014-05-02 Set up directories and permissions for multi-user install automaticallyEelco Dolstra1-1/+28
This automatically creates /nix/var/nix/profiles/per-user and sets the permissions/ownership on /nix/store to 1775 and root:nixbld.
2014-04-08 If a .drv cannot be parsed, show its pathEelco Dolstra1-2/+2
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-02-27 Set up a minimal /dev in chrootsEelco Dolstra1-2/+1
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
2014-02-17 Heuristically detect if a build may have failed due to a full diskEelco Dolstra1-2/+2
This will allow Hydra to detect that a build should not be marked as "permanently failed", allowing it to be retried later.
2014-02-03 Fix assertion failure in ‘nix-store --load-db’Eelco Dolstra1-1/+12
Namely: nix-store: derivations.cc:242: nix::Hash nix::hashDerivationModulo(nix::StoreAPI&, nix::Derivation): Assertion `store.isValidPath(i->first)' failed. This happened because of the derivation output correctness check being applied before the references of a derivation are valid.
2014-02-01 Give a friendly error message if the DB directory is not writableEelco Dolstra1-2/+6
Previously we would say "error: setting synchronous mode: unable to open database file" which isn't very helpful.
2013-11-22 Include <cstring> for memsetEelco Dolstra1-0/+1
This should fix building on Illumos.
2013-11-14 Remove nix-setuid-helperEelco Dolstra1-3/+3
AFAIK, nobody uses it, it's not maintained, and it has no tests.
2013-10-16 Retry all SQLite operationsEelco Dolstra1-128/+165
To deal with SQLITE_PROTOCOL, we also need to retry read-only operations.
2013-10-16 Fix a race in registerFailedPath()Eelco Dolstra1-2/+1
Registering the path as failed can fail if another process does the same thing after the call to hasPathFailed(). This is extremely unlikely though.
2013-10-16 Convenience macros for retrying a SQLite transactionEelco Dolstra1-46/+42
2013-10-16 Don't wrap read-only queries in a transactionEelco Dolstra1-6/+0
There is no risk of getting an inconsistent result here: if the ID returned by queryValidPathId() is deleted from the database concurrently, subsequent queries involving that ID will simply fail (since IDs are never reused).
2013-10-16 Print a distinct warning for SQLITE_PROTOCOLEelco Dolstra1-4/+8
2013-10-16 Treat SQLITE_PROTOCOL as SQLITE_BUSYEelco Dolstra1-1/+1
In the Hydra build farm we fairly regularly get SQLITE_PROTOCOL errors (e.g., "querying path in database: locking protocol"). The docs for this error code say that it "is returned if some other process is messing with file locks and has violated the file locking protocol that SQLite uses on its rollback journal files." However, the SQLite source code reveals that this error can also occur under high load: if( cnt>5 ){ int nDelay = 1; /* Pause time in microseconds */ if( cnt>100 ){ VVA_ONLY( pWal->lockError = 1; ) return SQLITE_PROTOCOL; } if( cnt>=10 ) nDelay = (cnt-9)*238; /* Max delay 21ms. Total delay 996ms */ sqlite3OsSleep(pWal->pVfs, nDelay); } i.e. if certain locks cannot be not acquired, SQLite will retry a number of times before giving up and returing SQLITE_PROTOCOL. The comments say: Circumstances that cause a RETRY should only last for the briefest instances of time. No I/O or other system calls are done while the locks are held, so the locks should not be held for very long. But if we are unlucky, another process that is holding a lock might get paged out or take a page-fault that is time-consuming to resolve, during the few nanoseconds that it is holding the lock. In that case, it might take longer than normal for the lock to free. ... The total delay time before giving up is less than 1 second. On a heavily loaded machine like lucifer (the main Hydra server), which often has dozens of processes waiting for I/O, it seems to me that a page fault could easily take more than a second to resolve. So, let's treat SQLITE_PROTOCOL as SQLITE_BUSY and retry the transaction. Issue NixOS/hydra#14.
2013-08-26 Fix typos, especially those that end up in the Nix manualIvan Kozik1-1/+1
2013-08-07 Run the daemon worker on the same CPU as the clientEelco Dolstra1-0/+2
On a system with multiple CPUs, running Nix operations through the daemon is significantly slower than "direct" mode: $ NIX_REMOTE= nix-instantiate '<nixos>' -A system real 0m0.974s user 0m0.875s sys 0m0.088s $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m2.118s user 0m1.463s sys 0m0.218s The main reason seems to be that the client and the worker get moved to a different CPU after every call to the worker. This patch adds a hack to lock them to the same CPU. With this, the overhead of going through the daemon is very small: $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m1.074s user 0m0.809s sys 0m0.098s
2013-06-20 Increase SQLite's auto-checkpoint intervalEelco Dolstra1-2/+2
Common operations like instantiating a NixOS system config no longer fitted in 8192 pages, leading to more fsyncs. So increase this limit.
2013-06-20 Don't keep "disabled" substituters runningEelco Dolstra1-2/+25
For instance, it's pointless to keep copy-from-other-stores running if there are no other stores, or download-using-manifests if there are no manifests. This also speeds things up because we don't send queries to those substituters.
2013-06-13 Allow hard links between the outputs of a derivationEelco Dolstra1-7/+8
2013-06-13 In repair mode, update the hash of rebuilt pathsEelco Dolstra1-3/+4
Otherwise subsequent invocations of "--repair" will keep rebuilding the path. This only happens if the path content differs between builds (e.g. due to timestamps).
2013-06-07 Remove obsolete EOF checksEelco Dolstra1-26/+18
2013-06-07 Process stderr from substituters while doing have/info queriesEelco Dolstra1-9/+50
2013-06-07 Buffer reads from the substituterEelco Dolstra1-10/+22
This greatly reduces the number of system calls.
2013-05-01 Don't let stderr writes in substituters cause a deadlockEelco Dolstra1-0/+4
2013-03-25 makeStoreWritable: Ask forgiveness, not permissionShea Levy1-2/+2
It is surprisingly impossible to check if a mountpoint is a bind mount on Linux, and in my previous commit I forgot to check if /nix/store was even a mountpoint at all. statvfs.f_flag is not populated with MS_BIND (and even if it were, my check was wrong in the previous commit). Luckily, the semantics of mount with MS_REMOUNT | MS_BIND make both checks unnecessary: if /nix/store is not a mountpoint, then mount will fail with EINVAL, and if /nix/store is not a bind-mount, then it will not be made writable. Thus, if /nix/store is not a mountpoint, we fail immediately (since we don't know how to make it writable), and if /nix/store IS a mountpoint but not a bind-mount, we fail at first write (see below for why we can't check and fail immediately). Note that, due to what is IMO buggy behavior in Linux, calling mount with MS_REMOUNT | MS_BIND on a non-bind readonly mount makes the mountpoint appear writable in two places: In the sixth (but not the 10th!) column of mountinfo, and in the f_flags member of struct statfs. All other syscalls behave as if the mount point were still readonly (at least for Linux 3.9-rc1, but I don't think this has changed recently or is expected to soon). My preferred semantics would be for MS_REMOUNT | MS_BIND to fail on a non-bind mount, as it doesn't make sense to remount a non bind-mount as a bind mount.
2013-03-25 makeStoreWritable: Use statvfs instead of /proc/self/mountinfo to find out ↵Shea Levy1-21/+12
if /nix/store is a read-only bind mount /nix/store could be a read-only bind mount even if it is / in its own filesystem, so checking the 4th field in mountinfo is insufficient. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-03-08 Revert "Prevent config.h from being clobbered"Eelco Dolstra1-37/+79
This reverts commit 28bba8c44f484eae38e8a15dcec73cfa999156f6.
2013-03-07 Prevent config.h from being clobberedEelco Dolstra1-79/+37
2013-02-28 Handle systems without lutimes() or lchown()Eelco Dolstra1-1/+1