Not using transaction provided to getBoundaryKeys in LocalityUtil.java

bindings
(Kunalnabar) #1

In bindings/java/src/main/com/apple/foundationdn/LocalityUtil.java the getBoundaryKeys method does not use the transaction that is provided by the caller to load the boundary locations. This is addressed in the javadoc stating:
“As a result, options (such as retry limit) set on the passed {@code Transaction} will not be applied.”

We’ve noticed the call to this method hanging forever various times. Some clarification as to why we don’t use the provided transaction (or why we don’t copy options such as a retry limit) to the newly created transaction would be helpful.

Full method can be seen on line 62 of https://github.com/apple/foundationdb/blob/master/bindings/java/src/main/com/apple/foundationdb/LocalityUtil.java

1 Like
(A.J. Beamon) #2

We don’t use the passed in transaction because the function is not transactional. There may be enough boundary keys to read that the request cannot be completed in a single transaction, and in that case it will start a new transaction where it left off.

The reason we don’t persist the options from the original transaction is that at the present time, there doesn’t exist mechanism to do so. In particular, there is currently no API to read the options set on a transaction in order to apply them to a new transaction.

If you use the new database level options for retry limits or timeouts, these would be applied to the transaction used here. That may be a suitable alternative depending on your use-case.