aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
AgeCommit message (Collapse)Author
2011-12-16* Sync with the trunk.Eelco Dolstra
2011-12-16* importPath() -> importPaths(). Because of buffering of the inputEelco Dolstra
stream it's now necessary for the daemon to process the entire sequence of exported paths, rather than letting the client do it.
2011-12-16* Make the import operation through the daemon much more efficientEelco Dolstra
(way fewer roundtrips) by allowing the client to send data in bigger chunks. * Some refactoring.
2011-12-15* Refactoring: move sink/source buffering into separate classes.Eelco Dolstra
* Buffer the HashSink. This speeds up hashing a bit because it prevents lots of calls to the hash update functions (e.g. nix-hash went from 9.3s to 8.7s of user time on the closure of my /var/run/current-system).
2011-12-05* Remove unnecessary quotes. showPaths() already adds quotes.Eelco Dolstra
2011-12-02* In ‘nix-store --verify --check-contents’, repair missing hashesEelco Dolstra
rather than complain about them.
2011-11-23* Add an API function exportPaths() that provides the functionality ofEelco Dolstra
‘nix-store --export’. * Add a Perl module that provides the functionality of ‘nix-copy-closure --to’. This is used by build-remote.pl so it no longer needs to start a separate nix-copy-closure process. Also, it uses the Perl API to do the export, so it doesn't need to start a separate nix-store process either. As a result, nix-copy-closure and build-remote.pl should no longer fail on very large closures due to an "Argument list too long" error. (Note that having very many dependencies in a single derivation can still fail because the environment can become too large. Can't be helped though.)
2011-11-07* Boldly make SQLite WAL mode the default again. Hopefully theEelco Dolstra
intermittent problems are gone by now. WAL mode is preferrable because it does way fewer fsyncs.
2011-11-06Include all outputs of derivations in the closure of explicitly-passed ↵Shea Levy
derivation paths This required adding a queryOutputDerivationNames function in the store API
2011-09-12* Ouch. A store upgrade could cause a substituter to be triggered,Eelco Dolstra
causing a deadlock.
2011-08-31* Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
2011-07-20* Fix a huuuuge security hole in the Nix daemon. It didn't check thatEelco Dolstra
derivations added to the store by clients have "correct" output paths (meaning that the output paths are computed by hashing the derivation according to a certain algorithm). This means that a malicious user could craft a special .drv file to build *any* desired path in the store with any desired contents (so long as the path doesn't already exist). Then the attacker just needs to wait for a victim to come along and install the compromised path. For instance, if Alice (the attacker) knows that the latest Firefox derivation in Nixpkgs produces the path /nix/store/1a5nyfd4ajxbyy97r1fslhgrv70gj8a7-firefox-5.0.1 then (provided this path doesn't already exist) she can craft a .drv file that creates that path (i.e., has it as one of its outputs), add it to the store using "nix-store --add", and build it with "nix-store -r". So the fake .drv could write a Trojan to the Firefox path. Then, if user Bob (the victim) comes along and does $ nix-env -i firefox $ firefox he executes the Trojan injected by Alice. The fix is to have the Nix daemon verify that derivation outputs are correct (in addValidPath()). This required some refactoring to move the hash computation code to libstore.
2010-12-17* Do a short sleep after SQLITE_BUSY.Eelco Dolstra
2010-12-14* I forgot to catch SQLiteBusy in registerValidPaths(). SoEelco Dolstra
registerValidPaths() now handles busy errors and registerValidPath() is simply a wrapper around it.
2010-12-13* Create /nix/var/nix/db if it's missing.Eelco Dolstra
2010-12-08* Ignore the result of sqlite3_reset().Eelco Dolstra
2010-12-06* `nix-store --verify --check-contents': don't hold the global GC lockEelco Dolstra
while checking the contents, since this operation can take a very long time to finish. Also, fill in missing narSize fields in the DB while doing this.
2010-12-05* Retry a transaction if SQLite returns SQLITE_BUSY. This can happenEelco Dolstra
even with a very long busy timeout, because SQLITE_BUSY is also returned to resolve deadlocks. This should get rid of random "database is locked" errors. This is kind of hard to test though. * Fix a horrible bug in deleteFromStore(): deletePathWrapped() should be called after committing the transaction, not before, because the commit might not succeed.
2010-11-17* Before a build, show the disk space that the downloaded store pathsEelco Dolstra
will approximately require.
2010-11-17* Add an operation `nix-store -q --size'.Eelco Dolstra
2010-11-16* Store the size of a store path in the database (to be precise, theEelco Dolstra
size of the NAR serialisation of the path, i.e., `nix-store --dump PATH'). This is useful for Hydra.
2010-10-14* Wrap deleteFromStore() in a transaction. Otherwise there might be aEelco Dolstra
race with other processes that add new referrers to a path, resulting in the garbage collector crashing with "foreign key constraint failed". (Nix/4) * Make --gc --print-dead etc. interruptible.
2010-09-01* Only do "pragma journal_mode = ..." if the current journal modeEelco Dolstra
differs from the desired mode. There is an open SQLite ticket `Executing "PRAGMA journal_mode" may delete journal file while it is in use.'
2010-08-31`nix-store --verify' improvements:Eelco Dolstra
* If a path has disappeared, check its referrers first, and don't try to invalidate paths that have valid referrers. Otherwise we get a foreign key constraint violation. * Read the whole Nix store directory instead of statting each valid path, which is slower. * Acquire the global GC lock.
2010-08-24* Don't complain if the stored hash of a path is zero (unknown).Eelco Dolstra
2010-08-04* Use SQLite 3.7.0's write-ahead logging (WAL mode). This is a lotEelco Dolstra
faster than the old mode when fsyncs are enabled, because it only performs an fsync() when doing a checkpoint, rather than at every commit. Some timings for doing a "nix-instantiate /etc/nixos/nixos -A system" after modifying the stdenv setup script: 42.5s - SQLite 3.6.23 with truncate mode and fsync 3.4s - SQLite 3.6.23 with truncate mode and no fsync 32.1s - SQLite 3.7.0 with truncate mode and fsync 16.8s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint every 1000 pages 8.3s - SQLite 3.7.0 with WAL mode and fsync, auto-checkpoint every 8192 pages 1.7s - SQLite 3.7.0 with WAL mode and no fsync The default is now to use WAL mode with fsyncs. Because WAL doesn't work on remote filesystems such as NFS (as it uses shared memory), truncate mode can be re-enabled by setting the "use-sqlite-wal" option to false.
2010-06-21* Okay, putting a lock on the temporary directory used by importPath()Eelco Dolstra
doesn't work because the garbage collector doesn't actually look at locks. So r22253 was stupid. Use addTempRoot() instead. Also, locking the temporary directory in exportPath() was silly because it isn't even in the store.
2010-06-21* Sync with the trunk.Eelco Dolstra
2010-06-14* In importPath() and exportPath(), lock the temporary directory toEelco Dolstra
prevent it from being deleted by the garbage collector.
2010-06-08* Replacing ValidPath rows doesn't work because it causes a constraintEelco Dolstra
violation of the Refs table. So don't do that.
2010-05-12* Sync with the trunk.Eelco Dolstra
2010-04-26* Added a command `nix-store --clear-failed-paths <PATHS>' to clearEelco Dolstra
the "failed" status of the given store paths. The special value `*' clears all failed paths.
2010-04-26* Add an command `nix-store --query-failed-paths' to list the cachedEelco Dolstra
failed paths (when using the `build-cache-failure' option).
2010-04-19* Don't use the ATerm library for parsing/printing .drv files.Eelco Dolstra
2010-03-10* Remove a debug statement.Eelco Dolstra
2010-03-09* In `nix-store --export', abort if the contents of a path hasEelco Dolstra
changed. This prevents corrupt paths from spreading to other machines. Note that checking the hash is cheap because we're hashing anyway (because of the --sign feature).
2010-03-08* Increase the sqlite timeout.Eelco Dolstra
2010-03-02* checkInterrupt() shouldn't be called from a destructor.Eelco Dolstra
2010-02-24* Support read-only access to the database.Eelco Dolstra
2010-02-24* Refactor the upgrade / database initialisation logic a bit.Eelco Dolstra
2010-02-24* Don't use fdatasync since it doesn't work on Snow Leopard.Eelco Dolstra
* Don't refer to config.h in util.hh, because config.h is not installed (http://hydra.nixos.org/build/303053).
2010-02-24* A function to query just the database id of a valid path.Eelco Dolstra
2010-02-24* Use `truncate' journal mode, which should be a bit faster.Eelco Dolstra
2010-02-24* Disable fsync() in SQLite if the fsync-metadata option is set toEelco Dolstra
false. * Change the default for `fsync-metadata' to true. * Disable `fsync-metadata' in `make check'.
2010-02-24* Do registerValidPaths() in one transaction, which is much faster.Eelco Dolstra
E.g. it cuts the runtime of the referrers test from 50s to 23s.
2010-02-24* Use normal (rather than full) synchronous mode, which I gather fromEelco Dolstra
the description at http://www.sqlite.org/atomiccommit.html should be safe enough.
2010-02-22(no commit message)Eelco Dolstra
2010-02-22* The database needs a trigger to get rid of self-references toEelco Dolstra
prevent a foreign key constraint violation on the Refs table when deleting a path.
2010-02-22* Get derivation outputs from the database instead of the .drv file,Eelco Dolstra
which requires more I/O.
2010-02-22* Revert r19650 (implement gc-keep-outputs by looking for derivationsEelco Dolstra
with the same name as the output) and instead use the DerivationOutputs table in the database, which is the correct way to to do things.