Pool local store connections

[?]
Feb 19, 2016, 11:04 PM
GJV2J5HXFKVF7BXNFMTI6ZZMYADXIKTFIQJ3FONJ7DPVCUJZ2L4AC

Dependencies

  • [2] XLYHZUHT Cache .narinfo lookups
  • [3] K5G5GZY7 Guard against concurrent invocations of hydra-queue-runner
  • [4] MHVIT4JY Split hydra-queue-runner.cc more
  • [5] 32HHP5CW hydra-queue-runner: Support generating a signed binary cache
  • [6] EOO4EFWD Use a single BinaryCacheStore for all threads
  • [7] 24BMQDZA Start of single-process hydra-queue-runner
  • [8] YZAI5GQU Implement a database connection pool
  • [9] 5AIYUMTB Basic remote building
  • [10] ATJ54SPX Use PostgreSQL notifications for queue events
  • [11] GTUZLZRH Add an S3-backed binary cache store
  • [12] RND7XFNH getQueuedBuilds(): Periodically stop to handle priority bumps
  • [13] 73YR46NJ hydra-queue-runner: Write directly to a binary cache
  • [14] N2NKSKHS Refactor local binary cache code into a subclass
  • [15] W2AOTSS6 Rename class
  • [16] SOB276BA Keep some statistics for the binary cache stores
  • [17] HJOEIMLR Refactor

Change contents

  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 237
    [3.8053][3.8053:8104]()
    if (!localStore->isValidPath(storePath)) {
    [3.8053]
    [3.8104]
    if (!(*localStore)->isValidPath(storePath)) {
  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 241
    [3.8172][3.8172:8239]()
    ValidPathInfo info = localStore->queryPathInfo(storePath);
    [3.8172]
    [3.8239]
    ValidPathInfo info = (*localStore)->queryPathInfo(storePath);
  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 249
    [3.8428][3.8428:8486]()
    localStore->querySubstitutablePathInfos(left, infos);
    [3.8428]
    [3.8486]
    //(*localStore)->querySubstitutablePathInfos(left, infos);
  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 261
    [3.8696][3.8696:8740]()
    localStore->addTempRoot(storePath);
    [3.8696]
    [3.8740]
    (*localStore)->addTempRoot(storePath);
  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 263
    [3.8741][3.8741:8837]()
    if (!localStore->isValidPath(storePath))
    localStore->ensurePath(storePath);
    [3.8741]
    [3.8837]
    if (!(*localStore)->isValidPath(storePath))
    (*localStore)->ensurePath(storePath);
  • replacement in src/hydra-queue-runner/binary-cache-store.cc at line 266
    [3.8838][3.8838:8905]()
    ValidPathInfo info = localStore->queryPathInfo(storePath);
    [3.8838]
    [3.8905]
    ValidPathInfo info = (*localStore)->queryPathInfo(storePath);
  • edit in src/hydra-queue-runner/binary-cache-store.hh at line 8
    [2.619]
    [3.657]
    #include "pool.hh"
  • replacement in src/hydra-queue-runner/binary-cache-store.hh at line 19
    [3.341][3.341:391]()
    typedef std::function<ref<Store>()> StoreFactory;
    [3.341]
    [3.9309]
    typedef Pool<nix::ref<nix::Store>> StorePool;
    typedef std::function<StorePool::Handle()> StoreFactory;
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 21
    [3.7501]
    [3.7501]
    : localStorePool([]() { return std::make_shared<ref<Store>>(openStore()); })
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 30
    [3.1546][3.1546:1580]()
    ref<Store> State::getLocalStore()
    [3.1546]
    [3.1580]
    StorePool::Handle State::getLocalStore()
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 32
    [3.1582][3.1582:1621]()
    return openStore(); // FIXME: pool
    [3.1582]
    [3.1621]
    auto conn(localStorePool.get());
    return conn;
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 738
    [3.4675][3.4675:4853]()
    []() { return openStore(); },
    "/home/eelco/Misc/Keys/test.nixos.org/secret",
    "/home/eelco/Misc/Keys/test.nixos.org/public",
    "nix-test-cache-3");;
    [3.4675]
    [3.4853]
    [this]() { return this->getLocalStore(); },
    "/home/eelco/hydra/secret",
    "/home/eelco/hydra/public",
    "nix-test-cache");
  • edit in src/hydra-queue-runner/pool.hh at line 5
    [3.938]
    [3.938]
    #include <functional>
  • edit in src/hydra-queue-runner/pool.hh at line 29
    [3.1411]
    [3.1411]
    public:
    typedef std::function<std::shared_ptr<R>()> Factory;
  • edit in src/hydra-queue-runner/pool.hh at line 34
    [3.1420]
    [3.1420]
    Factory factory;
  • edit in src/hydra-queue-runner/pool.hh at line 47
    [3.1560]
    [3.1560]
    Pool(const Factory & factory = []() { return std::make_shared<R>(); })
    : factory(factory)
    { }
  • replacement in src/hydra-queue-runner/pool.hh at line 89
    [3.2508][3.2508:2561]()
    return Handle(*this, std::make_shared<R>());
    [3.2508]
    [3.2561]
    return Handle(*this, factory());
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 39
    [3.20820][3.12357:12437]()
    bool done = getQueuedBuilds(*conn, localStore, destStore, lastBuildId);
    [3.20820]
    [3.20872]
    bool done = getQueuedBuilds(*conn, *localStore, destStore, lastBuildId);
  • edit in src/hydra-queue-runner/state.hh at line 18
    [3.1439]
    [3.1461]
    #include "binary-cache-store.hh" // FIXME
  • edit in src/hydra-queue-runner/state.hh at line 351
    [3.6778]
    [3.1429]
    /* Pool of local stores. */
    nix::StorePool localStorePool;
  • replacement in src/hydra-queue-runner/state.hh at line 364
    [3.13272][3.13272:13314]()
    nix::ref<nix::Store> getLocalStore();
    [3.13272]
    [3.13314]
    nix::StorePool::Handle getLocalStore();