• Dmitry Shulga's avatar
    Fixed bug#12546938 (formerly known as 61005) - CREATE IF NOT EXIST EVENT · 56a735b7
    Dmitry Shulga authored
    will create multiple running events.
    
    A CREATE IF NOT EXIST on an event that existed and was enabled caused
    multiple instances of the event to run. Disabling the event didn't  help.
    If the event was  dropped, the event stopped running, but when created
    again, multiple instances of the event were still running. The only way
    to get out of this situation was  to restart the server.
    
    The problem was that Event_db_repository::create_event() didn't return
    enough information to discriminate between situation when event didn't
    exist and was created and when event did exist and was not created
    (but a warning was emitted). As result in the latter case event
    was added to in-memory queue of events second time. And this led to
    unwarranted multiple executions of the same event.
    
    The solution is to add out-parameter to Event_db_repository::create_event()
    method which will signal that event was not created because it already
    exists and so it should not be added to the in-memory queue.
    
    
    mysql-test/r/events_bugs.result:
      Added results for test for Bug#12546938.
    mysql-test/t/events_bugs.test:
      Added test for Bug#12546938.
    sql/event_db_repository.cc:
      Event_db_repository::create_event was modified: set newly added out-parameter
      event_already_exists to true value if event wasn't created because event
      already existed and IF NOT EXIST clause was present.
    sql/event_db_repository.h:
      Added out-parameter 'event_already_exists' to create_event() method.
    sql/events.cc:
      Events::create_event was modified: insert new element into
      event queue only if event was actually created.
    56a735b7
events_bugs.result 36.1 KB