diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-12-15T16·53+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-12-15T16·53+0000 |
commit | b1eed6b5862644fe8fdb8b7d3897fdcf227abe71 (patch) | |
tree | 31f23df90587d8b793a6e34aa2e7e71d87b9a9aa /src/libstore | |
parent | 11a8dc76d6262c8da601cf640516b9e9669850a2 (diff) |
* Split the database upgrade into multiple transactions to prevent
Berkeley DB from running out of locks.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/store.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 48f09fefe144..281ccc4bf147 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -1012,6 +1012,8 @@ static void upgradeStore07() (and properly spelled) `referrer' table. */ static void upgradeStore09() { + /* !!! we should disallow concurrent upgrades */ + printMsg(lvlError, "upgrading Nix store to new schema (this may take a while)..."); if (!pathExists(nixDBPath + "/referers")) return; @@ -1024,6 +1026,8 @@ static void upgradeStore09() Paths referersKeys; nixDB.enumTable(txn, dbReferers, referersKeys); + + int n = 0; for (Paths::iterator i = referersKeys.begin(); i != referersKeys.end(); ++i) { @@ -1032,12 +1036,17 @@ static void upgradeStore09() for (Paths::iterator j = referers.begin(); j != referers.end(); ++j) nixDB.setString(txn, dbReferrers, addPrefix(*i, *j), ""); + if (++n % 1000 == 0) { + txn.commit(); + txn.begin(nixDB); + cerr << "|"; + } cerr << "."; } - cerr << "\n"; - txn.commit(); + + cerr << "\n"; nixDB.closeTable(dbReferers); |