You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "maedhroz (via GitHub)" <gi...@apache.org> on 2024/04/09 22:33:45 UTC
[PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding configured term max size [cassandra]
maedhroz opened a new pull request, #3241:
URL: https://github.com/apache/cassandra/pull/3241
patch by Caleb Rackliffe; reviewed by ? for CASSANDRA-19493
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566155961
##########
src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java:
##########
@@ -497,11 +497,15 @@ public boolean isQueryable(Status status)
}
@Override
- public void validate(PartitionUpdate update) throws InvalidRequestException
+ public void validate(PartitionUpdate update, ClientState state) throws InvalidRequestException
{
DecoratedKey key = update.partitionKey();
- for (Row row : update)
- validateMaxTermSizeForRow(key, row, true);
+
+ if (indexTermType.columnMetadata().isStatic())
Review Comment:
The static row isn't in the tree and so isn't returned from the iterator. Gotta love static rows, huh?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565468865
##########
src/java/org/apache/cassandra/db/IMutation.java:
##########
@@ -24,24 +24,25 @@
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.partitions.PartitionUpdate;
import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.ClientState;
public interface IMutation
{
- public long MAX_MUTATION_SIZE = DatabaseDescriptor.getMaxMutationSize();
+ long MAX_MUTATION_SIZE = DatabaseDescriptor.getMaxMutationSize();
- public void apply();
Review Comment:
if you are removing this, we should be consistent and remove it for `void validateSize` and `static long dataSize` methods at the end of this file as well
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1567689106
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
I think @JeremiahDJordan's input counts for something here, given he's the only one of us running SAI in production (in Astra). Also, if you look at this patch from the perspective of what was here before, all I've done is take the same (or even more lenient) max term sizes, and make sure writes fail visibly for the client. This seems strictly better than silently compromising the index with not so much as a warning.
The limits on term size before my patch here were derived at some point during development at DS to protect the index, and I'm -100 on them being opt-in, especially because they are brand new in 5.0 (as is SAI itself). I'm more or less willing to die on this hill.
CC @mike-tr-adamson
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566170031
##########
src/java/org/apache/cassandra/db/IMutation.java:
##########
@@ -24,24 +24,25 @@
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.partitions.PartitionUpdate;
import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.ClientState;
public interface IMutation
{
- public long MAX_MUTATION_SIZE = DatabaseDescriptor.getMaxMutationSize();
+ long MAX_MUTATION_SIZE = DatabaseDescriptor.getMaxMutationSize();
- public void apply();
Review Comment:
Done
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566866200
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
Yeah I noticed lol!
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565201983
##########
src/java/org/apache/cassandra/config/GuardrailsOptions.java:
##########
@@ -1080,8 +1164,8 @@ private static void validateWarnLowerThanFail(long warn, long fail, String name)
return;
if (fail < warn)
- throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should be lower " +
- "than the fail threshold %d", warn, name, fail));
+ throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should not be " +
Review Comment:
That should be ok. I doubt anybody is parsing these messages. Just mentioning it to be on the safe side.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565288983
##########
src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java:
##########
@@ -497,11 +497,15 @@ public boolean isQueryable(Status status)
}
@Override
- public void validate(PartitionUpdate update) throws InvalidRequestException
+ public void validate(PartitionUpdate update, ClientState state) throws InvalidRequestException
{
DecoratedKey key = update.partitionKey();
- for (Row row : update)
- validateMaxTermSizeForRow(key, row, true);
+
+ if (indexTermType.columnMetadata().isStatic())
Review Comment:
Do iiuc static rows were being missed before?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566870564
##########
test/unit/org/apache/cassandra/db/guardrails/GuardrailSaiFrozenTermSizeTest.java:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.db.guardrails;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import org.apache.cassandra.config.DataStorageSpec;
+import org.apache.cassandra.transport.messages.ResultMessage;
+
+import static java.lang.String.format;
+import static org.apache.cassandra.config.DataStorageSpec.DataStorageUnit.BYTES;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests the guardrails around the size of SAI frozen terms
+ *
+ * @see Guardrails#saiFrozenTermSize
+ */
+public class GuardrailSaiFrozenTermSizeTest extends ValueThresholdTester
+{
+ private static final int WARN_THRESHOLD = 2048; // bytes
+ private static final int FAIL_THRESHOLD = WARN_THRESHOLD * 4; // bytes
+
+ public GuardrailSaiFrozenTermSizeTest()
+ {
+ super(WARN_THRESHOLD + "B",
+ FAIL_THRESHOLD + "B",
+ Guardrails.saiFrozenTermSize,
+ Guardrails::setSaiFrozenTermSizeThreshold,
+ Guardrails::getSaiFrozenTermSizeWarnThreshold,
+ Guardrails::getSaiFrozenTermSizeFailThreshold,
+ bytes -> new DataStorageSpec.LongBytesBound(bytes, BYTES).toString(),
+ size -> new DataStorageSpec.LongBytesBound(size).toBytes());
+ }
+
+ @Override
+ protected int warnThreshold()
+ {
+ return WARN_THRESHOLD;
+ }
+
+ @Override
+ protected int failThreshold()
+ {
+ return FAIL_THRESHOLD;
+ }
+
+ @Test
+ public void testTuple() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, t tuple<text, text>)");
+ createIndex("CREATE INDEX ON %s (t) USING 'sai'");
+
+ testThreshold2("t", "INSERT INTO %s (k, t) VALUES (0, (?, ?))", 8);
+ testThreshold2("t", "UPDATE %s SET t = (?, ?) WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenUDT() throws Throwable
+ {
+ String udt = createType("CREATE TYPE %s (a text, b text)");
+ createTable(format("CREATE TABLE %%s (k int PRIMARY KEY, v frozen<%s>)", udt));
+ createIndex("CREATE INDEX ON %s (v) USING 'sai'");
+
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?})", 8);
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {b: ?})", 8);
+ testThreshold("v", "UPDATE %s SET v = {a: ?} WHERE k = 0", 8);
+ testThreshold("v", "UPDATE %s SET v = {b: ?} WHERE k = 0", 8);
+ testThreshold2("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?, b: ?})", 8);
+ testThreshold2("v", "UPDATE %s SET v = {a: ?, b: ?} WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenList() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, fl frozen<list<text>>)");
+ createIndex("CREATE INDEX ON %s (FULL(fl)) USING 'sai'");
+
+ // the serialized size of a frozen list is the size of its serialized elements, plus a 32-bit integer prefix for
+ // the number of elements, and another 32-bit integer for the size of each element
+
+ for (String query : Arrays.asList("INSERT INTO %s (k, fl) VALUES (0, ?)",
+ "UPDATE %s SET fl = ? WHERE k = 0"))
+ {
+ testFrozenCollection("fl", query, this::list);
+ }
+ }
+
+ @Test
+ public void testWarningTupleOnBuild()
+ {
+ ByteBuffer largeTuple = ByteBuffer.allocate(warnThreshold() + 1);
+ ByteBuffer smallTuple = ByteBuffer.allocate(1);
+
+ createTable(KEYSPACE, "CREATE TABLE %s (k int PRIMARY KEY, t tuple<text>)");
+ execute("INSERT INTO %s (k, t) VALUES (0, (?))", largeTuple);
+ execute("INSERT INTO %s (k, t) VALUES (1, (?))", smallTuple);
+ createIndex("CREATE INDEX ON %s(t) USING 'sai'");
+
+ // verify that the large tuple is written on initial index build
+ assertEquals(((ResultMessage.Rows) execute("SELECT * FROM %s WHERE t = (?)", largeTuple)).result.size(), 1);
Review Comment:
Right apologies.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565466969
##########
src/java/org/apache/cassandra/cql3/statements/BatchUpdatesCollector.java:
##########
@@ -124,15 +125,15 @@ private IMutationBuilder makeMutationBuilder(TableMetadata metadata, DecoratedKe
* Returns a collection containing all the mutations.
* @return a collection containing all the mutations.
*/
- public List<IMutation> toMutations()
+ public List<IMutation> toMutations(ClientState state)
Review Comment:
nit @maedhroz what about updating the javadoc too?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566152157
##########
src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java:
##########
@@ -497,11 +497,15 @@ public boolean isQueryable(Status status)
}
@Override
- public void validate(PartitionUpdate update) throws InvalidRequestException
+ public void validate(PartitionUpdate update, ClientState state) throws InvalidRequestException
{
DecoratedKey key = update.partitionKey();
- for (Row row : update)
- validateMaxTermSizeForRow(key, row, true);
+
+ if (indexTermType.columnMetadata().isStatic())
Review Comment:
As far as I can tell, they absolutely were missed.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566872957
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
I don't have an opinion here. I don't have production numbers to refer to neither I know SAI in that regard, so whatever you guys think it's reasonable.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566123676
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
So how does this look?
string: 1KiB warn/8KiB fail
frozen: 1KiB warn/8KiB fail
vector: 16KiB warn/32KiB fail
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565203383
##########
src/java/org/apache/cassandra/db/guardrails/Guardrails.java:
##########
@@ -359,7 +359,7 @@ public final class Guardrails implements GuardrailsMBean
state -> sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getColumnValueSizeWarnThreshold()),
state -> sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getColumnValueSizeFailThreshold()),
(isWarning, what, value, threshold) ->
- format("Value of column %s has size %s, this exceeds the %s threshold of %s.",
+ format("Value of column '%s' has size %s, this exceeds the %s threshold of %s.",
Review Comment:
Again change should be ok.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565299837
##########
test/unit/org/apache/cassandra/cql3/CQLTester.java:
##########
@@ -2549,6 +2549,14 @@ protected Vector<Float> vector(float[] v)
return new Vector<>(v2);
}
+ protected List<Float> vectorAsList(float[] v)
Review Comment:
Guava `Floats.asList()`?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "JeremiahDJordan (via GitHub)" <gi...@apache.org>.
JeremiahDJordan commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566114697
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
I would set frozen and string to be the same at 8k.
I think 32k still works for vectors. 4096 float32 is still the largest embedding I have seen truly used.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565466969
##########
src/java/org/apache/cassandra/cql3/statements/BatchUpdatesCollector.java:
##########
@@ -124,15 +125,15 @@ private IMutationBuilder makeMutationBuilder(TableMetadata metadata, DecoratedKe
* Returns a collection containing all the mutations.
* @return a collection containing all the mutations.
*/
- public List<IMutation> toMutations()
+ public List<IMutation> toMutations(ClientState state)
Review Comment:
@maedhroz what about updating the javadoc too?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565478380
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
by the way ... where are all these values for defaults coming from? I am not necessarily arguing the sizes as such, I am curious based on what we put these sizes there? Is that some kind of an empirical observation or something else? Shouldn't we just put everywhere "0" so people will make their minds about the sizes?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1567689106
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
I think @JeremiahDJordan's input counts for something here, given he's the only one of us (maybe @bereng too?) running SAI in production (in Astra). Also, if you look at this patch from the perspective of what was here before, all I've done is take the same (or even more lenient) max term sizes, and make sure writes fail visibly for the client. This seems strictly better than silently compromising the index with not so much as a warning. (I didn't even change the behavior on initial index build or compaction, other than making the warning threshold a bit more lenient.)
The limits on term size before my patch here were derived at some point during development at DS to protect the index, and I'm -100 on them being opt-in, especially because they are brand new in 5.0 (as is SAI itself). I'm more or less willing to die on this hill.
CC @mike-tr-adamson
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566165675
##########
test/unit/org/apache/cassandra/cql3/CQLTester.java:
##########
@@ -2549,6 +2549,14 @@ protected Vector<Float> vector(float[] v)
return new Vector<>(v2);
}
+ protected List<Float> vectorAsList(float[] v)
Review Comment:
Perfect. Was looking for something like that...
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565306970
##########
test/unit/org/apache/cassandra/db/guardrails/GuardrailSaiFrozenTermSizeTest.java:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.db.guardrails;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import org.apache.cassandra.config.DataStorageSpec;
+import org.apache.cassandra.transport.messages.ResultMessage;
+
+import static java.lang.String.format;
+import static org.apache.cassandra.config.DataStorageSpec.DataStorageUnit.BYTES;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests the guardrails around the size of SAI frozen terms
+ *
+ * @see Guardrails#saiFrozenTermSize
+ */
+public class GuardrailSaiFrozenTermSizeTest extends ValueThresholdTester
+{
+ private static final int WARN_THRESHOLD = 2048; // bytes
+ private static final int FAIL_THRESHOLD = WARN_THRESHOLD * 4; // bytes
+
+ public GuardrailSaiFrozenTermSizeTest()
+ {
+ super(WARN_THRESHOLD + "B",
+ FAIL_THRESHOLD + "B",
+ Guardrails.saiFrozenTermSize,
+ Guardrails::setSaiFrozenTermSizeThreshold,
+ Guardrails::getSaiFrozenTermSizeWarnThreshold,
+ Guardrails::getSaiFrozenTermSizeFailThreshold,
+ bytes -> new DataStorageSpec.LongBytesBound(bytes, BYTES).toString(),
+ size -> new DataStorageSpec.LongBytesBound(size).toBytes());
+ }
+
+ @Override
+ protected int warnThreshold()
+ {
+ return WARN_THRESHOLD;
+ }
+
+ @Override
+ protected int failThreshold()
+ {
+ return FAIL_THRESHOLD;
+ }
+
+ @Test
+ public void testTuple() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, t tuple<text, text>)");
+ createIndex("CREATE INDEX ON %s (t) USING 'sai'");
+
+ testThreshold2("t", "INSERT INTO %s (k, t) VALUES (0, (?, ?))", 8);
+ testThreshold2("t", "UPDATE %s SET t = (?, ?) WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenUDT() throws Throwable
+ {
+ String udt = createType("CREATE TYPE %s (a text, b text)");
+ createTable(format("CREATE TABLE %%s (k int PRIMARY KEY, v frozen<%s>)", udt));
+ createIndex("CREATE INDEX ON %s (v) USING 'sai'");
+
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?})", 8);
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {b: ?})", 8);
+ testThreshold("v", "UPDATE %s SET v = {a: ?} WHERE k = 0", 8);
+ testThreshold("v", "UPDATE %s SET v = {b: ?} WHERE k = 0", 8);
+ testThreshold2("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?, b: ?})", 8);
+ testThreshold2("v", "UPDATE %s SET v = {a: ?, b: ?} WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenList() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, fl frozen<list<text>>)");
+ createIndex("CREATE INDEX ON %s (FULL(fl)) USING 'sai'");
+
+ // the serialized size of a frozen list is the size of its serialized elements, plus a 32-bit integer prefix for
+ // the number of elements, and another 32-bit integer for the size of each element
+
+ for (String query : Arrays.asList("INSERT INTO %s (k, fl) VALUES (0, ?)",
+ "UPDATE %s SET fl = ? WHERE k = 0"))
+ {
+ testFrozenCollection("fl", query, this::list);
+ }
+ }
+
+ @Test
+ public void testWarningTupleOnBuild()
+ {
+ ByteBuffer largeTuple = ByteBuffer.allocate(warnThreshold() + 1);
+ ByteBuffer smallTuple = ByteBuffer.allocate(1);
+
+ createTable(KEYSPACE, "CREATE TABLE %s (k int PRIMARY KEY, t tuple<text>)");
+ execute("INSERT INTO %s (k, t) VALUES (0, (?))", largeTuple);
+ execute("INSERT INTO %s (k, t) VALUES (1, (?))", smallTuple);
+ createIndex("CREATE INDEX ON %s(t) USING 'sai'");
+
+ // verify that the large tuple is written on initial index build
+ assertEquals(((ResultMessage.Rows) execute("SELECT * FROM %s WHERE t = (?)", largeTuple)).result.size(), 1);
Review Comment:
No usage of `assertThresholdWarns`?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1563691881
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
@jacek-lewandowski @smiklosovic This was causing issues for `ValueThresholdTester`, which is a subclass of `ThresholdTester` but is also `abstract`. Basically we can handle more than one level of inheritance now. WDYT?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#issuecomment-2061722862
Committed as https://github.com/apache/cassandra/commit/9bfaee91c4fd7a269e3ff924e8a504bad5d6514a
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566151219
##########
src/java/org/apache/cassandra/db/guardrails/Guardrails.java:
##########
@@ -359,7 +359,7 @@ public final class Guardrails implements GuardrailsMBean
state -> sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getColumnValueSizeWarnThreshold()),
state -> sizeToBytes(CONFIG_PROVIDER.getOrCreate(state).getColumnValueSizeFailThreshold()),
(isWarning, what, value, threshold) ->
- format("Value of column %s has size %s, this exceeds the %s threshold of %s.",
+ format("Value of column '%s' has size %s, this exceeds the %s threshold of %s.",
Review Comment:
Yeah, basically just did it so I didn't have to special case things in the tests.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565297004
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
Sgtm, you're just walking the whole tree.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565478380
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
by the way ... where are all these values for defaults coming from? I am not necessarily arguing the sizes as such, I am curious based on what we put these sizes there? Is that some kind of an empirical observation or something else? Shouldn't we just put everywhere "0" so people will make their minds about the sizes? We can default to zero (as not triggered) and then in cassandra.yaml we would provide the recommended sizes if people choose to turn it on.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565476321
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
@maedhroz you should also update `cassandra.yaml` with all these guardrails otherwise people wont have a clue they are available.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1567131979
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
I dont know if we should go with the defaults in the first place. That is my biggest concern. I would just keep it disabled and people might opt-in. You can bring this to ML and ask. Maybe I am a little bit paranoid here but we should triple check that these figures make sense to as broad audience as possible.
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
@maedhroz I dont know if we should go with the defaults in the first place. That is my biggest concern. I would just keep it disabled and people might opt-in. You can bring this to ML and ask. Maybe I am a little bit paranoid here but we should triple check that these figures make sense to as broad audience as possible.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566024162
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
So you'll notice the frozen and vector fail thresholds are just the previous system property maxes: https://github.com/apache/cassandra/pull/3241/files#diff-32a8b4fa02cda1ef5a7216fe68d70d23a9784a4bb33b1230d2ec776140dae3d7L428
For strings, I bumped the fail threshold to a number @JeremiahDJordan had mentioned in Slack that Astra was using as a fail threshold (and left the previous max as the new warning 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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz closed pull request #3241: CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size
URL: https://github.com/apache/cassandra/pull/3241
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566149589
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
Bonus: Getting to use a `Deque` for something :D
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566155961
##########
src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java:
##########
@@ -497,11 +497,15 @@ public boolean isQueryable(Status status)
}
@Override
- public void validate(PartitionUpdate update) throws InvalidRequestException
+ public void validate(PartitionUpdate update, ClientState state) throws InvalidRequestException
{
DecoratedKey key = update.partitionKey();
- for (Row row : update)
- validateMaxTermSizeForRow(key, row, true);
+
+ if (indexTermType.columnMetadata().isStatic())
Review Comment:
The static row isn't in the tree and so isn't returned from the iterator. Love static rows, huh?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566168394
##########
test/unit/org/apache/cassandra/db/guardrails/GuardrailSaiFrozenTermSizeTest.java:
##########
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.db.guardrails;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import org.apache.cassandra.config.DataStorageSpec;
+import org.apache.cassandra.transport.messages.ResultMessage;
+
+import static java.lang.String.format;
+import static org.apache.cassandra.config.DataStorageSpec.DataStorageUnit.BYTES;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests the guardrails around the size of SAI frozen terms
+ *
+ * @see Guardrails#saiFrozenTermSize
+ */
+public class GuardrailSaiFrozenTermSizeTest extends ValueThresholdTester
+{
+ private static final int WARN_THRESHOLD = 2048; // bytes
+ private static final int FAIL_THRESHOLD = WARN_THRESHOLD * 4; // bytes
+
+ public GuardrailSaiFrozenTermSizeTest()
+ {
+ super(WARN_THRESHOLD + "B",
+ FAIL_THRESHOLD + "B",
+ Guardrails.saiFrozenTermSize,
+ Guardrails::setSaiFrozenTermSizeThreshold,
+ Guardrails::getSaiFrozenTermSizeWarnThreshold,
+ Guardrails::getSaiFrozenTermSizeFailThreshold,
+ bytes -> new DataStorageSpec.LongBytesBound(bytes, BYTES).toString(),
+ size -> new DataStorageSpec.LongBytesBound(size).toBytes());
+ }
+
+ @Override
+ protected int warnThreshold()
+ {
+ return WARN_THRESHOLD;
+ }
+
+ @Override
+ protected int failThreshold()
+ {
+ return FAIL_THRESHOLD;
+ }
+
+ @Test
+ public void testTuple() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, t tuple<text, text>)");
+ createIndex("CREATE INDEX ON %s (t) USING 'sai'");
+
+ testThreshold2("t", "INSERT INTO %s (k, t) VALUES (0, (?, ?))", 8);
+ testThreshold2("t", "UPDATE %s SET t = (?, ?) WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenUDT() throws Throwable
+ {
+ String udt = createType("CREATE TYPE %s (a text, b text)");
+ createTable(format("CREATE TABLE %%s (k int PRIMARY KEY, v frozen<%s>)", udt));
+ createIndex("CREATE INDEX ON %s (v) USING 'sai'");
+
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?})", 8);
+ testThreshold("v", "INSERT INTO %s (k, v) VALUES (0, {b: ?})", 8);
+ testThreshold("v", "UPDATE %s SET v = {a: ?} WHERE k = 0", 8);
+ testThreshold("v", "UPDATE %s SET v = {b: ?} WHERE k = 0", 8);
+ testThreshold2("v", "INSERT INTO %s (k, v) VALUES (0, {a: ?, b: ?})", 8);
+ testThreshold2("v", "UPDATE %s SET v = {a: ?, b: ?} WHERE k = 0", 8);
+ }
+
+ @Test
+ public void testFrozenList() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, fl frozen<list<text>>)");
+ createIndex("CREATE INDEX ON %s (FULL(fl)) USING 'sai'");
+
+ // the serialized size of a frozen list is the size of its serialized elements, plus a 32-bit integer prefix for
+ // the number of elements, and another 32-bit integer for the size of each element
+
+ for (String query : Arrays.asList("INSERT INTO %s (k, fl) VALUES (0, ?)",
+ "UPDATE %s SET fl = ? WHERE k = 0"))
+ {
+ testFrozenCollection("fl", query, this::list);
+ }
+ }
+
+ @Test
+ public void testWarningTupleOnBuild()
+ {
+ ByteBuffer largeTuple = ByteBuffer.allocate(warnThreshold() + 1);
+ ByteBuffer smallTuple = ByteBuffer.allocate(1);
+
+ createTable(KEYSPACE, "CREATE TABLE %s (k int PRIMARY KEY, t tuple<text>)");
+ execute("INSERT INTO %s (k, t) VALUES (0, (?))", largeTuple);
+ execute("INSERT INTO %s (k, t) VALUES (1, (?))", smallTuple);
+ createIndex("CREATE INDEX ON %s(t) USING 'sai'");
+
+ // verify that the large tuple is written on initial index build
+ assertEquals(((ResultMessage.Rows) execute("SELECT * FROM %s WHERE t = (?)", largeTuple)).result.size(), 1);
Review Comment:
In this case, there is no client warning, because the INSERT happens before the index exists. There would be a log message, however.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1563692311
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
CC @bereng
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565478380
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
by the way ... where are all these values for defaults coming from? I am not necessarily arguing the sizes as such, I am curious based on what we put these sizes there? Is that some kind of an empirical observation or something else?
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1565993860
##########
src/java/org/apache/cassandra/config/GuardrailsOptions.java:
##########
@@ -1164,8 +1164,8 @@ private static void validateWarnLowerThanFail(long warn, long fail, String name)
return;
if (fail < warn)
- throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should not be " +
- "higher than the fail threshold %d", warn, name, fail));
+ throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should be lower " +
+ "than the fail threshold %d", warn, name, fail));
Review Comment:
@adelapena @bereng @smiklosovic I don't really want to fix it in this patch, but the check and the warning message don't strictly agree. Either it should be `if (fail <= warn)` or the error message needs to change.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#issuecomment-2057626336
Pushed a follow-up commit that I think should address the comments so far...
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "bereng (via GitHub)" <gi...@apache.org>.
bereng commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1566875105
##########
src/java/org/apache/cassandra/config/GuardrailsOptions.java:
##########
@@ -1164,8 +1164,8 @@ private static void validateWarnLowerThanFail(long warn, long fail, String name)
return;
if (fail < warn)
- throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should not be " +
- "higher than the fail threshold %d", warn, name, fail));
+ throw new IllegalArgumentException(format("The warn threshold %d for %s_warn_threshold should be lower " +
+ "than the fail threshold %d", warn, name, fail));
Review Comment:
If you find a bug you fix it... I don't see a problem with that.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19493 Optionally fail writes when SAI refuses to index a term value exceeding a configured maximum size [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1567702354
##########
src/java/org/apache/cassandra/config/Config.java:
##########
@@ -903,11 +903,18 @@ public static void setClientMode(boolean clientMode)
public volatile boolean zero_ttl_on_twcs_warned = true;
public volatile boolean zero_ttl_on_twcs_enabled = true;
public volatile boolean non_partition_restricted_index_query_enabled = true;
- public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
- public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
public volatile boolean intersect_filtering_query_warned = true;
public volatile boolean intersect_filtering_query_enabled = true;
+ public volatile int sai_sstable_indexes_per_query_warn_threshold = 32;
+ public volatile int sai_sstable_indexes_per_query_fail_threshold = -1;
+ public volatile DataStorageSpec.LongBytesBound sai_string_term_size_warn_threshold = new DataStorageSpec.LongBytesBound("1KiB");
Review Comment:
Alright. Let's keep it like it is now.
--
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-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org