[ 
https://issues.apache.org/jira/browse/OAK-4530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15361471#comment-15361471
 ] 

Marco Piovesana commented on OAK-4530:
--------------------------------------

I was writing the test and i found what the problem was. I was using a 
FileStore without closing it before shutting down the repository.
Here how i was creating the repository:
{code:borderStyle=solid}
FileStore repositoryStore = null;
File rootPath = new File("/tmp/testoak");
File driveFile = new File(rootPath, DRIVE);
File repositoryFile = new File(driveFile, REPOSITORY);
File dataStoreFile = new File(driveFile, DATASTORE);

BlobStore blobStore = new FileBlobStore(dataStoreFile.getAbsolutePath());
repositoryStore = 
FileStore.newFileStore(repositoryFile).withBlobStore(blobStore).create();
repositoryStore.flush();
NodeStore nodeStore = 
SegmentNodeStore.newSegmentNodeStore(repositoryStore).create();

Jcr jcr = new Jcr(nodeStore).with(new InitialContent()).with(new 
SecurityProviderImpl());
Repository repository = jcr.createRepository();
{code}

And what I was missing (i believe) was _repositoryStore.close()_ before 
_((JackrabbitRepository) repository).shutdown()_.
No error message was thrown during the shutdown so i did not see it before.

thanks, Marco.

> Session modification discarded when repository closed too soon
> --------------------------------------------------------------
>
>                 Key: OAK-4530
>                 URL: https://issues.apache.org/jira/browse/OAK-4530
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.4.4
>            Reporter: Marco Piovesana
>
> If I close the repository right after creating a new group (and saving the 
> session) the modification is not persisted.
> {code: borderStyle=solid}
> UserManager userManager = ((SessionImpl)adminSession).getUserManager();
> Group group = userManager.createGroup("myGroup");
> adminSession.save();
> adminSession.logout();
> ((JackrabbitRepository) repository).shutdown();
> {code}
> When i restart the repository the group "myGroup" does not exist but no error 
> is logged anywhere. However, if i put a _Thread.sleep(3000l)_ before shutting 
> down the repository, the group is persisted.
> Am I doing something wrong?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to