mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
27.12.2015 2af7525dc754ba78d7dc21d059d7c0b30b97ece9
refs
author Matthew Swift <matthew.swift@forgerock.com>
Tuesday, October 27, 2015 12:12 +0100
committer Matthew Swift <matthew.swift@forgerock.com>
Tuesday, October 27, 2015 12:12 +0100
commit2af7525dc754ba78d7dc21d059d7c0b30b97ece9
tree 0279a6c29ec3752b9d5e08eb3d1c3d6b21476032 tree | zip | gz
parent 2d9d33b26c6a62a1b7a31f1d2f96d7f9652d9898 view | diff
OPENDJ-2335: prevent JE index corruption due to phantom reads

During an index update operation we attempt to insert an ID into an ID
list. There are two code-paths:

* the key (+ ID list) already exists: read the record with a RMW lock,
compute the new ID list, and replace the record
* the key does not exist: compute the new ID list (single ID) and put it
in the index.

In the second case there is risk that two threads race to create the new
record with the second one over writing the first. This is because it is
not possible to use a RMW lock on an non-existent record. The fix is to
insert the new record using "putIfAbsent" semantics, and retry the
entire process if the put fails.
1 files modified
31 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/JEStorage.java 31 ●●●●● diff | view | raw | blame | history