Skip to content

Support null events and a slight change of names #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

liorsion
Copy link
Collaborator

this should have been separated into two pull requests but my log became slightly complicated, so unless one is reject and the other accepted, I hope we can just merge the two.

The first change is a naming change: since introducing _V2 events, it just seems more natural to me to have the other named _V1, and not having one set of events called without the version.

The other change is introducing NullEvent class, which is basically a "skip" class of events that are knows but want to be skipped (since the default implementation throws an exception). I ran into two such events when setting up replication with GTID.

To see the exception just add to your master (if it's 5.6+) config file:
log-slave-updates=true
gtid-mode=on
enforce-gtid-consistency=true

Lior Sion added 3 commits May 2, 2013 10:18
according to this post
http://dev.mysql.com/doc/internals/en/row-based-replication.html#rows-event
events are marked as version 0,1,2 (current) - the code had _V1 and no
version at all - I think it would b easier and morefuture compatible to
use V2 since it seems V3 is unavoidable.
Conflicts:
	pymysqlreplication/row_event.py
	pymysqlreplication/tests/test_basic.py
nullevent is an event that can happen in the steam but we want to skip
it.

added two sample events like that: INTVAR_EVENT and GTID_LOG_EVENT -
those are events that happen when we do GTID enabled replication, but
are of no use (at least not for me at this time) in this packages
aspect. It might be when we support moving to a different master
seamlessly.
@@ -99,3 +99,7 @@ def _dump(self):
print("Execution time: %d" % (self.execution_time))
print("Query: %s" % (self.query))

class NullEvent(BinLogEvent):
def __init__(self, from_packet, event_size, table_map, ctl_connection, log_persistancer = None):
super(NullEvent, self).__init__(from_packet, event_size, table_map, ctl_connection, log_persistancer)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this log_persistancer?

@bjoernhaeuser
Copy link
Collaborator

I also want to have every Event covered. But why not just cover them with the right Event-Classes?

@julien-duponchelle
Copy link
Owner

I see two way:

  • we implement an empty class for each event (the actual way)
  • we create a class for not implemented event

I think the second way have an advantage we can add event without read the documentation or MySQL source especially for fork like Twitter MySQL and mark the event as not really implemented. It's avoid confusion in documentation, because not really implemented event will not appear.

But instead of NullEvent i suggest NotImplementedEvent. I suggest also to implement a _dump method in event which display the real type in order to help debug.

@liorsion
Copy link
Collaborator Author

Ok I'm closing this and separating the pull requests to two (#22 and #23) so we can discuss specifically.

@liorsion liorsion closed this May 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants