changeset 4009:c58362473bd4

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 27 Aug 2018 11:27:04 +0200
parents 3d51dc72d884
children 4c2fcd53c601
files hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/stablerangecache.py
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;"""
--- 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 = ?;"