You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/02/26 03:46:45 UTC

[GitHub] [shardingsphere] terrymanu opened a new issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

terrymanu opened a new issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510


   ```sql
   SELECT t_account.* FROM t_account_bak where account_id=?
   ```
   
   should rewrite to 
   
   ```sql
   SELECT t_account_0.col1, t_account_0.col2, t_account_0.col_n FROM t_account_bak where account_id=?
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-817283554


   Hi,this is my ideas.
   
   **Background**
   
   1. we assume the sql like:  `create table user(id,user_name,password)`
     and the query Logic SQL : ` select * from user`
   2. feature-encrypt rewrite engine : Scan all of the table columns to find the encrypt column from logic SQL, and generate the column token. just like `user.id,user.user_name,user.password`
   3. feature-sharding rewrite engine for sharding table: Scan all of the table name to find rewrite table name from logic SQL,and generate all of the Table token.
   
   **Present situation**
   feature-encrypt generate column token contain the `owner ` information and then it's `owner` name equals the `logic table` name, but the `owner ` doesn’t dependents on table sharding route unit,so the sql can not rewrite corrently,just like `select user.id,user.user_name,user.password from user_0`
   
   ![image](https://user-images.githubusercontent.com/34728144/114300085-20061f00-9af1-11eb-8fce-31ba08550169.png)
   
   **Current Solutions**
   
   1. Defind new structure `OwnerToken` to save the column’s owner
   2. Defind new structure `CombinationalSQLToken` to save the collection of `SQLToken`.
   3. The encrypt rewrite engine generate `OwnerToken ` and  `ColumnToken ` at the same time, keep them in their generation order and save to `CombinationalSQLToken ` .
   
   ![image](https://user-images.githubusercontent.com/34728144/114300279-074a3900-9af2-11eb-8b3e-0e1242a4f62a.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-803983277


   @huanghao495430759 Sorry, the pr #9749 is conflict with commit `https://github.com/apache/shardingsphere/commit/7686bdee9733db2d2854efc28c0e9539f9250ff0` after I merged.
   I just revert the pr.
   Could re-submit the PR again?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-817323421


   We need to consider about how to remove duplicate token with same `start index`.
   How about replace the token if there are same `start index`? 
   The TableTokenGenerator is generic SQLTokenGenerator, the EncrtyptXXXTokenGenerator is specific one. 
   It is make sense for the replace generic SQLTokenGenerator to specific one.
   
   We just need to make sure the generic one always load before specific one, and let the specific SQLTokenGenerator replace previous token if same start index when adding new SQL Token.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-804066798


   > @huanghao495430759 Sorry, the pr #9749 is conflict with commit `https://github.com/apache/shardingsphere/commit/7686bdee9733db2d2854efc28c0e9539f9250ff0` after I merged.
   > I just revert the pr.
   > Could re-submit the PR again?
   
   Yes,I will resolve it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 edited a comment on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 edited a comment on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-817283554


   Hi,this is my ideas.
   
   **Background**
   
   1. we assume the sql like:  `create table user(id,user_name,password)`
     and the query Logic SQL : ` select * from user`
   2. feature-encrypt rewrite engine : Scan all of the table columns to find the encrypt column from logic SQL, and generate the column token. just like `user.id,user.user_name,user.password`
   3. feature-sharding rewrite engine for sharding table: Scan all of the table name to find rewrite table name from logic SQL,and generate all of the Table token.
   
   **Present situation**
   feature-encrypt generate column token contain the `owner ` information and then it's `owner` name equals the `logic table` name, but the `owner ` doesn’t dependents on table sharding route unit,so the sql can not rewrite corrently,just like `select user.id,user.user_name,user.password from user_0`
   
   ![image](https://user-images.githubusercontent.com/34728144/114300085-20061f00-9af1-11eb-8fce-31ba08550169.png)
   
   **Current Solutions**
   
   1. Defind new structure `OwnerToken` to save the column’s owner, and `OwnerToken` implements `RouteUnitAware` .
   2. Defind new structure `CombinationalSQLToken` to save the collection of `SQLToken`. 
   3. The encrypt rewrite engine generate `OwnerToken ` and  `SubstitutableColumnNameToken` at the same time, keep them in their generation order and save to `CombinationalSQLToken ` .
   
   ![image](https://user-images.githubusercontent.com/34728144/114300279-074a3900-9af2-11eb-8b3e-0e1242a4f62a.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-795516728


   I want to try it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu closed issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-805474067


   > @huanghao495430759 Sorry, the pr #9749 is conflict with commit `https://github.com/apache/shardingsphere/commit/7686bdee9733db2d2854efc28c0e9539f9250ff0` after I merged.
   > I just revert the pr.
   > Could re-submit the PR again?
   
   I had re-submit a new PR at [https://github.com/apache/shardingsphere/pull/9787](url)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] huanghao495430759 commented on issue #9510: Can not rewrite owner table name of projection if using sharding and encrypt together

Posted by GitBox <gi...@apache.org>.
huanghao495430759 commented on issue #9510:
URL: https://github.com/apache/shardingsphere/issues/9510#issuecomment-797450810


   I think we can refactor SubstitutableColumnNameToken to implement  RouteUnitAware.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org