-
Bug
-
Resolution: Done
-
Major
-
3.1.3.Final
-
None
-
Workaround Exists
-
May relate to MODE-1822
After committing a transaction that create a new versionable node and then call VersionManager.checkin(), query may return duplicated record for that newly created node.
A more complex case can reproduce this issue almost every time
@Transactional
public void createMultipleNodes(JCRSessionHolder sessionHolder) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
for (int i = 0; i < 10; ++i) {
createNewNode("Test" + i, sessionHolder);
}
}
private void createNewNode(String name, JCRSessionHolder sessionHolder) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException {
VersionManager vm = sessionHolder.getSession().getWorkspace().getVersionManager();
Node node = sessionHolder.getSession().getRootNode()
.addNode(name, "pd:product");
node.addMixin("mix:versionable");
node.setProperty("name", "lalalal");
node.setProperty("code", "lalalal");
createChildNode(node);
sessionHolder.getSession().save();
vm.checkin(node.getPath());
vm.checkout(node.getPath());
}
private void createChildNode(Node parentNode) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
doCreateChildNode(parentNode, 1);
}
private void doCreateChildNode(Node parentNode, int level) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException {
if (level == 5)
return;
for (int i = 0; i < 1; ++i) {
Node child = parentNode.addNode("child-" + level + "-" + i);
for (int j = 0; j < 10; ++j)
child.setProperty("p" + j, "property" + j);
doCreateChildNode(child, level + 1);
}
}
After calling createMultipleNodes, then make a simple query "SELECT * FROM [pd:product]", the expected result should be ten rows, but actual result is not (can be any random number between 12 ~ 16 in my test)
- is blocked by
-
MODE-1854 Indexing took too much time to finish when using explicit JTA transaction compared to no transaction
-
- Closed
-