-
Notifications
You must be signed in to change notification settings - Fork 2
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
Ensure that we handle "on_row_event" before "on_save_position" #5
Comments
on_row_event
before on_save_event
So whatever order the Java for-loop does it in is what we'll end up with I guess? |
It's a LinkedList and I found this: http://stackoverflow.com/a/4767638 so I guess that we should add the |
describe "#on_row_event, #on_save_position" do
context "when a row is inserted" do
let(:actual_event_order) do
event_order = []
subject.on_row_event { |_| event_order << :on_row_event }
subject.on_save_position { |_, _| event_order << :on_save_position }
subject.start_in_thread
DatabaseHelper.insert(table_name, mysql_row)
sleep 0.1 while event_order.count < 4
event_order
end
let(:expected_event_order) { [ :on_row_event, :on_save_position ] }
it "should receive the events in correct order" do
expect(actual_event_order).to eq(expected_event_order)
end
end
end
|
From your test and from the LinkedList knowledge we now have attained I am certain we should register our |
Looks like mysql adds I added a logger to sequel and added a event listener which just prints each event. #on_row_event, #on_save_position
when a row is inserted
I, [2015-11-19T10:52:25.240000 #60842] INFO -- : (0.001000s) DROP TABLE IF EXISTS `ecco_test_table`
I, [2015-11-19T10:52:25.245000 #60842] INFO -- : (0.003000s) CREATE TABLE `ecco_test_table` (`id` integer PRIMARY KEY AUTO_INCREMENT, `column1` varchar(255))
RotateEventData{binlogFilename='mysql-bin.000150', binlogPosition=8107}
-------------
FormatDescriptionEventData{binlogVersion=4, serverVersion='5.5.46-0ubuntu0.14.04.2-log', headerLength=19}
-------------
QueryEventData{threadId=26379, executionTime=0, errorCode=0, database='ecco_test', sql='BEGIN'}
-------------
TableMapEventData{tableId=619, database='ecco_test', table='ecco_test_table', columnTypes=3, 15, columnMetadata=0, 255, columnNullability={1}}
-------------
I, [2015-11-19T10:52:25.257000 #60842] INFO -- : (0.002000s) INSERT INTO `ecco_test_table` (`column1`) VALUES ('a value')
WriteRowsEventData{tableId=619, includedColumns={0, 1}, rows=[
[1, a value]
]}
-------------
XidEventData{xid=57621}
-------------
[:on_save_position, :on_save_position, :on_row_event, :on_save_position]
I, [2015-11-19T10:52:25.262000 #60842] INFO -- : (0.002000s) DROP TABLE `ecco_test_table`
should receive the save event after the row event |
Commented out the This could be a clue :) |
Row events should be received before save events. close #5
The client always emits an initial save_position event when it starts. Related to #5
I think we do now, but we need tests to confirm it and ensure that we don't break it in the future.
The text was updated successfully, but these errors were encountered: