You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ekaterina Dimitrova (Jira)" <ji...@apache.org> on 2024/12/20 06:48:00 UTC
[jira] [Comment Edited] (CASSANDRA-19492) Allow configurable v4/v6 address matching behavior for SAI indexes on CQL inet columns
[ https://issues.apache.org/jira/browse/CASSANDRA-19492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17907285#comment-17907285 ]
Ekaterina Dimitrova edited comment on CASSANDRA-19492 at 12/20/24 6:47 AM:
---------------------------------------------------------------------------
{quote}if you want repos let me know I can send your way!
{quote}
Appreciate the help! I have a repro from Michael Marshall who discovered the problem himself soon after this was reported here too. In fact I almost have a patch in the datastax/cassandra repo that I plan to push here too, soon. Looking into some failing tests.
This is the reported test:
{code:java}
@Test
public void testInetRangeQuery() throws Throwable
{
createTable("CREATE TABLE %s (pk int, val inet, PRIMARY KEY(pk))");
// Addresses are added in ascending order according to the InetAddressType.
execute("INSERT INTO %s (pk, val) VALUES (0, '0.51.33.51')");
execute("INSERT INTO %s (pk, val) VALUES (1, '267:41f9:3b96:7ea5:c825:a0aa:aac8:5164')");
execute("INSERT INTO %s (pk, val) VALUES (2, '3.199.227.48')");
execute("INSERT INTO %s (pk, val) VALUES (3, '6.7.108.133')");
execute("INSERT INTO %s (pk, val) VALUES (4, '7f5:1c0b:238:987d:18dd:e06b:ba16:a36')");
// Confirm result when there isn't an index
assertRowsIgnoringOrder(execute("SELECT pk FROM %s WHERE val > '3.199.227.48' ALLOW FILTERING"),
row(3), row(4));
createIndex("CREATE CUSTOM INDEX ON %s(val) USING 'StorageAttachedIndex'");
waitForIndexQueryable();
beforeAndAfterFlush(() -> {
// Fails because the result set also returns row 1.
assertRowsIgnoringOrder(execute("SELECT pk FROM %s WHERE val > '3.199.227.48'"),
row(3), row(4));
});
}
{code}
was (Author: e.dimitrova):
{quote}if you want repos let me know I can send your way!
{quote}
Appreciate the help! I have a repro from Michael Marshall who discovered the problem himself soon after this was reported here too. In fact I almost have a patch in the datastax/cassandra repo that I plan to push here too, soon. Looking into some failing tests.
This is the reported test:
@Testpublic void testInetRangeQuery() throws Throwable { createTable("CREATE TABLE %s (pk int, val inet, PRIMARY KEY(pk))"); // Addresses are added in ascending order according to the InetAddressType.execute("INSERT INTO %s (pk, val) VALUES (0, '0.51.33.51')"); execute("INSERT INTO %s (pk, val) VALUES (1, '267:41f9:3b96:7ea5:c825:a0aa:aac8:5164')"); execute("INSERT INTO %s (pk, val) VALUES (2, '3.199.227.48')"); execute("INSERT INTO %s (pk, val) VALUES (3, '6.7.108.133')"); execute("INSERT INTO %s (pk, val) VALUES (4, '7f5:1c0b:238:987d:18dd:e06b:ba16:a36')"); // Confirm result when there isn't an indexassertRowsIgnoringOrder(execute("SELECT pk FROM %s WHERE val > '3.199.227.48' ALLOW FILTERING"), row(3), row(4)); createIndex("CREATE CUSTOM INDEX ON %s(val) USING 'StorageAttachedIndex'"); waitForIndexQueryable(); beforeAndAfterFlush(() -> { // Fails because the result set also returns row 1.assertRowsIgnoringOrder(execute("SELECT pk FROM %s WHERE val > '3.199.227.48'"), row(3), row(4));
});
}
> Allow configurable v4/v6 address matching behavior for SAI indexes on CQL inet columns
> --------------------------------------------------------------------------------------
>
> Key: CASSANDRA-19492
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19492
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: Feature/SAI
> Reporter: Caleb Rackliffe
> Assignee: Ekaterina Dimitrova
> Priority: Normal
> Fix For: 5.0.x, 5.x
>
>
> The {{inet}} type in CQL allows ipv4 and ipv6 address formats to mix in the same column, and while there is a standard conversion between v4 and v6, equivalent addresses are not considered equal by Cassandra, when it comes to their usage in keys or in filtering queries. However, in SAI queries, equivalent v4 and v6 addresses ARE considered equal. Even if this behavior is useful, it might be a good idea to make the default behavior consistent with filtering, and allow the index configuration to control whether or not to consider them equal. (We have precedent for this w/ case-insensitive indexing of text columns, etc.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org