The current flashback code has the following logic embedded into print_row_event
The caller of print_row_event(ev) has the following logic:
This logic introduces side effects in print_row_event and also makes the flashback logic highly coupled to the printing logic. A better approach would be:
- If flashback is enabled, instead of printing events, store them in an array.
- When event_stmt_end is encountered, print out the contents of the array in reverse using print_row_event.
- Finally clean up all events.