summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc2e067)
raw | patch | inline | side by side (parent: bc2e067)
author | anthonybaxter <anthonybaxter@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 7 Oct 2003 07:17:54 +0000 (07:17 +0000) | ||
committer | anthonybaxter <anthonybaxter@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 7 Oct 2003 07:17:54 +0000 (07:17 +0000) |
and drop indexes for the basic columns - index multilinks, index id and
retired columns of all class tables.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1903 57a73879-2fb5-44c3-a270-3262357dd7e2
retired columns of all class tables.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1903 57a73879-2fb5-44c3-a270-3262357dd7e2
doc/debugging.txt | [new file with mode: 0644] | patch | blob |
roundup/backends/back_mysql.py | patch | blob | history | |
roundup/backends/back_sqlite.py | patch | blob | history | |
roundup/backends/rdbms_common.py | patch | blob | history |
diff --git a/doc/debugging.txt b/doc/debugging.txt
--- /dev/null
+++ b/doc/debugging.txt
@@ -0,0 +1,31 @@
+Debugging Flags
+---------------
+
+Roundup uses a number of debugging environment variables to help you
+figure out what the heck it's doing.
+
+HYPERDBDEBUG
+============
+
+This environment variable should be set to a filename - the hyperdb will
+write debugging information for various events (including, for instance,
+the SQL used).
+
+This is only obeyed when python is _not_ running in -O mode.
+
+HYPERDBTRACE
+============
+
+This environment variable should be set to a filename - the hyperdb will
+write a timestamp entry for various events. This appears to be suffering
+rather extreme bit-rot and may go away soon.
+
+This is only obeyed when python is _not_ running in -O mode.
+
+SENDMAILDEBUG
+=============
+
+Set to a filename and roundup will write a copy of each email message
+that it sends to that file. This environment variable is independent of
+the python -O flag.
+
index ef3d53859f8e336797b7a5b5a794daa313ab8ac0..0e1d085875e5cca2c00d8f6ca0324126ac56ee6a 100644 (file)
self.database_schema = {}
self.sql("CREATE TABLE schema (schema TEXT) TYPE=BDB")
self.sql("CREATE TABLE ids (name varchar(255), num INT) TYPE=BDB")
+ self.sql("CREATE INDEX ids_name_idx on ids(name)")
def close(self):
try:
index 8d2e57fab7eea4df499d15a544891a1503b66b64..d0091b6828e758c3a30370b06531fd52d9070f27 100644 (file)
-# $Id: back_sqlite.py,v 1.9 2003-03-06 06:03:51 richard Exp $
+# $Id: back_sqlite.py,v 1.10 2003-10-07 07:17:54 anthonybaxter Exp $
__doc__ = '''
See https://pysqlite.sourceforge.net/ for pysqlite info
'''
self.database_schema = {}
self.cursor.execute('create table schema (schema varchar)')
self.cursor.execute('create table ids (name varchar, num integer)')
+ self.cursor.execute('create index ids_name_idx on ids(name)')
def close(self):
''' Close off the connection.
index 5d67abc4ca6d56089099a2c52cfeb1065a7f980d..4cdb2daf6bb4b8686b5f6f7beead5951e588db43 100644 (file)
-# $Id: rdbms_common.py,v 1.62 2003-09-08 20:39:18 jlgijsbers Exp $
+# $Id: rdbms_common.py,v 1.63 2003-10-07 07:17:54 anthonybaxter Exp $
''' Relational database (SQL) backend common code.
Basics:
old_has[name] = 1
if not new_has(name) and isinstance(prop, Multilink):
# it's a multilink, and it's been removed - drop the old
- # table
+ # table. First drop indexes.
+ index_sqls = [ 'drop index %s_%s_l_idx'%(spec.classname, ml),
+ 'drop index %s_%s_n_idx'%(spec.classname, ml) ]
+ for index_sql in index_sqls:
+ if __debug__:
+ print >>hyperdb.DEBUG, 'drop_index', (self, index_sql)
+ try:
+ self.cursor.execute(index_sql)
+ except:
+ # The database may not actually have any indexes.
+ # assume the worst.
+ pass
sql = 'drop table %s_%s'%(spec.classname, prop)
if __debug__:
print >>hyperdb.DEBUG, 'update_class', (self, sql)
self.cursor.execute(sql)
olddata = self.cursor.fetchall()
- # drop the old table
+ # drop the old table - indexes first
+ index_sqls = [ 'drop index _%s_id_idx'%cn,
+ 'drop index _%s_retired_idx'%cn ]
+ for index_sql in index_sqls:
+ if __debug__:
+ print >>hyperdb.DEBUG, 'drop_index', (self, index_sql)
+ try:
+ self.cursor.execute(index_sql)
+ except:
+ # The database may not actually have any indexes.
+ # assume the worst.
+ pass
self.cursor.execute('drop table _%s'%cn)
-
# create the new table
self.create_class_table(spec)
if __debug__:
print >>hyperdb.DEBUG, 'create_class', (self, sql)
self.cursor.execute(sql)
+ index_sql1 = 'create index _%s_id_idx on _%s(id)'%(
+ spec.classname, spec.classname)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'create_index', (self, index_sql1)
+ self.cursor.execute(index_sql1)
+ index_sql2 = 'create index _%s_retired_idx on _%s(__retired__)'%(
+ spec.classname, spec.classname)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'create_index', (self, index_sql2)
+ self.cursor.execute(index_sql2)
return cols, mls
if __debug__:
print >>hyperdb.DEBUG, 'create_class', (self, sql)
self.cursor.execute(sql)
+ index_sql = 'create index %s_journ_idx on %s__journal(nodeid)'%(
+ spec.classname, spec.classname)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'create_index', (self, index_sql)
+ self.cursor.execute(index_sql)
def create_multilink_table(self, spec, ml):
''' Create a multilink table for the "ml" property of the class
if __debug__:
print >>hyperdb.DEBUG, 'create_class', (self, sql)
self.cursor.execute(sql)
+ index_sql = 'create index %s_%s_l_idx on %s_%s(linkid)'%(
+ spec.classname, ml, spec.classname, ml)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'create_index', (self, index_sql)
+ self.cursor.execute(index_sql)
+ index_sql = 'create index %s_%s_n_idx on %s_%s(nodeid)'%(
+ spec.classname, ml, spec.classname, ml)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'create_index', (self, index_sql)
+ self.cursor.execute(index_sql)
def create_class(self, spec):
''' Create a database table according to the given spec.
if isinstance(prop, Multilink):
mls.append(col)
+ index_sqls = [ 'drop index _%s_id_idx'%cn,
+ 'drop index _%s_retired_idx'%cn,
+ 'drop index %s_journ_idx'%cn ]
+ for index_sql in index_sqls:
+ if __debug__:
+ print >>hyperdb.DEBUG, 'drop_index', (self, index_sql)
+ try:
+ self.cursor.execute(index_sql)
+ except:
+ # The database may not actually have any indexes.
+ # assume the worst.
+ pass
+
sql = 'drop table _%s'%spec.classname
if __debug__:
print >>hyperdb.DEBUG, 'drop_class', (self, sql)
self.cursor.execute(sql)
-
sql = 'drop table %s__journal'%spec.classname
if __debug__:
print >>hyperdb.DEBUG, 'drop_class', (self, sql)
self.cursor.execute(sql)
for ml in mls:
+ index_sqls = [
+ 'drop index %s_%s_n_idx'%(spec.classname, ml),
+ 'drop index %s_%s_l_idx'%(spec.classname, ml),
+ ]
+ for index_sql in index_sqls:
+ if __debug__:
+ print >>hyperdb.DEBUG, 'drop_index', (self, index_sql)
+ try:
+ self.cursor.execute(index_sql)
+ except:
+ # The database may not actually have any indexes.
+ # assume the worst.
+ pass
sql = 'drop table %s_%s'%(spec.classname, ml)
if __debug__:
print >>hyperdb.DEBUG, 'drop_class', (self, sql)