diff --git a/notifier/feedback.rb b/notifier/feedback.rb
index b3771f7256bcbc1b6cd0ab5d82911a01e265ca82..c80c94e4470d8283c7ac39d7878d367f43729818 100644
--- a/notifier/feedback.rb
+++ b/notifier/feedback.rb
@@ -106,6 +106,13 @@ class Feedback
sign + size_change
end
+ def conditional_size_change_note(migration)
+ return unless migration.total_database_size_change == 8192
+
+ " [[note](https://docs.gitlab.com/ee/development/" \
+ "database/database_migration_pipeline.html#database-size-increase)]"
+ end
+
def success(migration)
return UNKNOWN if migration.success.nil?
return ':boom:' unless migration.success?
diff --git a/notifier/spec/fixtures/migration-testing/v4/ci/up/MigrationThrowsException/migration-stats.json b/notifier/spec/fixtures/migration-testing/v4/ci/up/MigrationThrowsException/migration-stats.json
index 46d337a7a09daa4b4e9ea2d8d2bef5ef02aff746..95c8e2f295d45b86df3ee7f41df69f50d93f9a49 100644
--- a/notifier/spec/fixtures/migration-testing/v4/ci/up/MigrationThrowsException/migration-stats.json
+++ b/notifier/spec/fixtures/migration-testing/v4/ci/up/MigrationThrowsException/migration-stats.json
@@ -1 +1 @@
-{"version":20990604233157,"name":"MigrationThrowsException","walltime":1.0531382337212563,"success":false,"total_database_size_change":0,"query_statistics":[{"query":"select pg_database_size(current_database()) /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/observers/total_database_size_change.rb:25:in `get_total_database_size'*/","calls":1,"total_time":149.639878,"max_time":149.639878,"mean_time":149.639878,"rows":1},{"query":"SELECT \"schema_migrations\".\"version\" FROM \"schema_migrations\" ORDER BY \"schema_migrations\".\"version\" ASC /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":2.7582169999999997,"max_time":2.7582169999999997,"mean_time":2.7582169999999997,"rows":5392},{"query":"select pg_stat_statements_reset() /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/observers/query_statistics.rb:16:in `before'*/","calls":1,"total_time":0.180636,"max_time":0.180636,"mean_time":0.180636,"rows":1},{"query":"SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = ANY (current_schemas($1)) AND c.relname = $2 AND c.relkind IN ($3,$4)","calls":3,"total_time":0.106823,"max_time":0.044187000000000004,"mean_time":0.03560766666666667,"rows":3},{"query":"SELECT t.oid, t.typname\nFROM pg_type as t\nWHERE t.typname IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.074475,"max_time":0.074475,"mean_time":0.074475,"rows":10},{"query":"SET SESSION timezone TO 'UTC' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.04106,"max_time":0.04106,"mean_time":0.04106,"rows":0},{"query":"SELECT $1 FROM pg_proc WHERE proname = $2 /*application:test,db_config_name:ci,line:/lib/gitlab/database/schema_helpers.rb:20:in `function_exists?'*/","calls":1,"total_time":0.040091,"max_time":0.040091,"mean_time":0.040091,"rows":1},{"query":"SET standard_conforming_strings = on /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.03729,"max_time":0.03729,"mean_time":0.03729,"rows":0},{"query":"SET intervalstyle = iso_8601 /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.029343,"max_time":0.029343,"mean_time":0.029343,"rows":0},{"query":"SET SESSION statement_timeout TO '120s' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.02515,"max_time":0.02515,"mean_time":0.02515,"rows":0},{"query":"set client_encoding to 'UTF8'","calls":1,"total_time":0.02272,"max_time":0.02272,"mean_time":0.02272,"rows":0},{"query":"set client_encoding to 'unicode'","calls":1,"total_time":0.017277,"max_time":0.017277,"mean_time":0.017277,"rows":0},{"query":"SELECT pg_try_advisory_lock($1)","calls":1,"total_time":0.016465,"max_time":0.016465,"mean_time":0.016465,"rows":1},{"query":"SELECT pg_advisory_unlock($1)","calls":1,"total_time":0.013474,"max_time":0.013474,"mean_time":0.013474,"rows":1},{"query":"SET client_min_messages TO 'warning' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.013304,"max_time":0.013304,"mean_time":0.013304,"rows":0},{"query":"SELECT current_database()","calls":1,"total_time":0.008921,"max_time":0.008921,"mean_time":0.008921,"rows":1},{"query":"SHOW TIME ZONE /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.006236,"max_time":0.006236,"mean_time":0.006236,"rows":0}]}
\ No newline at end of file
+{"version":20990604233157,"name":"MigrationThrowsException","walltime":1.0531382337212563,"success":false,"total_database_size_change":8192,"query_statistics":[{"query":"select pg_database_size(current_database()) /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/observers/total_database_size_change.rb:25:in `get_total_database_size'*/","calls":1,"total_time":149.639878,"max_time":149.639878,"mean_time":149.639878,"rows":1},{"query":"SELECT \"schema_migrations\".\"version\" FROM \"schema_migrations\" ORDER BY \"schema_migrations\".\"version\" ASC /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":2.7582169999999997,"max_time":2.7582169999999997,"mean_time":2.7582169999999997,"rows":5392},{"query":"select pg_stat_statements_reset() /*application:test,db_config_name:ci,line:/lib/gitlab/database/migrations/observers/query_statistics.rb:16:in `before'*/","calls":1,"total_time":0.180636,"max_time":0.180636,"mean_time":0.180636,"rows":1},{"query":"SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = ANY (current_schemas($1)) AND c.relname = $2 AND c.relkind IN ($3,$4)","calls":3,"total_time":0.106823,"max_time":0.044187000000000004,"mean_time":0.03560766666666667,"rows":3},{"query":"SELECT t.oid, t.typname\nFROM pg_type as t\nWHERE t.typname IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.074475,"max_time":0.074475,"mean_time":0.074475,"rows":10},{"query":"SET SESSION timezone TO 'UTC' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.04106,"max_time":0.04106,"mean_time":0.04106,"rows":0},{"query":"SELECT $1 FROM pg_proc WHERE proname = $2 /*application:test,db_config_name:ci,line:/lib/gitlab/database/schema_helpers.rb:20:in `function_exists?'*/","calls":1,"total_time":0.040091,"max_time":0.040091,"mean_time":0.040091,"rows":1},{"query":"SET standard_conforming_strings = on /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.03729,"max_time":0.03729,"mean_time":0.03729,"rows":0},{"query":"SET intervalstyle = iso_8601 /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.029343,"max_time":0.029343,"mean_time":0.029343,"rows":0},{"query":"SET SESSION statement_timeout TO '120s' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.02515,"max_time":0.02515,"mean_time":0.02515,"rows":0},{"query":"set client_encoding to 'UTF8'","calls":1,"total_time":0.02272,"max_time":0.02272,"mean_time":0.02272,"rows":0},{"query":"set client_encoding to 'unicode'","calls":1,"total_time":0.017277,"max_time":0.017277,"mean_time":0.017277,"rows":0},{"query":"SELECT pg_try_advisory_lock($1)","calls":1,"total_time":0.016465,"max_time":0.016465,"mean_time":0.016465,"rows":1},{"query":"SELECT pg_advisory_unlock($1)","calls":1,"total_time":0.013474,"max_time":0.013474,"mean_time":0.013474,"rows":1},{"query":"SET client_min_messages TO 'warning' /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.013304,"max_time":0.013304,"mean_time":0.013304,"rows":0},{"query":"SELECT current_database()","calls":1,"total_time":0.008921,"max_time":0.008921,"mean_time":0.008921,"rows":1},{"query":"SHOW TIME ZONE /*application:test,db_config_name:unknown,line:/lib/gitlab/database/migrations/runner.rb:127:in `block (3 levels) in run'*/","calls":1,"total_time":0.006236,"max_time":0.006236,"mean_time":0.006236,"rows":0}]}
\ No newline at end of file
diff --git a/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt b/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt
index 3382bf10b6de8cd8fa5666895c790b7ee54f5ee3..3457a3bee143d3290a3957024665441d1c309d06 100644
--- a/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt
+++ b/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt
@@ -351,7 +351,7 @@ Migrations included in this change have been executed on gitlab.com data for tes
| 20221130142531 - CreateEfficientlyOrderedColumnsTable | Regular | 1.2 s | :white_check_mark: | +40.00 KiB |
| 20221130142617 - CreateInefficientlyOrderedColumnsTable | Regular | 1.2 s | :white_check_mark: | +48.00 KiB |
| 20210604232017 - DropTestTable | Post deploy | 1.4 s | :white_check_mark: | -24.00 KiB |
-| 20990604233157 - MigrationThrowsException | Post deploy | 1.1 s | :boom: | +0.00 B |
+| 20990604233157 - MigrationThrowsException | Post deploy | 1.1 s | :boom: | +8.00 KiB [[note](https://docs.gitlab.com/ee/development/database/database_migration_pipeline.html#database-size-increase)] |
Runtime Histogram for all migrations
@@ -555,7 +555,7 @@ Migrations included in this change have been executed on gitlab.com data for tes
* Type: Post deploy
* Duration: 1.1 s
-* Database size change: +0.00 B
+* Database size change: +8.00 KiB [[note](https://docs.gitlab.com/ee/development/database/database_migration_pipeline.html#database-size-increase)]
@@ -606,6 +606,6 @@ aGFuZ2UiOjQ5MTUyLCJzdWNjZXNzIjp0cnVlfSx7InZlcnNpb24iOjIwMjEw
NjA0MjMyMDE3LCJ3YWxsdGltZSI6MS40MTMzMTk2OTk0NjYyMjg1LCJ0b3Rh
bF9kYXRhYmFzZV9zaXplX2NoYW5nZSI6LTI0NTc2LCJzdWNjZXNzIjp0cnVl
fSx7InZlcnNpb24iOjIwOTkwNjA0MjMzMTU3LCJ3YWxsdGltZSI6MS4wNTMx
-MzgyMzM3MjEyNTYzLCJ0b3RhbF9kYXRhYmFzZV9zaXplX2NoYW5nZSI6MCwi
-c3VjY2VzcyI6ZmFsc2V9XX0=
+MzgyMzM3MjEyNTYzLCJ0b3RhbF9kYXRhYmFzZV9zaXplX2NoYW5nZSI6ODE5
+Miwic3VjY2VzcyI6ZmFsc2V9XX0=
-->
diff --git a/notifier/templates/detail.erb b/notifier/templates/detail.erb
index c3372a6bad2425fb9057f7586ffe1fa58a66fab6..757b25c9fe824cc7315cb63e0eaf58c176611355 100644
--- a/notifier/templates/detail.erb
+++ b/notifier/templates/detail.erb
@@ -2,7 +2,7 @@
* Type: <%= type(migration) %>
* Duration: <%= walltime(migration) %>
-* Database size change: <%= total_size_change(migration) %>
+* Database size change: <%= total_size_change(migration) %><%= conditional_size_change_note(migration) %>
% if migration.queries.any?
<%= render_pgss_table(migration.queries) %>
diff --git a/notifier/templates/summary_table.erb b/notifier/templates/summary_table.erb
index 99e243f07c3b330522dc72c5b6b74bec1ce6407f..7106e2bc64160fc7d4ccd971d17ab933772d8d0e 100644
--- a/notifier/templates/summary_table.erb
+++ b/notifier/templates/summary_table.erb
@@ -1,5 +1,5 @@
| Migration | Type | Total runtime | Result | DB size change |
| --------- | ---- | ------------- | ------ | -------------- |
% migrations.each do |m|
-| <%= m.version %> - <%= m.name %> | <%= type(m) %> | <%= walltime(m) %> | <%= success(m) %> | <%= total_size_change(m) %> |
+| <%= m.version %> - <%= m.name %> | <%= type(m) %> | <%= walltime(m) %> | <%= success(m) %> | <%= total_size_change(m) %><%= conditional_size_change_note(m) %> |
% end