accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] milleruntime commented on a change in pull request #48: Added conditional writer to tour
Date Thu, 01 Jan 1970 00:00:00 GMT
milleruntime commented on a change in pull request #48: Added conditional writer to tour

 File path: tour/
 @@ -1,3 +1,119 @@
 title: Conditional Writer
+When read-modify-write operations run concurrently, its possible changes made
+by some operations will be overwritten by others. The following sequence of
+events shows an example of this.
+ 1. Thread 0 sets the key `id0001:location:home` to `1007 Mountain Dr, Gotham, New York`
+ 2. Thread 1 reads `id0001:location:home`
+ 3. Thread 2 reads `id0001:location:home`
+ 4. Thread 1 replaces `Dr` with `Drive`
+ 5. Thread 2 replaces `New York` with `NY`
+ 6. Thread 1 sets key `id0001:location:home` to `1007 Mountain Drive, Gotham, New York`
+ 7. Thread 2 sets key `id0001:location:home` to `1007 Mountain Dr, Gotham, NY`
+In this situation the changes made by Thread 1 are lost, ending up with `1007
+Mountain Dr, Gotham, NY` instead of `1007 Mountain Drive, Gotham, NY`.  To
+correctly handle this, Accumulo offers the [ConditionalWriter].  The
+ConditionalWriter atomically checks conditions on a row and only applies a
+mutation when all are satisfied.
+## Exercise
+The following code simulates the concurrency situation above.  Because it uses
+a BatchWriter it will lose modifications.
 Review comment:
   I think the last sentence could be more clear.  Maybe something like: "The BatchWriter
is used to write to the same row across 3 separate threads and there is nothing preventing
concurrent modifications."  A bit wordy but explains what is going on.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message