S3BinaryCacheStore::isValidPath(): Do a GET instead of HEAD

[?]
Feb 19, 2016, 4:41 PM
QSBS2ISOQ2ZFYZIAZPWD26UYFSWIFWR47R5WUEJKIQJKKJWXOZDAC

Dependencies

  • [2] XLYHZUHT Cache .narinfo lookups
  • [3] W2AOTSS6 Rename class
  • [4] 32HHP5CW hydra-queue-runner: Support generating a signed binary cache
  • [5] SOB276BA Keep some statistics for the binary cache stores
  • [6] 73YR46NJ hydra-queue-runner: Write directly to a binary cache
  • [7] GTUZLZRH Add an S3-backed binary cache store
  • [8] EOO4EFWD Use a single BinaryCacheStore for all threads
  • [9] N2NKSKHS Refactor local binary cache code into a subclass

Change contents

  • edit in src/hydra-queue-runner/binary-cache-store.cc at line 105
    [2.218][2.218:219](),[2.219][3.519:544](),[3.4304][3.519:544]()
    stats.narInfoRead++;
  • edit in src/hydra-queue-runner/binary-cache-store.cc at line 109
    [2.333]
    [3.5476]
    stats.narInfoRead++;
  • edit in src/hydra-queue-runner/binary-cache-store.hh at line 76
    [3.9630]
    [3.9719]
    protected:
  • edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 2
    [3.1334]
    [3.1334]
    #include "nar-info.hh"
  • edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 14
    [3.1657]
    [3.1657]
    struct S3Error : public Error
    {
    Aws::S3::S3Errors err;
    S3Error(Aws::S3::S3Errors err, const FormatOrString & fs)
    : Error(fs), err(err) { };
    };
  • replacement in src/hydra-queue-runner/s3-binary-cache-store.cc at line 28
    [3.1888][3.1888:1969]()
    throw Error(format("AWS error: %1%") % outcome.GetError().GetMessage());
    [3.1888]
    [3.1969]
    throw S3Error(
    outcome.GetError().GetErrorType(),
    format("AWS error: %1%") % outcome.GetError().GetMessage());
  • edit in src/hydra-queue-runner/s3-binary-cache-store.cc at line 79
    [3.4987]
    [3.3480]
    }
    /* This is a specialisation of isValidPath() that optimistically
    fetches the .narinfo file, rather than first checking for its
    existence via a HEAD request. Since .narinfos are small, doing a
    GET is unlikely to be slower than HEAD. */
    bool S3BinaryCacheStore::isValidPath(const Path & storePath)
    {
    try {
    readNarInfo(storePath);
    return true;
    } catch (S3Error & e) {
    if (e.err == Aws::S3::S3Errors::NO_SUCH_KEY) return false;
    throw;
    }
  • edit in src/hydra-queue-runner/s3-binary-cache-store.hh at line 41
    [3.5862]
    [3.5862]
    bool isValidPath(const Path & storePath) override;