| | |
| | | OperationStatus status; |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | |
| | | // Handle cases where nothing is changed early to avoid |
| | | // DB access. |
| | | if(deletedIDs != null && deletedIDs.size() == 0 && |
| | | (addedIDs == null || addedIDs.size() == 0)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if(addedIDs != null && addedIDs.size() == 0 && |
| | | (deletedIDs == null || deletedIDs.size() == 0)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | |
| | | if(deletedIDs == null && addedIDs == null) |
| | | { |
| | | status = delete(txn, key); |
| | |
| | | return; |
| | | } |
| | | |
| | | // Handle cases where nothing is changed early to avoid |
| | | // DB access. |
| | | if((deletedIDs == null || deletedIDs.size() == 0) && |
| | | (addedIDs == null || addedIDs.size() == 0)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if(maintainCount) |
| | | { |
| | | for(int i = 0; i < phantomWriteRetires; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | if(rebuildRunning || trusted) |
| | | if(deletedIDs != null && !rebuildRunning && trusted) |
| | | { |
| | | if(deletedIDs != null) |
| | | if(debugEnabled()) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4); |
| | | TRACER.debugError("The expected key does not exist in the " + |
| | | "index %s.\nKey:%s", name, builder.toString()); |
| | | } |
| | | StringBuilder builder = new StringBuilder(); |
| | | StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4); |
| | | TRACER.debugError("The expected key does not exist in the " + |
| | | "index %s.\nKey:%s", name, builder.toString()); |
| | | } |
| | | |
| | | setTrusted(txn, false); |
| | | } |
| | | |
| | | if((rebuildRunning || trusted) && addedIDs != null && |
| | | addedIDs.size() > 0) |
| | | { |
| | | data.setData(addedIDs.toDatabase()); |
| | | |
| | | status = insert(txn, key, data); |
| | |
| | | } |
| | | else |
| | | { |
| | | if(rebuildRunning || trusted) |
| | | if(deletedIDs != null && !rebuildRunning && trusted) |
| | | { |
| | | if(deletedIDs != null) |
| | | if(debugEnabled()) |
| | | { |
| | | if(debugEnabled()) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4); |
| | | TRACER.debugError("The expected key does not exist in the " + |
| | | "index %s.\nKey:%s", name, builder.toString()); |
| | | } |
| | | StringBuilder builder = new StringBuilder(); |
| | | StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4); |
| | | TRACER.debugError("The expected key does not exist in the " + |
| | | "index %s.\nKey:%s", name, builder.toString()); |
| | | } |
| | | |
| | | setTrusted(txn, false); |
| | | } |
| | | |
| | | if((rebuildRunning || trusted) && addedIDs != null && addedIDs.size() > 0) |
| | | { |
| | | data.setData(addedIDs.toDatabase()); |
| | | return insert(txn, key, data); |
| | | } |
| | | else |
| | | { |
| | | return OperationStatus.SUCCESS; |
| | | } |
| | | return OperationStatus.SUCCESS; |
| | | } |
| | | } |
| | | |