strangepleasures commented on issue #646: JENA-1785: A newly created node can remain invisible after commit URL: https://github.com/apache/jena/pull/646#issuecomment-562942701 Thank you for your warm words. I totally agree with your suggestions. There's no need to check dataVersion indeed. In principle, we don't even need to store a whole transaction or have a separate field for hasActiveWriteTransaction, it could be just one `AtomicReference<Thread> writingThread`. I introduced explicit synchronization because I was afraid of a potential race condition. Without synchronization in `notifyTxnStart` a new write transaction can be started immediately after you check hasActiveWriteTransaction: ``` // in a read transaction if ( notPresent != null && inTopLevelTxn()) // inTopLevelTxn() == true // a new write transaction is started in another thread, making the read transaction not top level anymore notPresent.put(node, Boolean.TRUE); ``` However, it seems to be no problem. Even if a new write transaction is started, it will not be able to allocate a new node while the lock is being held by the read transaction.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
