You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Michael Dürig <md...@apache.org> on 2013/06/06 15:01:06 UTC

Re: svn commit: r1490258 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java


On 6.6.13 13:41, jukka@apache.org wrote:
> Author: jukka
> Date: Thu Jun  6 12:41:28 2013
> New Revision: 1490258
>
> URL: http://svn.apache.org/r1490258
> Log:
> OAK-781: Clarify / fix effects of MISSING_NODE as base state of NodeBuilder
>
> Fix the performance issue of a ConnectedHead never actually updating
> the head state after a rebase. It would just repeatedly create new
> UnconnectedHead instances without ever setting the head field. This
> commit makes updating the head field the responsibility of the head()
> method, which by centralizing the state transition should help avoid
> potential other similar issues.

Thanks for finding this. Looks better now.

> Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1490258&r1=1490257&r2=1490258&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java (original)
> +++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java Thu Jun  6 12:41:28 2013
> @@ -142,7 +142,11 @@ public class MemoryNodeBuilder implement
>        * @return  head of this builder
>        */
>       private Head head() {
> -        return head.update();
> +        Head newHead = head.update();
> +        if (newHead != head) {
> +            head = newHead;
> +        }
> +        return newHead;
>       }

Isn't this the same as

return head = head.update()

??

Michael

Re: svn commit: r1490258 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Thu, Jun 6, 2013 at 4:01 PM, Michael Dürig <md...@apache.org> wrote:
> On 6.6.13 13:41, jukka@apache.org wrote:
>>       private Head head() {
>> -        return head.update();
>> +        Head newHead = head.update();
>> +        if (newHead != head) {
>> +            head = newHead;
>> +        }
>> +        return newHead;
>>       }
>
> Isn't this the same as
>
> return head = head.update()

It is, except for the nice side-effect of being able to easily set a
breakpoint on state transitions.

BR,

Jukka Zitting