Log4Moz Explicit Logging
The gloda code has Log4Moz logging statements spread throughout. The following preferences are supported to control how this gets logged:
- mailnews.database.global.logging.console - Should warning and error messages be logged to the error console window (accessible via Tools... Error Console)
- mailnews.database.global.logging.dump - Should all messages be logged to stdout by the dump() command? This does require that browser.dom.window.dump.enabled is set to true.
- mailnews.database.global.logging.net - Should we look for a /tmp/chainsaw.ptr file that tells us a hostname and port to connect to to send XML formatted log records to. The file should be of the form "hostname:port" like "localhost:1234".
Gloda will run faster if only error console logging is enabled; some of the debug-level log statements and their arguments are entirely predicated on the gloda logging level.
SQLite Query EXPLAINations
See the following blog post for more information and tools on the subject.
SQLite Queries you can run against the database
An important thing to know about the gloda database is that because we use a custom tokenizer ("mozporter"), running the SQLite3 command line tool or any other tool against global-messages-db.sqlite will fail to be able to treat the fulltext tables as usable FTS3 tables. This does not matter for poking and prodding because FTS3 actually uses multiple backing tables under the hood, and we can directly poke at them. Specifically, in the case of messages, our FTS3 virtual table is named "messagesText" and you won't be able to poke it, but all of its nougaty goodness is stored in "messagesText_content", "messagesText_segdir", and "conversationsText_segments". The segment tables just store giant BLOBs that are not human readable, but "messagesText_content" has the acutal full text that we care about.
Fulltext message size distribution
The following query will tally the fulltext content size distributions of messages in (rounded-down) kilobytes. Enter it into the SQLite3 commandline tool against global-messages-db.sqlite. It will take a bit of time. Note that bug 543737 will cap the body sizes making this somewhat less interesting.
select (length(c0subject) + length(c1body) + length(c2attachmentNames) + length(c3author) + length(c4recipients))/ 1024 as kilos, count(*) from messagesText_content group by kilos;
The results will look something like this: