# HG changeset patch # User Pierre-Yves David # Date 1535362024 -7200 # Node ID c58362473bd48a35cdbd56e4d9be41c1800556c7 # Parent 3d51dc72d8841b7dfc4db8e4c7aeca90e5c08c03 sqlcache: initialize meta table last It turns out that pysqlite commit after each table creation. This commit is an hopeless attemps to make the caches more concurrent friendly. diff -r 3d51dc72d884 -r c58362473bd4 hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 10:20:15 2018 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 11:27:04 2018 +0200 @@ -333,6 +333,11 @@ ### sqlite caching _sqliteschema = [ + """CREATE TABLE obshashrange(rev INTEGER NOT NULL, + idx INTEGER NOT NULL, + obshash BLOB NOT NULL, + PRIMARY KEY(rev, idx));""", + "CREATE INDEX range_index ON obshashrange(rev, idx);", """CREATE TABLE meta(schemaversion INTEGER NOT NULL, tiprev INTEGER NOT NULL, tipnode BLOB NOT NULL, @@ -340,11 +345,6 @@ obssize BLOB NOT NULL, obskey BLOB NOT NULL );""", - """CREATE TABLE obshashrange(rev INTEGER NOT NULL, - idx INTEGER NOT NULL, - obshash BLOB NOT NULL, - PRIMARY KEY(rev, idx));""", - "CREATE INDEX range_index ON obshashrange(rev, idx);", ] _queryexist = "SELECT name FROM sqlite_master WHERE type='table' AND name='meta';" _clearmeta = """DELETE FROM meta;""" diff -r 3d51dc72d884 -r c58362473bd4 hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Mon Aug 27 10:20:15 2018 +0200 +++ b/hgext3rd/evolve/stablerangecache.py Mon Aug 27 11:27:04 2018 +0200 @@ -87,10 +87,6 @@ ############################# _sqliteschema = [ - """CREATE TABLE meta(schemaversion INTEGER NOT NULL, - tiprev INTEGER NOT NULL, - tipnode BLOB NOT NULL - );""", """CREATE TABLE range(rev INTEGER NOT NULL, idx INTEGER NOT NULL, PRIMARY KEY(rev, idx));""", @@ -106,6 +102,10 @@ "CREATE INDEX subranges_index ON subranges (suprev, supidx);", "CREATE INDEX superranges_index ON subranges (subrev, subidx);", "CREATE INDEX range_index ON range (rev, idx);", + """CREATE TABLE meta(schemaversion INTEGER NOT NULL, + tiprev INTEGER NOT NULL, + tipnode BLOB NOT NULL + );""", ] _newmeta = "INSERT INTO meta (schemaversion, tiprev, tipnode) VALUES (?,?,?);" _updatemeta = "UPDATE meta SET tiprev = ?, tipnode = ?;"