smiklosovic commented on code in PR #2961:
URL: https://github.com/apache/cassandra/pull/2961#discussion_r1418717984


##########
src/java/org/apache/cassandra/service/reads/thresholds/WarningsSnapshot.java:
##########
@@ -83,58 +98,79 @@ WarningsSnapshot merge(WarningsSnapshot other)
     {
         if (other == null || other == EMPTY)
             return this;
-        return WarningsSnapshot.create(tombstones.merge(other.tombstones), 
localReadSize.merge(other.localReadSize), 
rowIndexReadSize.merge(other.rowIndexReadSize));
+        return WarningsSnapshot.create(tombstones.merge(other.tombstones),
+                                       
localReadSize.merge(other.localReadSize),
+                                       
rowIndexReadSize.merge(other.rowIndexReadSize),
+                                       
indexReadSSTablesCount.merge(other.indexReadSSTablesCount));
     }
 
     public void maybeAbort(ReadCommand command, ConsistencyLevel cl, int 
received, int blockFor, boolean isDataPresent, Map<InetAddressAndPort, 
RequestFailureReason> failureReasonByEndpoint)
     {
         if (!tombstones.aborts.instances.isEmpty())
-            throw new 
TombstoneAbortException(tombstones.aborts.instances.size(), 
tombstones.aborts.maxValue, command.toCQLString(), isDataPresent,
+            throw new 
TombstoneAbortException(tombstoneAbortMessage(tombstones.aborts.instances, 
tombstones.aborts.maxValue, command.toCQLString()), 
tombstones.aborts.instances.size(), tombstones.aborts.maxValue, isDataPresent,
                                               cl, received, blockFor, 
failureReasonByEndpoint);
 
         if (!localReadSize.aborts.instances.isEmpty())
-            throw new 
ReadSizeAbortException(localReadSizeAbortMessage(localReadSize.aborts.instances.size(),
 localReadSize.aborts.maxValue, command.toCQLString()),
+            throw new 
ReadSizeAbortException(localReadSizeAbortMessage(localReadSize.aborts.instances,
 localReadSize.aborts.maxValue, command.toCQLString()),
                                              cl, received, blockFor, 
isDataPresent, failureReasonByEndpoint);
 
         if (!rowIndexReadSize.aborts.instances.isEmpty())
-            throw new 
ReadSizeAbortException(rowIndexReadSizeAbortMessage(rowIndexReadSize.aborts.instances.size(),
 rowIndexReadSize.aborts.maxValue, command.toCQLString()),
+            throw new 
ReadSizeAbortException(rowIndexReadSizeAbortMessage(rowIndexReadSize.aborts.instances,
 rowIndexReadSize.aborts.maxValue, command.toCQLString()),
                                              cl, received, blockFor, 
isDataPresent, failureReasonByEndpoint);
+
+        if (!indexReadSSTablesCount.aborts.instances.isEmpty())
+            throw new 
QueryReferencesTooManyIndexesAbortException(tooManyIndexesReadAbortMessage(indexReadSSTablesCount.aborts.instances,
 indexReadSSTablesCount.aborts.maxValue, command.toCQLString()),
+                                                                  cl, 
received, blockFor, isDataPresent, failureReasonByEndpoint);
     }
 
     @VisibleForTesting
-    public static String tombstoneAbortMessage(int nodes, long tombstones, 
String cql)
+    public static String 
tombstoneAbortMessage(ImmutableSet<InetAddressAndPort> nodes, long tombstones, 
String cql)
     {
         return String.format("%s nodes scanned over %s tombstones and aborted 
the query %s (see tombstone_failure_threshold)", nodes, tombstones, cql);
     }
 
     @VisibleForTesting
-    public static String tombstoneWarnMessage(int nodes, long tombstones, 
String cql)
+    public static String tombstoneWarnMessage(ImmutableSet<InetAddressAndPort> 
nodes, long tombstones, String cql)
     {
-        return String.format("%s nodes scanned up to %s tombstones and issued 
tombstone warnings for query %s  (see tombstone_warn_threshold)", nodes, 
tombstones, cql);
+        return String.format("%s nodes scanned up to %s tombstones and issued 
tombstone warnings for query %s (see tombstone_warn_threshold)", nodes, 
tombstones, cql);
     }
 
     @VisibleForTesting
-    public static String localReadSizeAbortMessage(long nodes, long bytes, 
String cql)
+    public static String 
localReadSizeAbortMessage(ImmutableSet<InetAddressAndPort> nodes, long bytes, 
String cql)
     {
         return String.format("%s nodes loaded over %s bytes and aborted the 
query %s (see local_read_size_fail_threshold)", nodes, bytes, cql);
     }
 
     @VisibleForTesting
-    public static String localReadSizeWarnMessage(int nodes, long bytes, 
String cql)
+    public static String 
localReadSizeWarnMessage(ImmutableSet<InetAddressAndPort> nodes, long bytes, 
String cql)
     {
-        return String.format("%s nodes loaded over %s bytes and issued local 
read size warnings for query %s  (see local_read_size_warn_threshold)", nodes, 
bytes, cql);
+        return String.format("%s nodes loaded over %s bytes and issued local 
read size warnings for query %s (see local_read_size_warn_threshold)", nodes, 
bytes, cql);
     }
 
     @VisibleForTesting
-    public static String rowIndexReadSizeAbortMessage(long nodes, long bytes, 
String cql)
+    public static String 
rowIndexReadSizeAbortMessage(ImmutableSet<InetAddressAndPort> nodes, long 
bytes, String cql)
     {
         return String.format("%s nodes loaded over %s bytes in RowIndexEntry 
and aborted the query %s (see row_index_size_fail_threshold)", nodes, bytes, 
cql);
     }
 
     @VisibleForTesting
-    public static String rowIndexSizeWarnMessage(int nodes, long bytes, String 
cql)
+    public static String 
rowIndexSizeWarnMessage(ImmutableSet<InetAddressAndPort> nodes, long bytes, 
String cql)
+    {
+        return String.format("%s nodes loaded over %s bytes in RowIndexEntry 
and issued warnings for query %s (see row_index_size_warn_threshold)", nodes, 
bytes, cql);
+    }
+
+    @VisibleForTesting
+    public static String 
tooManyIndexesReadWarnMessage(ImmutableSet<InetAddressAndPort> nodes, long 
value, String cql)

Review Comment:
   it would be cool to know exactly what the violations were, _per violated 
replica_. The way Warnings and its Counter is done for now is that as it merges 
responses from replicas, it will always merge it in such a way that we only 
know _maximum_. So if there are three nodes, one read from 5 referenced 
indexes, the second one from 10 and the third one from 15, we will see all 
replicas here but the maximum showed will be 15 - and we do not know what node 
it is. This would require further refactoring, I think counters would need to 
be more like a _meter_, per node.



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