belliottsmith commented on code in PR #3409:
URL: https://github.com/apache/cassandra/pull/3409#discussion_r1672266686


##########
src/java/org/apache/cassandra/journal/ActiveSegment.java:
##########
@@ -455,14 +459,18 @@ void write(K id, ByteBuffer record, Set<Integer> hosts)
             }
         }
 
-        void asyncWrite(K id, V record, ByteBuffer bytes, Set<Integer> hosts, 
Object writeContext, AsyncCallbacks<K, V> callbacks) throws IOException
+        // Variant of write that does not allocate/return a record pointer
+        void writeInternal(K id, ByteBuffer record, Set<Integer> hosts)
         {
             try (BufferedDataOutputStreamPlus out = new 
DataOutputBufferFixed(buffer))
             {
-                EntrySerializer.write(id, bytes, hosts, keySupport, out, 
descriptor.userVersion);
+                EntrySerializer.write(id, record, hosts, keySupport, out, 
descriptor.userVersion);
                 index.update(id, position);
                 metadata.update(hosts);
-                callbacks.onWrite(descriptor.timestamp, position, size, id, 
record, writeContext);
+            }
+            catch (IOException e)
+            {
+                throw new JournalWriteError(descriptor, file, e);

Review Comment:
   Haven't thought about error handling here properly, but should rationalise 
with the callback handler that is notified of write failures. 
   
   We also need to generally think about how we handle exceptions with respect 
to database state - do we try to rollback the state changes, or is it fine to 
just not send responses? _Probably_ the latter is sufficient, but we should add 
a `TODO (required)` to consider it more carefully and centrally document our 
assumptions alongside any protocol documentation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to