> On 2012-05-25 14:49:56, Gordon Sim wrote:
> > /trunk/qpid/cpp/src/qpid/broker/Messages.h, line 108
> > <https://reviews.apache.org/r/5231/diff/2/?file=110241#file110241line108>
> >
> >     Is this still used?
> 
> Alan Conway wrote:
>     Yes. Even if you dequeue all the messages>=N you can't just push message 
> N, you need to clean up the index, e.g. chop the end off the underlying 
> deque, so things will line up.
> 
> Gordon Sim wrote:
>     I don't understand this, could you elaborate? If (assuming the changes in 
> diff 2 where Queue::setPosition() uses the same approach as for purging 
> expired messages) all the messages are removed from Messages instance and 
> then dequeued etc, why would any internal state of the Messages instance not 
> then be consistent?

A MessageDeque does not clean up at the back when messages are dequeued, so you 
can have a bunch of DELETED records there. Pushing put the new message after 
all the DELETED records and at the wrong index. (MessageMap does not need 
truncated, currently its just an assert to verify there are no messages after 
the truncate point. PriorityQueue only needs trucate in order to pass it to 
it's internal MessageDeque index)

We can't automatically clean up trailing DELETED records when a message is 
dequeued becaue MessageDeque::push assumes that there are sufficient DELETED 
records to act as padding so pushing to the back of the deque will be at the 
right index. There has to be a way to communicate to the Messages 
implementation what the new back-of-queue position is.


- Alan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5231/#review8108
-----------------------------------------------------------


On 2012-05-25 17:55:24, Alan Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/5231/
> -----------------------------------------------------------
> 
> (Updated 2012-05-25 17:55:24)
> 
> 
> Review request for qpid, Gordon Sim and Kenneth Giusti.
> 
> 
> Summary
> -------
> 
>     In the new HA code a backup may sometimes be ahead of the new primary 
> after a
>     fail-over. In that case the backup truncates it's queues to the same 
> position
>     as the primary so it can continue replicating.
> 
> 
> Diffs
> -----
> 
>   /trunk/qpid/cpp/src/qpid/broker/MessageDeque.h 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/MessageDeque.cpp 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/MessageMap.h 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/MessageMap.cpp 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/Messages.h 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/PriorityQueue.h 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/PriorityQueue.cpp 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/Queue.h 1342442 
>   /trunk/qpid/cpp/src/qpid/broker/Queue.cpp 1342442 
>   /trunk/qpid/cpp/src/tests/Makefile.am 1342442 
>   /trunk/qpid/cpp/src/tests/QueueTest.cpp 1342442 
>   /trunk/qpid/cpp/src/tests/brokertest.py 1342442 
> 
> Diff: https://reviews.apache.org/r/5231/diff
> 
> 
> Testing
> -------
> 
> Passing make check, added unit tests to QueueTests.cpp
> 
> 
> Thanks,
> 
> Alan
> 
>

Reply via email to