Copilot commented on code in PR #23144:
URL: https://github.com/apache/kafka/pull/23144#discussion_r3770729934


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java:
##########
@@ -512,10 +512,14 @@ public synchronized byte[] putIfAbsent(final Bytes key,
 
     @Override
     public void putAll(final List<KeyValue<Bytes, byte[]>> entries) {
+        // Validate up front so a null key rejects the whole batch. An 
accessor may apply the entries
+        // one at a time, and failing part-way through would otherwise leave 
the batch half-applied.
+        for (final KeyValue<Bytes, byte[]> entry : entries) {
+            Objects.requireNonNull(entry.key, "key cannot be null");
+        }

Review Comment:
   `putAll` does not call `validateStoreOpen()`, so it can behave 
inconsistently with `put`/`delete` (which fail fast with 
`InvalidStateStoreException`) and may attempt to write against a closed store. 
While touching this method, it would also be safer to null-check `entries` (and 
each `entry`) so failures are deterministic and have clear messages before any 
staging/writing occurs.



-- 
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]

Reply via email to