dcapwell commented on a change in pull request #1180:
URL: https://github.com/apache/cassandra/pull/1180#discussion_r702140563



##########
File path: src/java/org/apache/cassandra/db/RowIndexEntry.java
##########
@@ -343,6 +349,47 @@ public static void skipForCache(DataInputPlus in) throws 
IOException
             }
         }
 
+        private void checkSize(int entries, int bytes)
+        {
+            ReadCommand command = ReadCommand.getCommand();
+            if (command == null || 
SchemaConstants.isSystemKeyspace(command.metadata().keyspace) || 
!DatabaseDescriptor.getClientTrackWarningsEnabled())
+                return;
+
+            int warnThreshold = 
DatabaseDescriptor.getRowIndexSizeWarningThresholdKb() * 1024;
+            int abortThreshold = 
DatabaseDescriptor.getRowIndexSizeAbortThresholdKb() * 1024;
+
+            long estimatedMemory = estimateMaterializedIndexSize(entries, 
bytes);
+            ColumnFamilyStore cfs = 
Schema.instance.getColumnFamilyStoreInstance(command.metadata().id);
+            if (cfs != null)
+                cfs.metric.rowIndexSize.update(estimatedMemory);
+
+            if (abortThreshold != 0 && estimatedMemory > abortThreshold)
+            {
+                String msg = String.format("Query %s attempted to access a 
large RowIndexEntry estimated to be %d bytes " +
+                                           "in-memory (total entries: %d, 
total bytes: %d) but the max allowed is %d;" +
+                                           " query aborted  (see 
row_index_size_abort_threshold_kb)",
+                                           command.toCQLString(), 
estimatedMemory, entries, bytes, abortThreshold);
+                
MessageParams.remove(ParamType.ROW_INDEX_ENTRY_TOO_LARGE_WARNING);

Review comment:
       abort adds a ClientWarn, so the question is do we return 1 or 2 logs?  I 
went with 1 as the abort is larger than the warn.




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