]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: persist_data: Add key constraints
authorJoshua Watt <jpewhacker@gmail.com>
Tue, 4 Dec 2018 03:42:31 +0000 (21:42 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 7 Dec 2018 12:38:58 +0000 (12:38 +0000)
Constructs the "key" column in the persistent database as a non-NULL
primary key. This significantly speeds up lookup operations in large
databases.

[YOCTO #13030]

(Bitbake rev: f5ba7775cfcb90401522d977cc66fe0f5aeb7a66)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/persist_data.py

index 1a6319f94980775832d2cd465900d645f6fae025..2bc3e766a93cf02987d442f8983ad05cb58be45b 100644 (file)
@@ -94,7 +94,7 @@ class SQLTable(collections.MutableMapping):
         self.table = table
         self.connection = connect(self.cachefile)
 
-        self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT, value TEXT);" % table)
+        self._execute_single("CREATE TABLE IF NOT EXISTS %s(key TEXT PRIMARY KEY NOT NULL, value TEXT);" % table)
 
     @_Decorators.retry
     @_Decorators.transaction