Skip to content
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

Gab in servicestatus_id due to MySQL behavior #40

Closed
nook24 opened this issue Jul 3, 2017 · 0 comments
Closed

Gab in servicestatus_id due to MySQL behavior #40

nook24 opened this issue Jul 3, 2017 · 0 comments

Comments

@nook24
Copy link
Owner

nook24 commented Jul 3, 2017

MySQL increases the value of auto increment by every single ON DUPLICATE KEY UPDATEor REPLACE query.
Due to this, you can easily hit the auto increment max value.

So, i would recommend to truncate the prefix_hoststatus and prefix_servicestatus tables on every restart of the monitoring core, inside of the FINISH_OBJECT_DUMP event handler...

See: https://www.percona.com/blog/2011/11/29/avoiding-auto-increment-holes-on-innodb-with-insert-ignore/

This is an example of a system with 60 services.
example

Patch

--- cakephp/app/Console/Command/StatusengineLegacyShell.php
+++ cakephp/app/Console/Command/StatusengineLegacyShell.php
@@ -549,9 +549,15 @@ class StatusengineLegacyShell extends AppShell{
                                $this->activateObjects($this->dumpIds);

                                //Remove deprecated status records
-                               CakeLog::info('Delete deprecated status records');
-                               $this->removeDeprecatedHoststatusRecords($this->dumpIds);
-                               $this->removeDeprecatedServicestatusRecords($this->dumpIds);
+                               //Removed due to: https://www.percona.com/blog/2011/11/29/avoiding-auto-increment-holes-on-innodb-with-insert-ignore/
+                               //CakeLog::info('Delete deprecated status records');
+                               //$this->removeDeprecatedHoststatusRecords($this->dumpIds);
+                               //$this->removeDeprecatedServicestatusRecords($this->dumpIds);
+
+                               CakeLog::info('Truncate table hoststatus');
+                               $this->Hoststatus->truncate();
+                               CakeLog::info('Truncate table servicestatus');
+                               $this->Servicestatus->truncate();

                                $this->dumpIds = [];
nook24 added a commit that referenced this issue Jul 12, 2017
@nook24 nook24 closed this as completed Jul 25, 2017
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

No branches or pull requests

1 participant