You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "FlyingZC (via GitHub)" <gi...@apache.org> on 2023/02/02 08:19:20 UTC

[GitHub] [shardingsphere] FlyingZC opened a new issue, #23929: Drop index fails when create index does not specify an index name

FlyingZC opened a new issue, #23929:
URL: https://github.com/apache/shardingsphere/issues/23929

   ## Bug Report
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore 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?
   master.
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   proxy.
   
   ### Expected behavior
   Drop index successfully when create index does not specify an index name
   
   ### Actual behavior
   Drop index failed.
   
   ### Reason analyze (If you can)
   Maybe the index rewrite does not handle the case without index name.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   ```sql
   -- 1.create index without index name
   alter table t_order add index(order_id);
   
   -- 2.show create table t_order;
   
   | t_order | CREATE TABLE `t_order` (
     `order_id` int(11) NOT NULL,
     `user_id` int(11) NOT NULL,
     `status` varchar(45) DEFAULT NULL,
     KEY `order_id` (`order_id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=latin1
   
   -- 3.drop index with index name `order_id`
   alter table t_order drop index order_id;
   ERROR 1091 (42000): Can't DROP 'order_id_t_order_0'; check that column/key exists
   ```
   
   proxy config
   ```yaml
   databaseName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
       username: root
       password: x
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_1:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
       username: root
       password: x
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
     - !SHARDING
       tables:
         t_order:
           actualDataNodes: ds_${0..1}.t_order_${0..1}
           tableStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: t_order_inline
           keyGenerateStrategy:
             column: order_id
             keyGeneratorName: snowflake
         t_order_item:
           actualDataNodes: ds_${0..1}.t_order_item_${0..1}
           tableStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: t_order_item_inline
           keyGenerateStrategy:
             column: order_item_id
             keyGeneratorName: snowflake
       bindingTables:
         - t_order,t_order_item
       defaultDatabaseStrategy:
         standard:
           shardingColumn: user_id
           shardingAlgorithmName: database_inline
       defaultTableStrategy:
         none:
       
       shardingAlgorithms:
         database_inline:
           type: INLINE
           props:
             algorithm-expression: ds_${user_id % 2}
         database_id_inline:
           type: INLINE
           props:
             algorithm-expression: ds_${id % 2}
         t_order_inline:
           type: INLINE
           props:
             algorithm-expression: t_order_${order_id % 2}
         t_order_item_inline:
           type: INLINE
           props:
             algorithm-expression: t_order_item_${order_id % 2}
       
       keyGenerators:
         snowflake:
           type: SNOWFLAKE
   
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] FlyingZC commented on issue #23929: Drop index fails when create index does not specify an index name

Posted by "FlyingZC (via GitHub)" <gi...@apache.org>.
FlyingZC commented on issue #23929:
URL: https://github.com/apache/shardingsphere/issues/23929#issuecomment-1413322925

   I want to investigate it, please assign me. @strongduanmu 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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