*

Hi all,


Cassandra server has been modified to support multi-tenancy in Cassandra.
But there’s an issue with how it is achieved. Current implementation is as
follows.

If the tenant domain is abc.com, and a keyspace it creates is test_ks, the
way Cassandra stores it is, abc_com_test_ks.


(Note: Though it stores the keyspace name as

abc_com_test_ks

, the user sees the keyspace name as

test_ks

.)


 When to read a keyspace of a tenant, it can’t split the string by “_”
since it’s there in multiple places in the string. So what current
implementation does is it checks if the current tenant domain (abc_com) is
a prefix of the keyspace name (abc_com_test_ks) only.

This becomes an issue when we have both abc.com and abc.com.lk domains.
According to the way it checks the keyspace name, abc.com tenant can see
abc.com.lk’s keyspaces as well.

There are 2 solutions for this.

1) Cassandra only allows A-Za-z0-9_ characters in keyspace name. We can
alter Cassandra server to accept a new symbol like ‘$’, and use it as a
separator to domain name and keyspace name. Since ‘$’ symbol is allowed in
neither domain name nor keyspace name, we can simply split the string by
‘$’ symbol.

e.g. abc_com$test_ks

2) When creating real keyspaces, use tenant_id instead of tenant domain.

e.g. 1_test_ks

One advantage of approach 2 is we don’t have to introduce any new
characters to Cassandra keyspace name.


With whatever of the above solutions, we will have to migrate current data
(in SLive etc.) to support new implementation. That becomes an issue since
we need to rename all currently used tenant keyspaces, but Cassandra does
not support keyspace renaming. [1]

There is a manual way to do this [2][3], but the practicability of that
method might be a possible concern.

[1] https://issues.apache.org/jira/browse/CASSANDRA-1585

[2]
https://issues.apache.org/jira/browse/CASSANDRA-1585?focusedCommentId=13488959&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13488959

[3]
https://issues.apache.org/jira/browse/CASSANDRA-1585?focusedCommentId=13686621&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13686621


Thanks,
*

-- 
*Bhathiya Jayasekara*
*Software Engineer,*
*WSO2 inc., http://wso2.com*
*
*
*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj*
*Twitter: https://twitter.com/bhathiyax*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to