DESCRIPTION

tmf: Fix reading HTNodes while the tree is being built

A race condition could occur if a node would receive a query
after closeThisNode() was called, but before it was finished
writing itself to disk (in writeSelf()). It would result in
BufferUnderflowException's.

The important part of this patch is moving the "isDone" from
closeThisNode() to the end of writeSelf().

Also renamed the flag to isOnDisk, to reflect better what it
represents. It wouldn't even need to be written to the file,
but since a change in the file format is due soon-ish, might
as well change it all at the same time.

Change-Id: Ib22e3d56538057c7b3fd6655d32597b524fd8b28
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2014-01-23 05:36:57.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5154/

-------------------------------------
author: Brenden Conley
date: 2014-01-23 06:11:32.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5154/ : SUCCESS

-------------------------------------
author: Ivy Mitchell
date: 2014-01-24 19:25:56.000000000

Patch Set 1: Code-Review-1

(1 comment)

I will test soon.

Line:293, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> this is confusing, would fIsOnDisk be a good naming scheme?

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-24 19:30:31.000000000

Patch Set 1:

(1 comment)

Line:293, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> This file doesn't use f* for naming fields (none of the state system package classes do, and eventually they're planned to be moved to their own plugin).

-------------------------------------
author: Ivy Mitchell
date: 2014-01-24 20:07:59.000000000

Patch Set 1:

(1 comment)

this test makes the test 20526 fail in a new place, please check it out.

Line:293, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> ok

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-24 23:00:00.000000000

Patch Set 1:

The FullDiskReadWhileWritingTest in https://git.eclipse.org/r/#/c/20526 passed 10 times in 10 attempts for me (both with and without this patch). Was I just very lucky? ;)

I did get some concurrency exceptions in the InMemory test, that's due to the total lack of re-entrency in the InMemoryBackend. But it shouldn't be related to this patch.

-------------------------------------
