[ https://issues.apache.org/jira/browse/CASSANDRA-17189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17456819#comment-17456819 ]
Bartlomiej edited comment on CASSANDRA-17189 at 12/9/21, 11:33 PM: ------------------------------------------------------------------- Hi [~brandon.williams] I will have a question, I made the change following steps from the ticket [^CASSANDRA-17189-trunk.txt] , but I don't know what to do here: {code:java} public DataLimits forPaging(int pageSize) { Guardrails.pageSize.guard(pageSize, "?", null); return new CQLLimits(pageSize, perPartitionLimit, isDistinct); } public DataLimits forPaging(int pageSize, ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining) { Guardrails.pageSize.guard(pageSize, "?", null); return new CQLPagingLimits(pageSize, perPartitionLimit, isDistinct, lastReturnedKey, lastReturnedKeyRemaining); } {code} atm that is how messages look {code:java} WARN Quering page size with size 2200 exceeds warning threshold of 2000. WARN Quering page size with size 2400 exceeds warning threshold of 2000. {code} problem is that there is no table name in the log(what makes it difficult to figure out what query exceed the threshold), also guard requires 'what' argument (it is is place for table name), but I have no idea how to make it good :) should I pass table name to forPaging ? that doesn't looks good for me (or no?). Should I extract guard outside forPaging ?(for example in SelectStatement.execute?) - problem is that there are multiple places that forPagining is executed. I also wonder, should we care about too small value for abort_threshold ? If someone will set for example 100, cassandra will crash. Thanks ! was (Author: bkowalczyyk): Hi [~brandon.williams] I will have a question, I made the change following steps from the ticket [^CASSANDRA-17189-trunk.txt] , but I don't know what to do here: {code:java} public DataLimits forPaging(int pageSize) { Guardrails.pageSize.guard(pageSize, "?", null); return new CQLLimits(pageSize, perPartitionLimit, isDistinct); } public DataLimits forPaging(int pageSize, ByteBuffer lastReturnedKey, int lastReturnedKeyRemaining) { Guardrails.pageSize.guard(pageSize, "?", null); return new CQLPagingLimits(pageSize, perPartitionLimit, isDistinct, lastReturnedKey, lastReturnedKeyRemaining); } {code} atm that is how messages look {code:java} WARN Quering page size with size 2200 exceeds warning threshold of 2000. WARN Quering page size with size 2400 exceeds warning threshold of 2000. {code} problem is that there is no table name in the log(what makes it difficult to figure out what query exceed the threshold), also guard requires 'what' argument (it is is place for table name), but I have no idea how to make it good :) should I pass table name to forPaging ? that doesn't looks good for me (or no?). Should I extract guard outside forPaging ?(for example in SelectStatement.execute?) - problem is that there are multiple places that forPagining is executed. * I also wonder, should we care about too small value for abort_threshold ? If someone will set for example 100, cassandra will crash. Thanks ! > Guardrail for page size > ----------------------- > > Key: CASSANDRA-17189 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17189 > Project: Cassandra > Issue Type: New Feature > Components: Feature/Guardrails > Reporter: Andres de la Peña > Assignee: Bartlomiej > Priority: Normal > Labels: AdventCalendar2021, lhf > Fix For: 4.1 > > Attachments: CASSANDRA-17189-trunk.txt > > > Add guardrail limiting the query page size, for example: > {code} > # Guardrail to warn about or reject page sizes greater than threshold. > # The two thresholds default to -1 to disable. > page_size: > warn_threshold: -1 > abort_threshold: -1 > {code} > Initially this can be based on the specified number of rows used as page > size, although it would be ideal to also limit the actual size in bytes of > the returned pages. > +Additional information for newcomers:+ > # Add the configuration for the new guardrail on page size in the guardrails > section of cassandra.yaml. > # Add a getPageSize method in GuardrailsConfig returning a Threshold.Config > object > # Implement that method in GuardrailsOptions, which is the default yaml-based > implementation of GuardrailsConfig > # Add a Threshold guardrail named pageSize in Guardrails, using the > previously created config > # Define JMX-friendly getters and setters for the previously created config > in GuardrailsMBean > # Implement the JMX-friendly getters and setters in Guardrails > # Now that we have the guardrail ready, it’s time to use it. We should search > for a place to invoke the Guardrails.pageSize#guard method with the page size > that each query is going to use. The DataLimits#forPaging methods look like > good candidates for this. > # Finally, add some tests for the new guardrail. Given that the new guardrail > is a Threshold, our new test should probably extend ThresholdTester. -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org