shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

logicTable of ShardingSphereMetaData don't contain encrypt field in sharding-proxy when testing 'sharding+encrypt'

Open geomonlin opened this issue 6 years ago • 1 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?

dev(5.0)

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

Sharding-Proxy

Expected behavior

tableMetaData contain encrypt field.

Actual behavior

tableMetaData don't contain encrypt field in MetaData.

config:

schemaName: sharding_encrypt

dataSources:
  ds_0:
    url: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
    username: root
    password:
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
  ds_1:
    url: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
    username: root
    password:
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50

shardingRule:
  tables:
    t_user:
      actualDataNodes: ds_${0..1}.t_user_${0..1}
      tableStrategy:
        inline:
          shardingColumn: user_id
          algorithmExpression: t_user_${user_id % 2}
      databaseStrategy:
        inline:
          shardingColumn: user_id
          algorithmExpression: ds_${user_id % 2}
      keyGenerator:
        type: SNOWFLAKE
        column: user_id
  defaultDatabaseStrategy:
    none:
  defaultTableStrategy:
    none:
  encryptRule:
    encryptors:
      encryptor_aes:
        type: aes
        props:
          aes.key.value: 123456abc
      encryptor_md5:
        type: md5
        
    tables:
      t_user:
        columns:
          user_name:
            plainColumn: user_name
            cipherColumn: user_name_cipher
            encryptor: encryptor_md5
          
          pwd:
            plainColumn: pwd_plain
            cipherColumn: pwd_cipher
            encryptor: encryptor_md5

authentication:
 users:
   root:
     password:

props:
 max.connections.size.per.query: 1
 acceptor.size: 32  # The default value is available processors count * 2.
 executor.size: 32  # Infinite by default.
 proxy.frontend.flush.threshold: 128  # The default value is 128.
   # LOCAL: Proxy will run with LOCAL transaction.
   # XA: Proxy will run with XA transaction.
   # BASE: Proxy will run with B.A.S.E transaction.
 proxy.transaction.type: LOCAL
 proxy.opentracing.enabled: false
 #proxy.hint.enabled: true
 query.with.cipher.column: true
 sql.show: true

Reason analyze (If you can)

image

image

geomonlin avatar Jan 16 '20 04:01 geomonlin

encrypt only store logic column in metadata, so actual column need to be converted to logic column using EncryptMetaData, we should resolve it in #3922

cherrylzhao avatar Jan 16 '20 08:01 cherrylzhao