Skip to content

Commit a78737d

Browse files
authored
Document failure behaviour for register ops (#132173)
A failure of a write to a register does not indicate that the write has definitely completed - it may eventually succeed at some later point in time.
1 parent 7b7d3f7 commit a78737d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/main/java/org/elasticsearch/common/blobstore/BlobContainer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ default void copyBlob(
308308
* <p>
309309
* This operation, together with {@link #compareAndSetRegister}, must have linearizable semantics: a collection of such operations must
310310
* act as if they operate serially, with each operation taking place at some instant in between its invocation and its completion.
311+
* <p>
312+
* If the listener completes exceptionally then the write operation should be considered as continuing to run and may therefore appear
313+
* to occur at some later point in time.
311314
*
312315
* @param purpose The purpose of the operation
313316
* @param key key of the value to update
@@ -330,6 +333,9 @@ void compareAndExchangeRegister(
330333
* <p>
331334
* This operation, together with {@link #compareAndExchangeRegister}, must have linearizable semantics: a collection of such operations
332335
* must act as if they operate serially, with each operation taking place at some instant in between its invocation and its completion.
336+
* <p>
337+
* If the listener completes exceptionally then the write operation should be considered as continuing to run and may therefore appear
338+
* to occur at some later point in time.
333339
*
334340
* @param purpose The purpose of the operation
335341
* @param key key of the value to update
@@ -361,7 +367,10 @@ default void compareAndSetRegister(
361367
* This operation has read-after-write consistency with respect to writes performed using {@link #compareAndExchangeRegister} and
362368
* {@link #compareAndSetRegister}, but does not guarantee full linearizability. In particular, a {@code getRegister} performed during
363369
* one of these write operations may return either the old or the new value, and a caller may therefore observe the old value
364-
* <i>after</i> observing the new value, as long as both such read operations take place before the write operation completes.
370+
* <i>after</i> observing the new value, as long as both such read operations take place before the success of the write operation.
371+
* <p>
372+
* Write operations which complete exceptionally may behave as if they continue to run, thus yielding old or new values for an extended
373+
* period of time. If multiple writes fail then {@code getRegister} may return any of the written values.
365374
*
366375
* @param purpose The purpose of the operation
367376
* @param key key of the value to get

0 commit comments

Comments
 (0)