Bug #81870 Fabric connectivity error on creation of shard definition
Submitted: 15 Jun 2016 21:26 Modified: 19 Oct 2016 5:08
Reporter: DINESH DHANABALAN Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Fabric: Sharding Severity:S1 (Critical)
Version:6.3.6 OS:Windows (Microsoft Windows Server 2012 R2 Standard)
Assigned to: Assigned Account CPU Architecture:Any
Tags: WBBugReporter

[15 Jun 2016 21:26] DINESH DHANABALAN
Description:
Fabric connectivity stops working with the following error after a shard is created in the cluster. Starts working again if the shard definition is removed.

MySql.Fabric.MySqlFabricException was unhandled
  HResult=-2146233088
  Message=Unable to connect to Fabric server.
  Source=MySql.Fabric.Plugin
  StackTrace:
       at MySql.Fabric.FabricServerGroup.GetServerList()
       at MySql.Fabric.FabricServerGroup.GetServer(Boolean isMaster, MySqlConnectionStringBuilder settings)
       at MySql.Data.MySqlClient.Replication.ReplicationManager.GetNewConnection(String groupName, Boolean master, MySqlConnection connection)
       at MySql.Data.MySqlClient.MySqlConnection.Open()
       at FabricTest.Program.RunFabricTest() in c:\users\dhanabdi\documents\visual studio 2015\Projects\Shard_test1\Shard_test1\Program.cs:line 97
       at FabricTest.Program.Main(String[] args) in c:\users\dhanabdi\documents\visual studio 2015\Projects\Shard_test1\Shard_test1\Program.cs:line 28
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
       HResult=-2147024809
       Message=An item with the same key has already been added.
       Source=mscorlib
       StackTrace:
            at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
            at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
            at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
            at MySql.Fabric.FabricServerGroup.GetShards()
            at MySql.Fabric.FabricServerGroup.GetServerList()
       InnerException:

How to repeat:
I created a cluster of 3 groups of servers ( 2 servers each) for a total of 6 servers  plus a dedicated server for Fabric. Got 1 global group and 2 high availability groups configured with the GTID replication.

Next try a console application as explained in the example 
https://dev.mysql.com/doc/connector-net/en/connector-net-programming-fabric.html

I am using mysql connector net 6.9.8 version.
MySQL fabric 1.5

Run the example as in the link from visual studio(15) and ensure it works fine.

Now add a shard definition from the command line using the following command.

>mysqlfabric sharding create_definition HASH ha_global
where ha_global is the name of my global group. 

Now try the console application again and the error occurs!

Suggested fix:
When I look at netstat -a -b when the connection errors I see a valid connection at port 32275 like it should be. SO, looks like it is an error that is happening after the connection is established due to some steps happening after that and before a success message is sent out.
[16 Sep 2016 11:42] Chiranjeevi Battula
Hello  DINESH,

Thank you for the bug report.
I could not repeat the issue at our end using with Visual Studio 2015, Connector/NET 6.9.9 and MySQL 5.7.14 version.
Could you please provide repeatable test case (exact steps/sample project, screenshot, database etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[16 Sep 2016 20:29] DINESH DHANABALAN
Thanks for your response. I see my MySQL version, .net and fabric details are different from yours. Let me try to match up my set up to yours and see if this is still an issue. Will get back to you soon.
[20 Oct 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".