Bug #82245 FabricMySQLConnectionProxy.setShardTable("schema.table") does not work
Submitted: 15 Jul 2016 12:33 Modified: 18 Jul 2016 13:00
Reporter: Cosmin Mutu Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.39 OS:Any
Assigned to: CPU Architecture:Any
Tags: connectorj, FabricMySQLConnectionProxy, setShardTable

[15 Jul 2016 12:33] Cosmin Mutu
Description:
com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.setShardTable does not work as expected if called with an input containing both schema and table "schema.table"

More to the point, the issue is that after the split, the values are assigned as inversed as they should be : 

...
// lookup shard mapping
String table = shardTable;
String db = this.database;
if (shardTable.contains(".")) {
  String pair[] = shardTable.split("\\.");    // ---> "schema.table"
  db = pair[1];                               // ---> "schema"
  table = pair[0];                            // ---> "table"
}
...

How to repeat:
just make a connection.setShardTable("schema.table") before making any DML (insert / read / delete).

Suggested fix:
Inverse the indexes ... db should be on 0 and table on 1

String pair[] = shardTable.split("\\.");
db = pair[0];
table = pair[1];
[18 Jul 2016 13:00] Chiranjeevi Battula
Hello  Cosmin Mutu,

Thank you for the bug report.
This is most likely duplicate of Bug #81108, please see Bug #81108.

Thanks,
Chiranjeevi.