removing query attributes from gloda - which are allowed now? (refer to Jonathan's anouncement of 2011)

Andrew Sutherland asutherland at asutherland.org
Fri Mar 24 19:21:00 UTC 2017


On Wed, Mar 22, 2017, at 02:29 PM, opto at optosolar.com wrote:
> As a matter of fact, I don't know how to make stdout (logging) usable in
> Windows.

Philipp's console suggestion may work, but I would probably just
redirect stdout/stderr to a file or have the gloda logger target a file
to begin with.  I think it can probably do that, but I couldn't tell you
without looking at the source.  Maybe someone on the #maildev IRC
channel knows or is willing to investigate.
 
> Nevertheless, this is what happens:
> 
> 1) open TB, highlight an email. Press 1 2 to set two tags to the same
> email. -> Gloda's collection of tagged messages is ok.
> 
> Press 1 2 to remove both tags at the same time. Wait for Glodaquilla to
> show it is indexed. Gloda holds on to this email and returns it in a
> collection of tagged messages (but the tag string is empty). 
> 
> 
> 2) Set two tags to another email (e.g. again 1 2). remove tag 1. Wait for
> Glodaquilla to show 'indexed', then remove tag 2. Now the email is not
> shown in a collection of tagged messages.
> 
> 1) seems to be a bug.

So, if I understand the problem correctly, the only difference in
scenarios is the time difference between when you remove the the second
tag.  That does sound like a bug.  The debug logging that explains the
deltas in attributes is where you'd want to look in your log:
https://dxr.mozilla.org/comm-central/source/mailnews/db/gloda/modules/gloda.js#2202

Another possibility is to augment the existing unit tests for tags,
which, embarrassingly, does not try removing 2 tags at once:
https://dxr.mozilla.org/comm-central/source/mailnews/db/gloda/test/unit/base_index_messages.js#608

Again, you may want to try the #maildev IRC channel if you'd like more
pointers on how to go about doing that.  Because of time scarcity
reasons, I'm going to finish stepping away from Thunderbird and gloda
development/support and unsubscribing from this list, so I won't be
responding to future questions on this list or sent via other avenues. 
I apologize for the poor timing of this as it relates to your questions
and interest, hopefully my answers have pointed you in the right
direction at least a little!

> One more question:  I have a query, listener and then a collection, all
> inside of a function. 
> (like function xxx() { let query =  ...; let mylistener = ...;  etc. }
> 
> Does the query, collection etc go away if the function xxx goes out of
> scope (is ended)?
> 
> If I call the function xxx another time, do I get another
> query/collection etc.?

While gloda is processing the query, it will hold a strong reference to
the query and collection.  Your listener logic will run, etc.  Once the
query completes, gloda only holds weak references to the collection.  If
your listener does things like prints changes or calls other code you
have, you can only rely on that until a cycle collecting garbage
collection is run.

You'll want to hold a reference to the collection via a chain from a
"static root" AKA, on a window global or a JSM global.  If you only
expect to ever have one live collection at a time, something like `let
collection = window.collection = blah();` works.

Andrew


More information about the tb-planning mailing list