[ 
https://issues.apache.org/jira/browse/OAK-9821?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mohit updated OAK-9821:
-----------------------
    Description: 
 

Change the property of source node and the move the node and save session. 
Property_change event is not generated. Is this expected?

 

 
@Test
public void testPropertyChangedAndMove() throws RepositoryException, 
ExecutionException, InterruptedException \{
    Node testNode = getNode(TEST_PATH);
    Session session = testNode.getSession();
    Node nodeA = testNode.addNode("a");
    Node nodeT = testNode.addNode("t");
    session.save();

    ExpectationListener listener = new ExpectationListener();
    observationManager.addEventListener(listener, ALL_EVENTS, "/", true, null, 
null, false);

    // Added a property
    Property p = nodeA.setProperty("p", "v");
    listener.expectAdd(p);
    session.save();

    // Changed the property and moved the source node in one session
    p = nodeA.setProperty("p", "v1");
    String src1 = nodeA.getPath();
    String dst1 = nodeT.getPath() + "/b";
    session.move(src1, dst1);
    listener.expectMove(src1, dst1);
    listener.expectChange(p); // coming in missing event
    session.save();

    List<Expectation> missing = listener.getMissing(TIME_OUT, TimeUnit.SECONDS);
    assertTrue("Missing events: " + missing, missing.isEmpty());
    List<Event> unexpected = listener.getUnexpected();
    assertTrue("Unexpected events: " + unexpected, unexpected.isEmpty());
}

  was:
With copy-on-write mode enabled at times its seen that async index thread 
remain stuck in CopyOnWriteDirectory#close method

{noformat}
"async-index-update-async" prio=5 tid=0xb9e63 nid=0xffffffff timed_waiting
   java.lang.Thread.State: TIMED_WAITING
        at sun.misc.Unsafe.park(Native Method)
        - waiting to lock <0x2504cd51> (a 
java.util.concurrent.CountDownLatch$Sync) owned by "null" tid=0x-1
        at 
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
        at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277)
        at 
org.apache.jackrabbit.oak.plugins.index.lucene.directory.CopyOnWriteDirectory.close(CopyOnWriteDirectory.java:221)
        at 
org.apache.jackrabbit.oak.plugins.index.lucene.writer.DefaultIndexWriter.updateSuggester(DefaultIndexWriter.java:177)
        at 
org.apache.jackrabbit.oak.plugins.index.lucene.writer.DefaultIndexWriter.close(DefaultIndexWriter.java:121)
        at 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.closeWriter(LuceneIndexEditorContext.java:136)
        at 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor.leave(LuceneIndexEditor.java:154)
        at 
org.apache.jackrabbit.oak.plugins.index.IndexUpdate.leave(IndexUpdate.java:357)
        at 
org.apache.jackrabbit.oak.spi.commit.VisibleEditor.leave(VisibleEditor.java:60)
        at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:56)
        at 
org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate.updateIndex(AsyncIndexUpdate.java:727)
        at 
org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate.runWhenPermitted(AsyncIndexUpdate.java:572)
        at 
org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate.run(AsyncIndexUpdate.java:431)
        - locked <0x3d542de5> (a 
org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate)
        at 
org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(QuartzJobExecutor.java:245)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
{noformat}

The thread is waiting on a latch and no other thread is going to release the 
latch.


> PROPERTY_CHANGE event is not coming when property is changed of node and node 
> moved in same session
> ---------------------------------------------------------------------------------------------------
>
>                 Key: OAK-9821
>                 URL: https://issues.apache.org/jira/browse/OAK-9821
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>            Reporter: Mohit
>            Priority: Major
>
>  
> Change the property of source node and the move the node and save session. 
> Property_change event is not generated. Is this expected?
>  
>  
> @Test
> public void testPropertyChangedAndMove() throws RepositoryException, 
> ExecutionException, InterruptedException \{
>     Node testNode = getNode(TEST_PATH);
>     Session session = testNode.getSession();
>     Node nodeA = testNode.addNode("a");
>     Node nodeT = testNode.addNode("t");
>     session.save();
>     ExpectationListener listener = new ExpectationListener();
>     observationManager.addEventListener(listener, ALL_EVENTS, "/", true, 
> null, null, false);
>     // Added a property
>     Property p = nodeA.setProperty("p", "v");
>     listener.expectAdd(p);
>     session.save();
>     // Changed the property and moved the source node in one session
>     p = nodeA.setProperty("p", "v1");
>     String src1 = nodeA.getPath();
>     String dst1 = nodeT.getPath() + "/b";
>     session.move(src1, dst1);
>     listener.expectMove(src1, dst1);
>     listener.expectChange(p); // coming in missing event
>     session.save();
>     List<Expectation> missing = listener.getMissing(TIME_OUT, 
> TimeUnit.SECONDS);
>     assertTrue("Missing events: " + missing, missing.isEmpty());
>     List<Event> unexpected = listener.getUnexpected();
>     assertTrue("Unexpected events: " + unexpected, unexpected.isEmpty());
> }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to