Skip to content

Add Cassandra system keyspace and virtual view support - #15

Merged
patricklbell merged 15 commits into
masterfrom
copilot/add-cassandra-system-keyspace-support
Mar 10, 2026
Merged

patricklbell merged 15 commits into
masterfrom
copilot/add-cassandra-system-keyspace-support

Conversation

Copilot AI commented Mar 8, 2026 •

Copy link
Copy Markdown

Cassandra drivers query system.local, system.peers, and system_schema.* tables during connection setup. Without these, no standard driver can connect to objstore's native protocol.

Changes

  • VirtualRows result type — New ResultKind::VirtualRows with VirtualColumn/VirtualRow structs in engine.cppm for query results not backed by btree storage
  • System table handlers in engine.cpp:
    • system.local — single row with cluster name, data center, rack, partitioner, protocol version, etc.
    • system.peers / system.peers_v2 — empty (single-node)
    • system_schema.keyspaces / tables / columns — reflect live schema with column kinds and types
  • Native protocol serialization — append_result_virtual_rows() in native.cppm serializes virtual rows identically to storage-backed rows
  • System keyspace guards — USE system, CREATE KEYSPACE IF NOT EXISTS system handled without touching storage
  • REPL/HTTP — VirtualRows case added to both output paths

Example

objstore> SELECT * FROM system.local;
 key   | cluster_name | data_center  | rack  | release_version
 local | objstore     | datacenter1  | rack1 | 4.0.0
(1 rows)

objstore> SELECT * FROM system_schema.columns;
 keyspace_name | table_name | column_name | kind          | type
 test_ks       | users      | id          | partition_key | int
 test_ks       | users      | name        | regular       | text
(2 rows)

System queries are intercepted in SelectFrom before the WHERE/LIMIT assertions, so driver queries like SELECT * FROM system.local WHERE key='local' work without general WHERE execution support.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • lexy.foonathan.net
    • Triggering command: /usr/local/bin/cmake /usr/local/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /home/REDACTED/work/plexdb/plexdb/build/_deps/lexy-subbuild/lexy-populate-prefix/src/lexy-populate-stamp/download-lexy-populate.cmake (dns block)
    • Triggering command: /usr/local/bin/cmake /usr/local/bin/cmake -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -P /home/REDACTED/work/plexdb/plexdb/build/_deps/lexy-subbuild/lexy-populate-prefix/src/lexy-populate-stamp/download-lexy-populate.cmake conf�� get opulate-prefix/src/lexy-populate-stamp/download-lexy-populate.cmake cal/bin/bash http.https://git/usr/local/bin/ninja (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for Cassandra system keyspace and other virtual views</issue_title>
<issue_description>The objstore database has basic support for the cassandra query language native protocol. To enable existing cassandra drivers to communicate with objstore we need to support system views such as system.local and expand our current excution implementation to support basic queries.

Use the Cassandra java source file https://github.com/apache/cassandra/blob/5519df34cb725904ef567e377657cddd580e7c0f/src/java/org/apache/cassandra/db/SystemKeyspace.java#L4 as a reference for all the cassandra system keyspaces. Implementing new features in the data storage layer (blob and btree) is out of scope.

Testing

You can test using the cassandra driver using test_cql.js and new unit tests. To test with test_cql.js

  • Start ./build/objstore/objstore_server <db_path> --native in the background
  • Wait for "listening on port 9042" in its output
  • Run node extra/node/test_cql.js
  • Sending SIGUSR1 to the server PID using objstore_server_shutdown.sh to shut it down cleanly</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 8, 2026 07:59
- Add VirtualRows struct to engine for non-storage-backed query results
- Implement system.local, system.peers, system.peers_v2 virtual tables
- Implement system_schema.keyspaces, tables, columns reflecting actual schema
- Handle VirtualRows serialization in native protocol layer
- Handle system keyspaces in USE statement
- Add VirtualRows case to REPL and HTTP modules
- Add unit tests for system virtual view queries

Co-authored-by: patricklbell <46551885+patricklbell@users.noreply.github.com>
Co-authored-by: patricklbell <46551885+patricklbell@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Cassandra system keyspace and virtual views Add Cassandra system keyspace and virtual view support Mar 8, 2026
patricklbell and others added 12 commits March 10, 2026 22:18
Co-authored-by: patricklbell <46551885+patricklbell@users.noreply.github.com>
Co-authored-by: patricklbell <46551885+patricklbell@users.noreply.github.com>
Co-authored-by: patricklbell <46551885+patricklbell@users.noreply.github.com>
…tests

- Updated CQL data type definitions to use `dtype::make_native` for consistency.
- Modified the `CREATE TABLE` parsing tests to reflect changes in data type representation.
- Added a new test for verifying the serialization of collections in the native protocol.
- Implemented a new utility function `body_contains_bytes` for checking byte patterns in responses.
- Enhanced the dynamic array and map implementations with initializer list support and improved memory management.
- Introduced a new `DynamicSet` container with basic operations and iterators.
- Added XXHash implementation for efficient hashing in dynamic containers.
@patricklbell
patricklbell marked this pull request as ready for review March 10, 2026 11:19
@patricklbell
patricklbell merged commit ae786fd into master Mar 10, 2026
3 checks passed
@patricklbell
patricklbell deleted the copilot/add-cassandra-system-keyspace-support branch March 10, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Cassandra system keyspace and other virtual views

2 participants