Skip to content

CREATE MATERIALIZED VIEW fails if the keyspace is based on tablets #16194

@nyh

Description

@nyh

This is the first step towards making materialized views work on keyspaces that use tablets instead of vnodes
(see https://docs.google.com/document/d/1h41j6_J7cYt0dsNN9tW8D014elbHk_Arm0Yd2yYS_1w/edit for the whole story of what we need to do in this area).

Right now, already the CREATE MATERIALIZED VIEW statement fails - even before we try to do anything in the view. The following trivial topology test fails with the 'initial_tablets':100, but passes without it:

async def test_tablet_mv_create(manager: ManagerClient):
     servers = [await manager.server_add() for i in range(3)]
    cql = manager.get_cql()
    await cql.run_async("CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3, 'initial_tablets': 100}")
    await cql.run_async("CREATE TABLE test.test (pk int PRIMARY KEY, c int)")
    await cql.run_async("CREATE MATERIALIZED VIEW test.tv AS SELECT * FROM test.test WHERE c IS NOT NULL AND pk IS NOT NULL PRIMARY KEY (c, pk)")

The CREATE MATERIALIZED VIEW command fails with:

Host: 127.61.5.1:9042 [Server error] message="Raft instance is stopped, reason: "background error, std::_Nested_exception<raft::state_machine_error> (State machine error at raft/server.cc:1230): std::runtime_error (Tablet map not found for table c2cd5770-8d3e-11ee-a9c1-f2703fb1fc1a)"
Host: 127.61.5.2:9042 [Server error] message="Raft instance is stopped"
Host: 127.61.5.3:9042 [Server error] message="Raft instance is stopped"

UPDATE: you don't need 3 nodes to see this test fail - just one node is enough.

CC @eliransin @kostja @tgrabiec

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions