Files
scylladb/test/cluster/test_vector_store.py
Piotr Dulikowski bb6e41f97a index: allow vector indexes without rf_rack_valid_keyspces
The rf_rack_valid_keyspaces option needs to be turned on in order to
allow creating materialized views in tablet keyspaces with numeric RF
per DC. This is also necessary for secondary indexes because they use
materialized views underneath. However, this option is _not_ necessary
for vector store indexes because those use the external vector store
service for querying the list of keys to fetch from the main table, they
do not create a materialized view. The rf_rack_valid_keyspaces was, by
accident, required for vector indexes, too.

Remove the restriction for vector store indexes as it is completely
unnecessary.

Fixes: SCYLLADB-81

Closes scylladb/scylladb#27447
2025-12-05 09:26:26 +02:00

40 lines
1.4 KiB
Python

#
# Copyright (C) 2025-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
#
import logging
import pytest
from test.pylib.manager_client import ManagerClient
logger = logging.getLogger(__name__)
# Regression test for SCYLLADB-81.
#
# Unlike regular secondary indexes, vector indexes do not use materialized views
# in their implementation, therefore they do not need the keyspace
# to be rf-rack-valid in order to function properly.
#
# In this test, we check that creating a vector index without
# rf_rack_valid_keyspaces being set is possible.
@pytest.mark.asyncio
async def test_vector_store_can_be_created_without_rf_rack_valid(manager: ManagerClient):
# Explicitly disable the rf_rack_valid_keyspaces option.
config = {"rf_rack_valid_keyspaces": False}
srv = await manager.server_add(config=config)
cql, _ = await manager.get_ready_cql([srv])
# Explicitly create a keyspace with tablets.
await cql.run_async("CREATE KEYSPACE ks WITH replication = "
"{'class': 'NetworkTopologyStrategy', 'replication_factor': 1} "
"AND tablets = {'enabled': true}")
await cql.run_async("CREATE TABLE ks.t (pk int PRIMARY KEY, v vector<float, 3>)")
# Creating a vector store index should succeed.
await cql.run_async("CREATE CUSTOM INDEX ON ks.t(v) USING 'vector_index'")