[icinga-checkins] icinga.org: icingaweb2-module-director/master: schema: shorten history large deployment logs...

git at icinga.org git at icinga.org
Tue Jul 26 13:51:26 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: eab8b5c9babf6384c212f52eef0c8236411ea9af
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=eab8b5c9babf6384c212f52eef0c8236411ea9af

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jul 26 13:50:42 2016 +0200

schema: shorten history large deployment logs...

...and free related disk space

---

 schema/mysql-migrations/upgrade_102.sql |   13 +++++++++++++
 schema/mysql.sql                        |    2 +-
 schema/pgsql-migrations/upgrade_102.sql |   13 +++++++++++++
 schema/pgsql.sql                        |    2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/schema/mysql-migrations/upgrade_102.sql b/schema/mysql-migrations/upgrade_102.sql
new file mode 100644
index 0000000..5607f1e
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_102.sql
@@ -0,0 +1,13 @@
+UPDATE director_deployment_log SET startup_log = LEFT(startup_log, 20480) || '
+
+[..] shortened '
+|| (LENGTH(startup_log) - 40960)
+|| ' bytes by Director on schema upgrade [..]
+
+' || RIGHT(startup_log, 20480) WHERE LENGTH(startup_log) > 61440;
+
+OPTIMIZE TABLE director_deployment_log;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (102, NOW());
diff --git a/schema/mysql.sql b/schema/mysql.sql
index bfdd1a8..c8427da 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -1312,4 +1312,4 @@ CREATE TABLE sync_run (
 
 INSERT INTO director_schema_migration
   SET migration_time = NOW(),
-      schema_version = 100;
+      schema_version = 102;
diff --git a/schema/pgsql-migrations/upgrade_102.sql b/schema/pgsql-migrations/upgrade_102.sql
new file mode 100644
index 0000000..4805d8a
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_102.sql
@@ -0,0 +1,13 @@
+UPDATE director_deployment_log SET startup_log = LEFT(startup_log, 20480) || '
+
+[..] shortened '
+|| (LENGTH(startup_log) - 40960)
+|| ' bytes by Director on schema upgrade [..]
+
+' || RIGHT(startup_log, 20480) WHERE LENGTH(startup_log) > 61440;
+
+VACUUM FULL director_deployment_log;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (102, NOW());
diff --git a/schema/pgsql.sql b/schema/pgsql.sql
index dab834b..41ff5fc 100644
--- a/schema/pgsql.sql
+++ b/schema/pgsql.sql
@@ -1532,4 +1532,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (100, NOW());
+  VALUES (102, NOW());



More information about the icinga-checkins mailing list