The UniquenessConstraintValidator currently checks for any new index entry if any matching entry is found in primary (property) and secondary (lucene) index.
This can lead to false positive where the entry in index is obsolete and due to async index lagging behind is yet not pruned. For e.g. if
- Time T1 - path /a/@uuid=1 existed , present in lucene index
- Time T2 - path /a removed (async index yet not catched up)
- Time T3 - path /b/@uuid=1 being created.
In this case save should pass. However as async index has yet not catched up it reports a constraint validation exception. As a fix UniquenessConstraintValidator should check if reported paths are valid wrt current revision