{"action":"created","issue":{"url":"https://api.github.com/repos/cantino/huginn/issues/1940","repository_url":"https://api.github.com/repos/cantino/huginn","labels_url":"https://api.github.com/repos/cantino/huginn/issues/1940/labels{/name}","comments_url":"https://api.github.com/repos/cantino/huginn/issues/1940/comments","events_url":"https://api.github.com/repos/cantino/huginn/issues/1940/events","html_url":"https://github.com/cantino/huginn/issues/1940","id":215127222,"number":1940,"title":"If Event table is empty during a MySQL restart, auto_increment is reset and Huginn stops working","user":{"login":"jplitza","id":3628012,"avatar_url":"https://avatars0.githubusercontent.com/u/3628012?v=3","gravatar_id":"","url":"https://api.github.com/users/jplitza","html_url":"https://github.com/jplitza","followers_url":"https://api.github.com/users/jplitza/followers","following_url":"https://api.github.com/users/jplitza/following{/other_user}","gists_url":"https://api.github.com/users/jplitza/gists{/gist_id}","starred_url":"https://api.github.com/users/jplitza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jplitza/subscriptions","organizations_url":"https://api.github.com/users/jplitza/orgs","repos_url":"https://api.github.com/users/jplitza/repos","events_url":"https://api.github.com/users/jplitza/events{/privacy}","received_events_url":"https://api.github.com/users/jplitza/received_events","type":"User","site_admin":false},"labels":[{"id":207109679,"url":"https://api.github.com/repos/cantino/huginn/labels/bug","name":"bug","color":"fc2929","default":true},{"id":80701647,"url":"https://api.github.com/repos/cantino/huginn/labels/help-wanted","name":"help-wanted","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2017-03-17T21:30:11Z","updated_at":"2017-04-19T16:17:12Z","closed_at":null,"body":"## Problem\r\nOn a very low-volume instance, at some point, events simply stop to be processed. They are generated, but not propagated along links, even if the links are re-created.\r\n\r\n## Cause\r\nLinks and Agents store which event ID they last processed. On a low-volume instance with events being deleted after some time, it may happen that the events table becomes empty. If the MySQL server is then restarted and the table uses InnoDB (the default?), [the auto_increment column starts at 1 again](https://dev.mysql.com/doc/refman/5.7/en/innodb-auto-increment-handling.html#innodb-auto-increment-initialization). Thus, many events that are subsequently created are ignored by links and agents because they think they already processed them. Only if enough events are generated (before the table is empty and the server is restarted again), they will be noticed again.\r\n\r\n## Solutions\r\n* Never delete the event with the highest ID\r\n* Put a warning next to the field where you choose the retention period\r\n* Avoid/discourage the use of InnoDB for the events table\r\n"},"comment":{"url":"https://api.github.com/repos/cantino/huginn/issues/comments/295329161","html_url":"https://github.com/cantino/huginn/issues/1940#issuecomment-295329161","issue_url":"https://api.github.com/repos/cantino/huginn/issues/1940","id":295329161,"user":{"login":"jplitza","id":3628012,"avatar_url":"https://avatars0.githubusercontent.com/u/3628012?v=3","gravatar_id":"","url":"https://api.github.com/users/jplitza","html_url":"https://github.com/jplitza","followers_url":"https://api.github.com/users/jplitza/followers","following_url":"https://api.github.com/users/jplitza/following{/other_user}","gists_url":"https://api.github.com/users/jplitza/gists{/gist_id}","starred_url":"https://api.github.com/users/jplitza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jplitza/subscriptions","organizations_url":"https://api.github.com/users/jplitza/orgs","repos_url":"https://api.github.com/users/jplitza/repos","events_url":"https://api.github.com/users/jplitza/events{/privacy}","received_events_url":"https://api.github.com/users/jplitza/received_events","type":"User","site_admin":false},"created_at":"2017-04-19T16:17:12Z","updated_at":"2017-04-19T16:17:12Z","body":"I think the correct thing would be the `reset_agents_if_empty` approach, but setting the `last_checked_event_id` to `maximum(:id)`. Right?"}}
{"actor":{"display_login":"jplitza"}}