shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Sharding-Proxy starts up failed with Orchestration in scenario `sharding+encrypt+masterSlave`.

Open haetao opened this issue 6 years ago • 0 comments

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

4.0.0-rc4

Which project did you use? Sharding-JDBC or Sharding-Proxy?

sharding-proxy

Expected behavior

proxy starts up well!

Actual behavior

proxy starts up failed!

Reason analyze (If you can)

Sharding-Proxy gets the configuration from Configuration Center when it is initlizating. It recognizes these RuleConfiguration by key words. But there is a problem, for example:

The sharding+encrypt rule configuration in Configuration Center as follows, Proxy recognizes these RuleConfigurations by key words (tables:\n-->shardingRule, encryptors:\n-->encryptRule ). We can see that there is a key word 'tables:' exists in shardingRule and encryptRule at the same time. So, we can't identify shardingRule by using key word tables:, it can use encryptRule as shardingRule or use shardingRule as encryptRule in complex scenario.( for example sharding+encrypt,Proxy can use shardingRule as encryptRule )

sharding+encrypt rule configuration

encryptRule:
  encryptors:
    encryptor_aes:
      props:
        aes.key.value: 123456abc
      type: aes
  tables:
    t_user:
      columns:
        user_name:
          cipherColumn: assisted_query_pwd
          encryptor: encryptor_aes
          plainColumn: user_name_plain
tables:
  t_user:
    actualDataNodes: ds_${0..1}.t_user_${0..1}
    databaseStrategy:
      inline:
        algorithmExpression: ds_${user_id % 2}
        shardingColumn: user_id
    keyGenerator:
      column: user_id
      type: SNOWFLAKE
    logicTable: t_user
    tableStrategy:
      inline:
        algorithmExpression: t_user_${user_id % 2}
        shardingColumn: user_id

method getSchemaRules

image

method isShardingRule , isEncryptRule

image

haetao avatar Dec 27 '19 03:12 haetao