Delete is performed on a primary key, so it's an atomic operation because primary key enforces uniqueness. A secondary index might be unique, but it might be not as well, therefore you would need to start a transaction to ensure atomicity in a non-unique secondary index key. So that's a reason why there is no delete/update/insert on a secondary index for Java yet. It's a good question if tarantool allows transactions started remotely, but I doubt it'd be useful.
So you would need to do the following to get it working:
- write a stored procedure in Lua to iterate over your index/select the value you need
- put the procedure you wrote into your Tarantool instances
- call it from your Java code by name, by using a
public List call(String var1, Object... var2);
E.g.
-- Lua function
function deleteFromSpaceByUniqueSecondaryIndex(secondaryId)
box.space.YourSpace.index.yourSecondaryIdx:delete(secondaryId)
end
.....
//call it from Java like that
tarantoolConn.call("deleteFromSpaceByUniqueSecondaryIndex", secondaryId);