changeset 4022:082b59126099 stable

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 bebba5a5c82d
children f59b262400fb
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
@@ -328,6 +328,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,
@@ -335,11 +340,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
@@ -88,10 +88,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));""",
@@ -107,6 +103,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 = ?;"