yifan-c commented on code in PR #3355: URL: https://github.com/apache/cassandra/pull/3355#discussion_r1948307988
########## src/java/org/apache/cassandra/cql3/terms/Lists.java: ########## @@ -414,12 +414,14 @@ static void doAppend(Term.Terminal value, ColumnMetadata column, UpdateParameter dataSize += cell.dataSize(); } Guardrails.collectionSize.guard(dataSize, column.name.toString(), false, params.clientState); + Guardrails.collectionListSize.guard(dataSize, column.name.toString(), false, params.clientState); Review Comment: I am wondering if you can sort of extending the `collectionListSize` from `collectionSize` and only call `collectionListSize` here, to avoid the "repetition". Similarly, it can be applied for map and set. Basically, something like this. Note the `warnThreshold` and `failThreshold` functions. ```java public static final MaxThreshold collectionListSize = new MaxThreshold("collection_list_size", null, state -> { Long listSizeWarnThreshold = sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getCollectionListSizeWarnThreshold()); return Objects.requireNonNullElseGet(listSizeWarnThreshold, () -> collectionSize.warnValue(state)); }, state -> { Long listSizeWarnThreshold = sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getCollectionListSizeFailThreshold()); return Objects.requireNonNullElseGet(listSizeWarnThreshold, () -> collectionSize.failValue(state)); }, (isWarning, what, value, threshold) -> format("Detected collection %s of size %s, this exceeds the %s threshold of %s.", what, value, isWarning ? "warning" : "failure", threshold)); ``` -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org