maedhroz commented on code in PR #2150:
URL: https://github.com/apache/cassandra/pull/2150#discussion_r1103167986


##########
src/java/org/apache/cassandra/service/accord/txn/TxnNamedRead.java:
##########
@@ -130,9 +130,13 @@ public Future<Data> read(boolean isForWriteTxn, 
SafeCommandStore safeStore, Time
                  UnfilteredPartitionIterator partition = 
read.executeLocally(controller);
                  PartitionIterator iterator = 
UnfilteredPartitionIterators.filter(partition, read.nowInSec()))
             {
-                FilteredPartition filtered = 
FilteredPartition.create(PartitionIterators.getOnlyElement(iterator, read));
                 TxnData result = new TxnData();
-                result.put(name, filtered);
+                if (iterator.hasNext())
+                {
+                    FilteredPartition filtered = 
FilteredPartition.create(PartitionIterators.getOnlyElement(iterator, read));

Review Comment:
   ```suggestion
                       FilteredPartition filtered = 
FilteredPartition.create(iterator.next());
   ```
   We should be able to simplify ^
   
   The only other notable thing that `getOnlyElement()` seems to do is close 
the iterator, but `iterator` is already in a try-with-resources block above, so 
that shouldn't be an issue.



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