about summary refs log tree commit diff
path: root/src/libstore/s3-binary-cache-store.cc
AgeCommit message (Collapse)AuthorFilesLines
2018-08-09 S3BinaryCacheStore: Share TransferManagerEelco Dolstra1-18/+24
TransferManager allocates a lot of memory (50 MiB by default), and it might leak but I'm not sure about that. In any case it was causing OOMs in hydra-queue-runner. So allocate only one TransferManager per S3BinaryCacheStore. Hopefully fixes https://github.com/NixOS/hydra/issues/586.
2018-08-08 S3BinaryCacheStore: Don't use the transfer status callbackEelco Dolstra1-24/+13
This callback is executed on a different thread, so exceptions thrown from the callback are not caught: Aug 08 16:25:48 chef hydra-queue-runner[11967]: terminate called after throwing an instance of 'nix::Error' Aug 08 16:25:48 chef hydra-queue-runner[11967]: what(): AWS error: failed to upload 's3://nix-cache/19dbddlfb0vp68g68y19p9fswrgl0bg7.ls' Therefore, just check the transfer status after it completes. Also include the S3 error message in the exception.
2018-08-06 Fix setting Content-Encoding in S3 uploadsEelco Dolstra1-6/+4
Fixes https://github.com/NixOS/nix/issues/2333 and https://github.com/NixOS/nixpkgs/issues/44337.
2018-08-06 Fix Brotli decompression in 'nix log'Eelco Dolstra1-4/+2
This didn't work anymore since decompression was only done in the non-coroutine case. Decompressors are now sinks, just like compressors. Also fixed a bug in bzip2 API handling (we have to handle BZ_RUN_OK rather than BZ_OK), which we didn't notice because there was a missing 'throw': if (ret != BZ_OK) CompressionError("error while compressing bzip2 file");
2018-08-02 s3 binary cache: support specifying an endpointGraham Christensen1-5/+9
Works for uploading and not downloading.
2018-06-08 use debug instead of printTalkative to avoid spamming hydra queueAmineChikhaoui1-1/+1
runner logs.
2018-05-30 Make LocalBinaryCacheStore::narFromPath() run in constant memoryEelco Dolstra1-12/+12
This reduces memory consumption of nix copy --from file://... --to ~/my-nix /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 514 MiB to 18 MiB for an uncompressed binary cache, and from 192 MiB to 53 MiB for a bzipped binary cache. It may also be faster because fetching can happen concurrently with decompression/writing. Continuation of 48662d151bdf4a38670897beacea9d1bd750376a. Issue https://github.com/NixOS/nix/issues/1681.
2018-05-30 Simplify the callback mechanismEelco Dolstra1-5/+4
2018-05-10 Remove mention of default since we already know the defaultEelco Dolstra1-1/+1
2018-05-07 share the executor between multiple copy threads.AmineChikhaoui1-2/+2
2018-05-07 add a FIXME note to find a way to abort the multipart uploads inAmineChikhaoui1-2/+2
case the nix command is interrupted.
2018-05-07 Support multi-part uploads for large NARs that exceed the size ofAmineChikhaoui1-16/+64
5Gb.
2017-12-22 Check aws-sdk-cpp versionEelco Dolstra1-1/+9
2017-12-14 Fix build against current aws-sdk-cppEelco Dolstra1-1/+1
2017-11-15 Add a "profile" option to S3BinaryCacheStoreEelco Dolstra1-3/+12
This allows specifying the AWS configuration profile to use. E.g. nix copy --from s3://my-cache?profile=aws-dev-account /nix/store/cf3isrlqavvd5w7rpky1fa8j9lcnlggm-...
2017-11-03 Don't freak out if we get a 403 from S3Daniel Peebles1-2/+2
As far as we're concerned, not being able to access a file just means the file is missing. Plus, AWS explicitly goes out of its way to return a 403 if the file is missing and the requester doesn't have permission to list the bucket. Also getting rid of an old hack that Eelco said was only relevant to an older AWS SDK.
2017-07-30 Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim1-12/+12
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-06-19 Disable use of virtual hosting in aws-sdk-cppEelco Dolstra1-1/+1
Recently aws-sdk-cpp quietly switched to using S3 virtual host URIs (https://github.com/aws/aws-sdk-cpp/commit/69d9c53882), i.e. it sends requests to http://<bucket>.<region>.s3.amazonaws.com rather than http://<region>.s3.amazonaws.com/<bucket>. However this interacts badly with curl connection reuse. For example, if we do the following: 1) Check whether a bucket exists using GetBucketLocation. 2) If it doesn't, create it using CreateBucket. 3) Do operations on the bucket. then 3) will fail for a minute or so with a NoSuchBucket exception, presumably because the server being hit is a fallback for cases when buckets don't exist. Disabling the use of virtual hosts ensures that 3) succeeds immediately. (I don't know what S3's consistency guarantees are for bucket creation, but in practice buckets appear to be available immediately.)
2017-06-19 Support creating S3 caches in other regions than us-east-1Eelco Dolstra1-4/+10
2017-06-19 Handle S3Errors::RESOURCE_NOT_FOUND from aws-sdk-cppEelco Dolstra1-2/+4
This is returned by recent versions. Also handle NO_SUCH_KEY even though the library doesn't actually return that at the moment.
2017-06-19 Suppress "will retry in N ms" for non-retriable errorsEelco Dolstra1-5/+6
Newer versions of aws-sdk-cpp call CalculateDelayBeforeNextRetry() even for non-retriable errors (like NoSuchKey) whih causes log spam in hydra-queue-runner.
2017-06-19 Show aws-sdk-cpp log messagesEelco Dolstra1-0/+22
2017-06-14 Remove redundant debug lineEelco Dolstra1-2/+0
2017-04-13 Add a Config class to simplify adding configuration settingsEelco Dolstra1-6/+6
The typical use is to inherit Config and add Setting<T> members: class MyClass : private Config { Setting<int> foo{this, 123, "foo", "the number of foos to use"}; Setting<std::string> bar{this, "blabla", "bar", "the name of the bar"}; MyClass() : Config(readConfigFile("/etc/my-app.conf")) { std::cout << foo << "\n"; // will print 123 unless overriden } }; Currently, this is used by Store and its subclasses for store parameters. You now get a warning if you specify a non-existant store parameter in a store URI.
2017-03-21 Move istringstream_nocopy to a separate fileEelco Dolstra1-0/+1
2017-03-20 Merge branch 'darwin-s3-binary-cache-store' of https://github.com/shlevy/nixEelco Dolstra1-13/+0
2017-03-15 More precise compression settingsEelco Dolstra1-5/+8
2017-03-15 Compress NAR listings using the "text-compression" methodEelco Dolstra1-2/+2
So if "text-compression=br", the .ls file in S3 will get a Content-Encoding of "br". Brotli appears to compress better than xz for this kind of file and is natively supported by browsers.
2017-03-15 S3BinaryCacheStore: Set Content-TypeEelco Dolstra1-5/+9
This is necessary for serving log files to browsers.
2017-03-15 S3BinaryCacheStore: Support compression of narinfo and log filesEelco Dolstra1-3/+25
You can now set the store parameter "text-compression=br" to compress textual files in the binary cache (i.e. narinfo and logs) using Brotli. This sets the Content-Encoding header; the extension of compressed files is unchanged. You can separately specify the compression of log files using "log-compression=br". This is useful when you don't want to compress narinfo files for backward compatibility.
2017-03-12 Merge branch 'configurable-aws-region'Shea Levy1-4/+5
2017-03-06 Properly set the caFile for aws-sdk-cpp s3Shea Levy1-0/+1
2017-03-06 istringstream_nocopy: Implement in a standards-compliant way.Shea Levy1-13/+0
Fixes the problem mentioned in e6a61b8da788efbbbb0eb690c49434b6b5fc9741 See #1135
2017-03-03 Add aws-region param to S3 store URLsShea Levy1-4/+5
2017-02-21 Log AWS retriesEelco Dolstra1-0/+14
2017-02-14 Add support for s3:// URIsEelco Dolstra1-61/+80
This adds support for s3:// URIs in all places where Nix allows URIs, e.g. in builtins.fetchurl, builtins.fetchTarball, <nix/fetchurl.nix> and NIX_PATH. It allows fetching resources from private S3 buckets, using credentials obtained from the standard places (i.e. AWS_* environment variables, ~/.aws/credentials and the EC2 metadata server). This may not be super-useful in general, but since we already depend on aws-sdk-cpp, it's a cheap feature to add.
2017-02-08 Include config.h implicitly with '-include config.h' in CFLAGSTuomas Tynkkynen1-2/+0
Because config.h can #define things like _FILE_OFFSET_BITS=64 and not every compilation unit includes config.h, we currently compile half of Nix with _FILE_OFFSET_BITS=64 and other half with _FILE_OFFSET_BITS unset. This causes major havoc with the Settings class on e.g. 32-bit ARM, where different compilation units disagree with the struct layout. E.g.: diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc @@ -166,6 +166,8 @@ void Settings::update() _get(useSubstitutes, "build-use-substitutes"); + fprintf(stderr, "at Settings::update(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); _get(buildUsersGroup, "build-users-group"); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -138,6 +138,8 @@ void RemoteStore::initConnection(Connection & conn) void RemoteStore::setOptions(Connection & conn) { + fprintf(stderr, "at RemoteStore::setOptions(): &useSubstitutes = %p\n", &nix::settings.useSubstitutes); conn.to << wopSetOptions Gave me: at Settings::update(): &useSubstitutes = 0xb6e5c5cb at RemoteStore::setOptions(): &useSubstitutes = 0xb6e5c5c7 That was not a fun one to debug!
2016-12-22 Call Aws::InitAPIEelco Dolstra1-1/+17
This is required now.
2016-12-08 S3BinaryCacheStore: Ensure it only builds on LinuxEelco Dolstra1-0/+2
2016-12-08 Fix S3BinaryCacheStoreEelco Dolstra1-0/+9
It failed with AWS error uploading ‘6gaxphsyhg66mz0a00qghf9nqf7majs2.ls.xz’: Unable to parse ExceptionName: MissingContentLength Message: You must provide the Content-Length HTTP header. possibly because the istringstream_nocopy introduced in 0d2ebb4373e509521f27a6e8f16bfd39d05b2188 doesn't supply the seek method that the AWS library expects. So bring back the old version, but only for S3BinaryCacheStore.
2016-11-26 Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra1-11/+11
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25 Get rid of unicode quotes (#1140)Guillaume Maudoux1-11/+11
2016-11-16 S3BinaryCacheStore:: Eliminate a string copy while uploadingEelco Dolstra1-1/+1
This cuts hydra-queue-runner's peak memory usage by about a third.
2016-10-06 Fix getS3Stats()Eelco Dolstra1-1/+1
2016-09-21 printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra1-1/+1
2016-09-16 Make computeFSClosure() single-threaded againEelco Dolstra1-26/+30
The fact that queryPathInfo() is synchronous meant that we needed a thread for every concurrent binary cache lookup, even though they end up being handled by the same download thread. Requiring hundreds of threads is not a good idea. So now there is an asynchronous version of queryPathInfo() that takes a callback function to process the result. Similarly, enqueueDownload() now takes a callback rather than returning a future. Thus, a command like nix path-info --store https://cache.nixos.org/ -r /nix/store/slljrzwmpygy1daay14kjszsr9xix063-nixos-16.09beta231.dccf8c5 that returns 4941 paths now takes 1.87s using only 2 threads (the main thread and the downloader thread). (This is with a prewarmed CloudFront.)
2016-06-01 HttpBinaryCacheStore: Fix caching of WantMassQueryEelco Dolstra1-1/+1
Also, test HttpBinaryCacheStore in addition to LocalBinaryCacheStore.
2016-06-01 Make the store directory a member variable of StoreEelco Dolstra1-4/+4
2016-05-31 Shut up some clang warningsEelco Dolstra1-6/+6
2016-05-30 Fix buildEelco Dolstra1-1/+1