Hi, I've improved the functionality here, in order to write to tenant tables also using the super tenant space. With this, I've changed the earlier flag's name to "globalTenantAccess". So with this, if you define a table with this flag enabled, when you write records to it, by looking at the incoming record's "_tenantId" field value, it will route the record to it's respective tenant's tables. Now with both read and write functionality, we can seamlessly read the data from each tenant and write the results to that tenant itself, using a script residing in the super tenant.
An example on how this work is shown below:- * Create several tenant's, create a stream called "S1" in each, and add some records to each * Execute the following the super tenant:- create temporary table S1 using CarbonAnalytics options (tableName "S1", schema "name STRING, count INTEGER, _tenantId INTEGER", globalTenantAccess "true"); Reading from this "S1" table, e.g. "select * from S1" will show all the records from all the tenants. Now, create another table "S2" in super tenant space with globalTenantAccess flag:- create temporary table S2 using CarbonAnalytics options (tableName "S2", schema "name STRING, count INTEGER, _tenantId INTEGER", globalTenantAccess "true"); Now we run the command "insert into table S2 select * from S1". The above command will make the system create table S2 in all the tenants that are available (basically tenants mentioned in the data from S1's _tenantId field), and write the data to it. At the end, each tenant will have a two tables, "S1" and "S2" with identical data. This basically explains how the full data set is collected together, and how the same data, tenant wise can be written back. Cheers, Anjana. On Mon, Apr 18, 2016 at 4:55 AM, Anjana Fernando <[email protected]> wrote: > Hi Chan, > > On Mon, Apr 18, 2016 at 4:47 AM, Dulitha Wijewantha <[email protected]> > wrote: > >> >> There is a new analytics provider property introduced, which is >>> "globalTenantRead", where when this is set to "true", it will go through >>> all the tenants in aggregating records of a table named "T1" in that >>> tenant. Also a new special table schema attribute "_tenantId" is >>> introduced, which is an automatically populated value for a record based on >>> the actual origin tenant of the record. So this "_tenantId" field can be >>> used for further filtering/grouping in the Spark queries. >>> >> >> So the tenant id of the event is persisted on the record store when >> events are recieved to DAS. Does this happen through the authorization? In >> case of thrift the login username has to be prefixed with the tenant >> domain? >> > > So DAS anyway had proper tenant isolation already. And yes, it is handled > with the authorization (so yeah, the username has to have the domain also > for tenants). Where, when we are storing events, a tenant has its own space > in our data layer, and now it is just retrieving data, we just specially > expose whose tenant the record belongs to in the result, since the results > can have data from multiple tenants. > > >> >> >> Does this impact indexes that have been setup? >> > > No it does not, it does not affect the existing indexes nor the raw data > stored. > > Cheers, > Anjana. > > >> >> >>> >>> [1] https://docs.wso2.com/pages/viewpage.action?pageId=50505847 >>> [2] https://docs.wso2.com/pages/viewpage.action?pageId=50505762 >>> [3] >>> https://docs.wso2.com/display/DAS310/Spark+Query+Language#SparkQueryLanguage-WSO2DASSQLguide >>> >>> Cheers, >>> Anjana. >>> -- >>> *Anjana Fernando* >>> Senior Technical Lead >>> WSO2 Inc. | http://wso2.com >>> lean . enterprise . middleware >>> >>> _______________________________________________ >>> Architecture mailing list >>> [email protected] >>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>> >>> >> >> >> -- >> Dulitha Wijewantha (Chan) >> Software Engineer - Mobile Development >> WSO2 Inc >> Lean.Enterprise.Middleware >> * ~Email [email protected] <[email protected]>* >> * ~Mobile +94712112165 <%2B94712112165>* >> * ~Website dulitha.me <http://dulitha.me>* >> * ~Twitter @dulitharw <https://twitter.com/dulitharw>* >> *~Github @dulichan <https://github.com/dulichan>* >> *~SO @chan <http://stackoverflow.com/users/813471/chan>* >> >> _______________________________________________ >> Architecture mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >> >> > > > -- > *Anjana Fernando* > Senior Technical Lead > WSO2 Inc. | http://wso2.com > lean . enterprise . middleware > -- *Anjana Fernando* Senior Technical Lead WSO2 Inc. | http://wso2.com lean . enterprise . middleware
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
