Skip to content

Gab in servicestatus_id due to MySQL behavior #40

Closed

Description

@nook24

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 = [];

Activity

  1. added a commit that references this issue on Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions