[PATCH] Make LNT compatible with PostgreSQL
Yi Kong
kongy.dev at gmail.com
Wed Jul 2 09:15:00 PDT 2014
Patch...
On 2 July 2014 17:13, Yi Kong <kongy.dev at gmail.com> wrote:
> Public LLVM perf server suffers from frequent database locking issues.
> SQLite is suspected to cause the problem as it is not designed for
> multi-user system like LNT.
>
> The patch makes LNT compatible with PostgreSQL. Although theoretically
> MySQL should work as well, it's not tested.
>
> SQLite is still supported and used by default, since setting up
> PostgreSQL is difficult and unnecessary if deployed locally.
>
> To use PostgreSQL, you need to create a pgdb manually:
> CREATE DATABASE "lnt.db";
> And run:
> lnt create SANDBOX --db-dir postgresql://user@localhost
>
> Cheers,
> Yi
-------------- next part --------------
Index: lnt/lnttool/create.py
===================================================================
--- lnt/lnttool/create.py (revision 212173)
+++ lnt/lnttool/create.py (working copy)
@@ -151,9 +151,7 @@
hosturl = "http://%s/%s" % (hostname, hostsuffix)
python_executable = sys.executable
- db_dir_path = os.path.join(basepath, db_dir)
cfg_path = os.path.join(basepath, config)
- db_path = os.path.join(db_dir_path, default_db)
tmp_path = os.path.join(basepath, tmp_dir)
wsgi_path = os.path.join(basepath, wsgi)
secret_key = (opts.secret_key or
@@ -160,9 +158,15 @@
hashlib.sha1(str(random.getrandbits(256))).hexdigest())
os.mkdir(path)
- os.mkdir(db_dir_path)
os.mkdir(tmp_path)
+ # If the path does not contain database type, assume relative path.
+ if "://" not in db_dir:
+ db_dir_path = os.path.join(basepath, db_dir)
+ db_path = os.path.join(db_dir_path, default_db)
+ os.mkdir(db_dir_path)
+ else:
+ db_path = os.path.join(db_dir, default_db)
+
cfg_version = kConfigVersion
cfg_file = open(cfg_path, 'w')
cfg_file.write(kConfigTemplate % locals())
Index: lnt/server/config.py
===================================================================
--- lnt/server/config.py (revision 212173)
+++ lnt/server/config.py (working copy)
@@ -90,8 +91,12 @@
default_email_config = EmailConfig(False, '', '', [])
dbDir = data.get('db_dir', '.')
- dbDirPath = os.path.join(baseDir, dbDir)
+ # If the path does not contain database type, assume relative path.
+ if "://" not in dbDir:
+ dbDirPath = os.path.join(baseDir, dbDir)
+ else:
+ dbDirPath = dbDir
+
# FIXME: Remove this default.
tempDir = data.get('tmp_dir', 'viewer/resources/graphs')
More information about the llvm-commits
mailing list