Bug 723081 - additional debug helpers used to diagnose the bug. r=bienvenu
authorAndrew Sutherland <asutherland@asutherland.org>
Wed, 15 Feb 2012 13:34:19 -0800
changeset 10848 1b09b680267803b2cc8fbaa842371a779c7096b5
parent 10847 074ad890780f64b4e3517cc6360f28e682df9af5
child 10849 02fc13ae8f5b552e4549a8ed7c7f4abef900ab20
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs723081
Bug 723081 - additional debug helpers used to diagnose the bug. r=bienvenu
mailnews/db/gloda/modules/datamodel.js
mailnews/db/gloda/test/unit/base_index_messages.js
mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
--- a/mailnews/db/gloda/modules/datamodel.js
+++ b/mailnews/db/gloda/modules/datamodel.js
@@ -685,17 +685,18 @@ GlodaMessage.prototype = {
         folderMessage = folder.GetMessageHeader(this._messageKey);
       }
       catch (ex) {
         folderMessage = null;
       }
       if (folderMessage !== null) {
         // verify the message-id header matches what we expect...
         if (folderMessage.messageId != this._headerMessageID) {
-          LOG.info("Message with message key does not match expected " +
+          LOG.info("Message with message key " + this._messageKey +
+                   " in folder '" + folder.URI + "' does not match expected " +
                    "header! (" + this._headerMessageID + " expected, got " +
                    folderMessage.messageId + ")");
           folderMessage = null;
         }
       }
       return folderMessage;
     }
 
--- a/mailnews/db/gloda/test/unit/base_index_messages.js
+++ b/mailnews/db/gloda/test/unit/base_index_messages.js
@@ -411,17 +411,17 @@ var fundamentalFolderHandle;
 /**
  * We're saving this one so that we can move the message later and verify that
  * the attributes are consistent.
  */
 var fundamentalMsgSet;
 var fundamentalGlodaMsgAttachmentUrls;
 /**
  * Save the resulting gloda message id corresponding to the
- *  fundamentalSyntheticMessage.
+ *  fundamentalSyntheticMessage so we can use it to query the message from disk.
  */
 var fundamentalGlodaMessageId;
 
 /**
  * Test that we extract the 'fundamental attributes' of a message properly
  *  'Fundamental' in this case is talking about the attributes defined/extracted
  *  by gloda's fundattr.js and perhaps the core message indexing logic itself
  *  (which show up as kSpecial* attributes in fundattr.js anyways.)
--- a/mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
+++ b/mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
@@ -248,16 +248,39 @@ if (logHelperHasInterestedListeners) {
   };
 
   let orig__messageFromRow = GlodaDatastore._messageFromRow;
   GlodaDatastore._messageFromRow = msgNounDef.objFromRow = function() {
     let rv = orig__messageFromRow.apply(GlodaDatastore, arguments);
     mark_action("glodaWrapped", "_messageFromRow", [rv]);
     return rv;
   };
+
+  let orig_updateMessageLocations = GlodaDatastore.updateMessageLocations;
+  GlodaDatastore.updateMessageLocations = function() {
+    mark_action("glodaWrapped", "updateMessageLocations",
+                ["ids", arguments[0], "keys", arguments[1], "dest folder",
+                 arguments[2], "do not notify?", arguments[3]]);
+    orig_updateMessageLocations.apply(GlodaDatastore, arguments);
+  };
+  let orig_updateMessageKeys = GlodaDatastore.updateMessageKeys;
+  GlodaDatastore.updateMessageKeys = function() {
+    mark_action("glodaWrapped", "updateMessageKeys"
+                ["ids", arguments[0], "keys", arguments[1]]);
+    orig_updateMessageKeys.apply(GlodaDatastore, arguments);
+  }
+
+  /* also, let us see the results of cache lookups so we can know if we are
+     performing cache unification when a load occurs. */
+  let orig_cacheLookupOne = GlodaCollectionManager.cacheLookupOne;
+  GlodaCollectionManager.cacheLookupOne = function() {
+    let rv = orig_cacheLookupOne.apply(GlodaCollectionManager, arguments);
+    mark_action("glodaWrapped", "cacheLookupOne", ["hit?", rv !== null]);
+    return rv;
+  }
 }
 
 const _wait_for_gloda_indexer_defaults = {
   verifier: null,
   augment: false,
   deleted: null,
   fullyIndexed: null,
 
@@ -495,16 +518,17 @@ var _indexMessageState = {
 
         let glodaMsg = this._glodaMessagesByMessageId[synMsg.messageId];
         if (this.augmentSynSets)
           msgSet.glodaMessages.push(glodaMsg);
 
         this._glodaMessagesByMessageId[synMsg.messageId] = null;
         if (verifier) {
           try {
+            mark_action("glodaTestHelper", "verifier", [synMsg, glodaMsg]);
             previousValue = verifier(synMsg, glodaMsg, previousValue);
           }
           catch (ex) {
             // ugh, too verbose
             //logObject(synMsg, "synMsg");
             //logObject(glodaMsg, "glodaMsg");
             dump("synMsg: " + synMsg + "\n");
             dump("glodaMsg: " + glodaMsg + "\n");