Pruning the txns collection

Gustavo Niemeyer gustavo.niemeyer at canonical.com
Thu May 14 17:05:01 UTC 2015


On Thu, May 14, 2015 at 1:45 AM, John Meinel <john at arbash-meinel.com> wrote:

> So one small wrench that we will want to investigate.
>
> While we were trying to cleanup the database, we found a lot of documents
> with transaction ids in txn-queue that references txn documents that were
> already in APPLIED (6) state.
> Looking at the TXN code, the act of applying the changes to the document
> also does a $pullAll of the transactions it is applying. And only after the
> documents have been updated does it update the txn document to APPLIED.
>

This seems to conform with the explanation I provided, and with what the
code intends to do (or at least what I intended it to do :-). There's no
logic that pulls off the transaction reference from txn-queue when it
reaches the final applied state. It is the follow up transactions that will
pull previously applied transactions out of the queue, which means an old
transaction reference can stay there for a very long time if the document
is never touched again. This design is required to make sure documents are
not modified by unrelated transactions while a transaction is in progress,
and also saves one extra update on every single document at the end of the
transaction.

Or perhaps I misunderstand your point?


gustavo @ http://niemeyer.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20150514/6dccc333/attachment.html>


More information about the Juju-dev mailing list