Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e44df30e
Commit
e44df30e
authored
Dec 12, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep the minimum cursor last event
parent
6e3e3bff
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
ee/app/services/geo/prune_event_log_service.rb
ee/app/services/geo/prune_event_log_service.rb
+1
-1
ee/changelogs/unreleased/mk-keep-last-remaining-event.yml
ee/changelogs/unreleased/mk-keep-last-remaining-event.yml
+5
-0
ee/spec/services/geo/prune_event_log_service_spec.rb
ee/spec/services/geo/prune_event_log_service_spec.rb
+3
-3
ee/spec/workers/geo/prune_event_log_worker_spec.rb
ee/spec/workers/geo/prune_event_log_worker_spec.rb
+2
-2
No files found.
ee/app/services/geo/prune_event_log_service.rb
View file @
e44df30e
...
...
@@ -41,7 +41,7 @@ module Geo
def
prune!
(
relation
,
limit
)
unless
delete_all?
relation
=
relation
.
up_to_event
(
event_log_min_id
)
relation
=
relation
.
up_to_event
(
event_log_min_id
-
1
)
end
deleted
=
relation
.
delete_with_limit
(
limit
)
...
...
ee/changelogs/unreleased/mk-keep-last-remaining-event.yml
0 → 100644
View file @
e44df30e
---
title
:
'
Geo:
Keep
the
minimum
cursor
last
event'
merge_request
:
8832
author
:
type
:
fixed
ee/spec/services/geo/prune_event_log_service_spec.rb
View file @
e44df30e
...
...
@@ -61,12 +61,12 @@ describe Geo::PruneEventLogService do
context
'with event_log_min_id'
do
let
(
:min_id
)
{
events
[
1
].
id
}
it
'prunes events up to the min id'
do
expect
{
service
.
execute
}.
to
change
{
Geo
::
EventLog
.
count
}.
by
(
-
2
)
it
'prunes events up to
, but not including,
the min id'
do
expect
{
service
.
execute
}.
to
change
{
Geo
::
EventLog
.
count
}.
by
(
-
1
)
end
it
'prunes all associated events'
do
expect
{
service
.
execute
}.
to
change
{
Geo
::
RepositoryUpdatedEvent
.
count
}.
by
(
-
2
)
expect
{
service
.
execute
}.
to
change
{
Geo
::
RepositoryUpdatedEvent
.
count
}.
by
(
-
1
)
end
end
...
...
ee/spec/workers/geo/prune_event_log_worker_spec.rb
View file @
e44df30e
...
...
@@ -44,7 +44,7 @@ describe Geo::PruneEventLogWorker, :geo do
create_list
(
:geo_event_log
,
2
,
:updated_event
)
create
(
:geo_node_status
,
:healthy
,
cursor_last_event_id:
Geo
::
EventLog
.
last
.
id
,
geo_node_id:
secondary
.
id
)
expect
{
worker
.
perform
}.
to
change
{
Geo
::
RepositoryUpdatedEvent
.
count
}.
by
(
-
2
)
expect
{
worker
.
perform
}.
to
change
{
Geo
::
RepositoryUpdatedEvent
.
count
}.
by
(
-
1
)
end
it
'delegates pruning to Geo::PruneEventLogService'
do
...
...
@@ -118,7 +118,7 @@ describe Geo::PruneEventLogWorker, :geo do
create
(
:geo_node_status
,
:healthy
,
cursor_last_event_id:
events
.
last
.
id
,
geo_node_id:
secondary2
.
id
)
expect
(
Geo
::
PruneEventLogService
).
to
receive
(
:new
).
with
(
events
[
3
].
id
).
and_call_original
expect
{
worker
.
perform
}.
to
change
{
Geo
::
EventLog
.
count
}.
by
(
-
4
)
expect
{
worker
.
perform
}.
to
change
{
Geo
::
EventLog
.
count
}.
by
(
-
3
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment