Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 23E5D200B23 for ; Sun, 5 Jun 2016 05:35:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 14DFF160A4E; Sun, 5 Jun 2016 03:35:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5829D160A26 for ; Sun, 5 Jun 2016 05:35:01 +0200 (CEST) Received: (qmail 32480 invoked by uid 500); 5 Jun 2016 03:35:00 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 32456 invoked by uid 99); 5 Jun 2016 03:35:00 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Jun 2016 03:35:00 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 83FCB2C1F79 for ; Sun, 5 Jun 2016 03:34:59 +0000 (UTC) Date: Sun, 5 Jun 2016 03:34:59 +0000 (UTC) From: "Jeff Jirsa (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-7622) Implement virtual tables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 05 Jun 2016 03:35:02 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-7622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15315709#comment-15315709 ] Jeff Jirsa commented on CASSANDRA-7622: --------------------------------------- Proposing: {code} CREATE TABLE USING 'o.a.c.db.virtual.ClassName' [IF NOT EXISTS] ks.cfName ( column text, column2 int, etc ) WITH virtual_table_options = {'key':'value', 'key2':'value2'} {code} Implication here is that K_USING already exists in the grammar (e.g. custom indexes), and it's fairly consistent for users. Presence of {{USING class}} would sets a {{VIRTUAL}} flag for the CFMetaData. Instantiate the specified class passing the CFMetadata and key/value map, store the resulting instance somewhere (map within Schema?). Columns would still be defined in the standard way, persisted to the normal schema tables so drivers / cqlsh wouldn't need to be modified. At minimum, the virtual tables should implement: {code} public String class(); public Map options(); public String keyspace(); public String tableName(); public boolean writable(); public void execute(PartitionUpdate update, Clustering clustering, UpdateParameters params) throws InvalidRequestException; public boolean readable(); public ResultMessage.Rows execute(QueryState state, QueryOptions options) throws RequestExecutionException, RequestValidationException; {code} Then, in {{SelectStatement}} if the CFMetadata isVirtual and {{readable()}}, pass state/options from {{SelectStatement.execute}} through to the virtual table's version. Similarly, in {{UpdateStatement}}, if CFMetadata isVirtual for any updated rows and {{writable()}}, pass partitionKey + params from {{UpdataStatement.execute}} through to the virtual table's version. The virtual tables I'm specifically interested in: - JMX getters and setters, probably implemented as multiple smaller virtual tables: -- Ring state / equivalent of {{nodetool gossipinfo}} / {{o.a.c.net FailureDetector}} -- CF attributes / equivalent of {{o.a.c.db ColumnFamilies.keyspace.table CompactionParametersJson}} and similar -- JMX {{o.a.c.metrics}} - YAML config getters and setters a la CASSANDRA-9233 - SSTableMetadata virtual table (list all sstables per CF, showing timestamps / repairedAt, ponies may with UPDATE .. SET deleted=true to mark a table obsolete) Feedback appreciated on all of this, but especially: - The two meaty {{execute}} functions here provide a lot of flexibility, but also a lot of rope - is it too much rope? - On {{ALTER}} table: we could simply replace the instance in the map, or do we disallow ALTER (and instead require DROP + CREATE)? > Implement virtual tables > ------------------------ > > Key: CASSANDRA-7622 > URL: https://issues.apache.org/jira/browse/CASSANDRA-7622 > Project: Cassandra > Issue Type: Improvement > Reporter: Tupshin Harper > Assignee: Jeff Jirsa > Fix For: 3.x > > > There are a variety of reasons to want virtual tables, which would be any table that would be backed by an API, rather than data explicitly managed and stored as sstables. > One possible use case would be to expose JMX data through CQL as a resurrection of CASSANDRA-3527. > Another is a more general framework to implement the ability to expose yaml configuration information. So it would be an alternate approach to CASSANDRA-7370. > A possible implementation would be in terms of CASSANDRA-7443, but I am not presupposing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)