Commit ad2206dc authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '11280-geo-find-select-count-and-remove-it-if-we-don-t-need-it-geo' into 'master'

Geo: Remove SELECT COUNT(*) FROM "geo_event_log" if we don't need it

Closes #11280

See merge request gitlab-org/gitlab-ee!12146
parents b521a88e aef65e4e
......@@ -14,6 +14,7 @@ class GeoNodeStatus < ApplicationRecord
attr_accessor :repository_verification_enabled
# Prometheus metrics, no need to store them in the database
# :event_log_count is deprecated and will be removed in 12.0
attr_accessor :event_log_count, :event_log_max_id,
:repository_created_max_id, :repository_updated_max_id,
:repository_deleted_max_id, :repository_renamed_max_id, :repositories_changed_max_id,
......@@ -70,7 +71,6 @@ class GeoNodeStatus < ApplicationRecord
cursor_last_event_timestamp: 'Time of the event log processed by the secondary',
last_successful_status_check_timestamp: 'Time when Geo node status was updated internally',
status_message: 'Summary of health status',
event_log_count: 'Number of entries in the Geo event log',
event_log_max_id: 'Highest ID present in the Geo event log',
repository_created_max_id: 'Highest ID present in repositories created',
repository_updated_max_id: 'Highest ID present in repositories updated',
......@@ -166,7 +166,6 @@ class GeoNodeStatus < ApplicationRecord
self.version = Gitlab::VERSION
self.revision = Gitlab.revision
self.event_log_count = Geo::EventLog.count
# Geo::PruneEventLogWorker might remove old events, so log maximum id
self.event_log_max_id = Geo::EventLog.maximum(:id)
self.repository_created_max_id = Geo::RepositoryCreatedEvent.maximum(:id)
......
---
title: 'Geo: Remove counts over geo_event_log table'
merge_request: 12146
author:
type: fixed
......@@ -273,7 +273,6 @@ describe API::Geo do
last_event_date: Time.now.utc,
cursor_last_event_id: 1,
cursor_last_event_date: Time.now.utc,
event_log_count: 55,
event_log_max_id: 555,
repository_created_max_id: 43,
repository_updated_max_id: 132,
......
......@@ -36,7 +36,6 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
last_event_date: event_date,
cursor_last_event_id: 1,
cursor_last_event_date: event_date,
event_log_count: 55,
event_log_max_id: 555,
repository_created_max_id: 43,
repository_updated_max_id: 132,
......@@ -60,7 +59,6 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
attachments_count: 30,
last_event_id: 2,
last_event_date: event_date,
event_log_count: 55,
event_log_max_id: 555
}
end
......@@ -176,7 +174,6 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
expect(metric_value(:geo_cursor_last_event_id)).to eq(1)
expect(metric_value(:geo_cursor_last_event_timestamp)).to eq(event_date.to_i)
expect(metric_value(:geo_last_successful_status_check_timestamp)).to be_truthy
expect(metric_value(:geo_event_log)).to eq(55)
expect(metric_value(:geo_event_log_max_id)).to eq(555)
expect(metric_value(:geo_repository_created_max_id)).to eq(43)
expect(metric_value(:geo_repository_updated_max_id)).to eq(132)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment