From: richard Date: Wed, 12 Nov 2003 03:42:13 +0000 (+0000) Subject: - fixes for sf bug 818339 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2dcf744f31b6e97d1fa9b79a1e12ae386fba6060;p=roundup.git - fixes for sf bug 818339 - fixes for metakit for the new db unit tests git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1980 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/doc/installation.txt b/doc/installation.txt index eaceb36..741254b 100644 --- a/doc/installation.txt +++ b/doc/installation.txt @@ -2,7 +2,7 @@ Installing Roundup ================== -:Version: $Revision: 1.63 $ +:Version: $Revision: 1.64 $ .. contents:: @@ -242,8 +242,12 @@ There's several to choose from, each with benefits and limitations: **mysql** Backend for popular RDBMS MySQL. According to benchmarks, this backend works much faster than any of \*dbm ones, but slightly slower than metakit and - sqlite. A good scalability is not a property of this backend for now, - though. For more info on backend installation see doc/mysql.txt. + sqlite. For more info on backend installation see doc/mysql.txt. +**postgresql** + Backend for popular RDBMS PostgreSQL. According to benchmarks, this + backend works much faster than any of \*dbm ones and mysql, but slightly + slower than metakit and sqlite. + For more info on backend installation see doc/postgresql.txt. **metakit** This backend is implemented over the metakit_ storage system, using Mk4Py as the interface. It scales much better than the dbm backends. diff --git a/doc/mysql.txt b/doc/mysql.txt index 13fdb47..9e5c5ab 100644 --- a/doc/mysql.txt +++ b/doc/mysql.txt @@ -2,7 +2,7 @@ MySQL Backend ============= -:version: $Revision: 1.5 $ +:version: $Revision: 1.6 $ This notes detail the MySQL backend for the Roundup issue tracker. @@ -18,6 +18,8 @@ to install: if you have no other choice) 2. Python MySQL interface - http://sourceforge.net/projects/mysql-python +:Note: the InnoDB implementation has a bug that Roundup tickles. See + http://bugs.mysql.com/bug.php?id=1810 Running the MySQL tests ======================= diff --git a/roundup/backends/back_metakit.py b/roundup/backends/back_metakit.py index 737d08d..a612f8b 100755 --- a/roundup/backends/back_metakit.py +++ b/roundup/backends/back_metakit.py @@ -1,4 +1,4 @@ -# $Id: back_metakit.py,v 1.51 2003-10-07 11:58:57 anthonybaxter Exp $ +# $Id: back_metakit.py,v 1.52 2003-11-12 03:42:12 richard Exp $ ''' Metakit backend for Roundup, originally by Gordon McMillan. @@ -140,7 +140,7 @@ class _Database(hyperdb.Database, roundupdb.Database): if tblid == -1: tblid = self.tables.append(name=tablenm) if creator is None: - creator = self.getuid() + creator = int(self.getuid()) else: try: creator = int(creator) @@ -628,7 +628,7 @@ class Class: if not row.creation: row.creation = int(time.time()) if not row.creator: - row.creator = self.db.getuid() + row.creator = int(self.db.getuid()) self.db.dirty = 1 if self.do_journal: @@ -734,6 +734,11 @@ class Class: if not isinstance(prop, hyperdb.String): raise TypeError, "%s is not a String" % propname + # TODO: metakit needs to be able to cope with the key property + # *changing*, which it can't do at present. At the moment, it + # creates the key prop index once, with no record of the name of + # the property for the index. + # first setkey for this run self.keyname = propname iv = self.db._db.view('_%s' % self.classname) @@ -814,7 +819,10 @@ class Class: else: d = {} for id in ids.keys(): - d[int(id)] = 1 + if id is None: + d[0] = 1 + else: + d[int(id)] = 1 ids = d prop = self.ruprops[propname] view = self.getview() diff --git a/roundup/backends/back_mysql.py b/roundup/backends/back_mysql.py index 2993b4b..1bf33f6 100644 --- a/roundup/backends/back_mysql.py +++ b/roundup/backends/back_mysql.py @@ -49,9 +49,12 @@ def db_exists(config): class Database(Database): arg = '%s' - # backend for MySQL to use - mysql_backend = 'InnoDB' - #mysql_backend = 'BDB' # much slower, only use if you have no choice + # Backend for MySQL to use. + # InnoDB is faster, but has a bug in its rollback machinery that causes + # some selects in subsequent transactions to fail. BDB does not have + # this bug, but is apparently much slower. + #mysql_backend = 'InnoDB' + mysql_backend = 'BDB' def sql_open_connection(self): db = getattr(self.config, 'MYSQL_DATABASE') diff --git a/roundup/backends/rdbms_common.py b/roundup/backends/rdbms_common.py index f5cb69b..1e7db19 100644 --- a/roundup/backends/rdbms_common.py +++ b/roundup/backends/rdbms_common.py @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.68 2003-11-12 01:00:58 richard Exp $ +# $Id: rdbms_common.py,v 1.69 2003-11-12 03:42:12 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -1783,8 +1783,8 @@ class Class(hyperdb.Class): 'propspec' consists of keyword args propname=nodeid or propname={nodeid:1, } 'propname' must be the name of a property in this class, or a - KeyError is raised. That property must be a Link or Multilink - property, or a TypeError is raised. + KeyError is raised. That property must be a Link or + Multilink property, or a TypeError is raised. Any node in this class whose 'propname' property links to any of the nodeids will be returned. Used by the full text indexing, which knows @@ -1816,6 +1816,8 @@ class Class(hyperdb.Class): for prop, values in propspec: if not isinstance(props[prop], hyperdb.Link): continue + if type(values) is type({}) and len(values) == 1: + values = values.keys()[0] if type(values) is type(''): allvalues += (values,) where.append('_%s = %s'%(prop, a)) diff --git a/test/db_test_base.py b/test/db_test_base.py index 0120954..97c01cb 100644 --- a/test/db_test_base.py +++ b/test/db_test_base.py @@ -15,9 +15,9 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: db_test_base.py,v 1.6 2003-11-11 11:19:18 richard Exp $ +# $Id: db_test_base.py,v 1.7 2003-11-12 03:42:13 richard Exp $ -import unittest, os, shutil, errno, imp, sys, time +import unittest, os, shutil, errno, imp, sys, time, pprint from roundup.hyperdb import String, Password, Link, Multilink, Date, \ Interval, DatabaseError, Boolean, Number, Node @@ -615,14 +615,21 @@ class DBTest(MyTestCase): got = self.db.issue.find(status='1') got.sort() self.assertEqual(got, ids) + got = self.db.issue.find(status={'1':1}) + got.sort() + self.assertEqual(got, ids) # none self.assertEqual(self.db.issue.find(status='4'), []) + self.assertEqual(self.db.issue.find(status={'4':1}), []) # should match first and third got = self.db.issue.find(assignedto=None) got.sort() self.assertEqual(got, ids) + got = self.db.issue.find(assignedto={None:1}) + got.sort() + self.assertEqual(got, ids) # should match first three got = self.db.issue.find(status='1', nosy='2') @@ -630,9 +637,13 @@ class DBTest(MyTestCase): ids.append(oddid) ids.sort() self.assertEqual(got, ids) + got = self.db.issue.find(status={'1':1}, nosy={'2':1}) + got.sort() + self.assertEqual(got, ids) # none self.assertEqual(self.db.issue.find(status='4', nosy='3'), []) + self.assertEqual(self.db.issue.find(status={'4':1}, nosy={'3':1}), []) def testStringFind(self): ids = [] @@ -852,7 +863,7 @@ class SchemaTest(MyTestCase): self.assertEqual(self.db.a.lookup('apple'), aid) self.db.commit(); self.db.close() - # change the key to fooz + # change the key to fooz on a self.init_amodkey() self.assertEqual(self.db.a.get(aid, 'name'), 'apple') self.assertEqual(self.db.a.get(aid, 'fooz'), None)