On Tuesday, May 7, 2013 at 12:52 , Kristian Nielsen wrote:
Giuseppe Maxia <g.maxia@gmail.com> writes:Thanks for the docs. It's a very good start. Compared to MySQL 5.6, GTID in MariaDB has some advantages: it is enabled by default and it is easy to read.There are a few items, though, that should need some more thought:1) rpl_slave_state is probably ill-named. In this architecture, it is onlyYeah, I agree. Let's find a better name.What about: mysql.rpl_gtid_state?Or maybe: mysql.gtid_pos. This matches the similar @@GLOBAL.gtid_posvariable. Though the table is not a simple position, it has a more complexstructure.Opinions?written by the slaves, and thus the name matches, but I wonder if the mastershould write this table (or a similar one) to keep track of its progress inRight. Actually, I've carefully avoided writing the table on the master, toavoid introducing extra overhead.the binary log. Rationale: all the info related to replication should be intables and easy to query.That's one valid viewpoint. Unfortunately this is not really supported in thedesign. I mean, you can query the table if you want, but there is notguaranteed to be an easy way to map the results to the actual internalstate. Similarly, updating the table is not guaranteed to be reflected in theinternal in-memory state. This is all to reduce overhead.2) rpl_slave_state does not have enough metadata. What is missing here, andwould be extremely useful, is the corresponding binlog+position for eachGTID, a timestamp of when the transaction was saved to the binary log, andthe timestamp of when it was applied. (The host name of the origin wouldRight. I had this thought myself that I should maybe put more stuff inthere, it is good to get your suggestion, based on more experience with actualusage.I think most of this info is already available. Though timestamps might beworth it to log into Gtid with better than whole second precision? And notsure about the host name (but we do have server_id, of course).I will think about this. At least, this should be easy to add later, but itwould be good to have as much as possible in the first release.also be useful). Also very important (when you will implement parallelreplication) is a shard identifier.Actually, the domain_id is the shard identifier. This is a core part of thedesing, though actual implementation will be for later.3) Multiple domains do not integrate well with GTID. In multi-sourcereplication, we use "connection names", but for GTID we use "domainnumbers". They do not play well together : there is no correspondencebetween the gtid_domain_id and the connection name, and a "SHOW ALL SLAVESSTATUS" lists all the GTID for every connection. For example:Right. I understand your point of course, it would be natural to expect domainid to be equivalent somehow to multi-source connection name.Unfortunately, that is not how things work. There is no simple translationbetween multi-source connection name and domain id.For example, consider a topology like A->C, B->C, C->E, D->E. Here, lets say Ahas domain id 1, B has 2, and D has 3. There is no single domain_id for theconnection from E to C.Or a ring topology: A->B->C->A. Here, there will be three domains, but thereis only a single connection.And later, we will do parallel replication, where a single master will usemultiple different domain_ids (basically one for each shard I suppose).On the other hand, normally a given domain_id should only be received on asingle of multi-source connections. It sounds like a good idea to be able tospecify a list of valid domains for each multi-source connection. Then thecode could also check for violations and stop replication with an error ifsuch violation happens. I will think about adding this.Connection_name: DeerMaster_Host: 127.0.0.1Master_Port: 8206Master_Log_File: mysql-bin.000001Read_Master_Log_Pos: 1144Relay_Master_Log_File: mysql-bin.000001Slave_IO_Running: YesSlave_SQL_Running: YesExec_Master_Log_Pos: 1144Gtid_Pos: 100-101-21,400-104-23,200-102-8,300-103-12,500-105-20Which connection is running which gtid number? Not easy to tell, as the correspondence between domain and connections is only in the DBA's head.Well, there is a single global Gtid_pos, it is shared by all connections.I do not see how this can be different? For example, Suppose we have A->C,B->C, C->D. If C goes away, we will want to switch to A->D, B->D. But theGtid_pos should not change while doing this switch.Hm, I will admit I did not before think much about a tighter connectionbetween GTID position and individual slave connections. I have just consideredthe GTID state as associated with the data actually in the tables, not withany specific configuration ...4) gtid_pos is text that includes all sequences from all domains. The docs say that I can modify it if needed, but in a case like the one above, modifying this string can be very error prone. For example, if server_ids are assigned using inet_aton(@IP), you could have a gtid_pos like this'1001-170062692-230000,1002-170062593-12893445,1003-170062700-672009,1003-170062699-700002'Instead of editing a string, and risk breaking replication in all domains, I would expect the availability of commands like:CHANGE GTID for domain 'Wolf' set gtid_pos=1900Right, I agree. On the other hand, if one is doing scripting to e.g. set up anew slave automatically, it is much easier to be able to pass around a singlestring of Gtid position, rather than having to contruct complicated SQLexpressions to add some, change others, and remove any extra.So that is why I chose the simple approach with a single string for the firstversion.Your comments made me realise that much of the current design is based towardshow I prefer to use databases - where "everything in the dba's/developer'shead" (or better the source revision control system) is a good thing. Butthere is also a need to support a more database-centric approach, where theonly source of configuration and metadata is the current state of theDB. Hopefully more of this other approach can be added and extended as we goalong.That's it for now. Hope there is still room for improvements.Yes. Thanks a lot Giuseppe for taking the time to review this and provide youropinions.- Kristian.