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
b562f53a
Commit
b562f53a
authored
Nov 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo - Remove duplicated code to remove tracking database entries
parent
10fa290b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
ee/app/services/ee/projects/destroy_service.rb
ee/app/services/ee/projects/destroy_service.rb
+4
-9
lib/gitlab/geo/log_cursor/daemon.rb
lib/gitlab/geo/log_cursor/daemon.rb
+0
-1
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
+8
-2
No files found.
ee/app/services/ee/projects/destroy_service.rb
View file @
b562f53a
...
@@ -22,9 +22,11 @@ module EE
...
@@ -22,9 +22,11 @@ module EE
end
end
def
log_geo_event
(
project
)
def
log_geo_event
(
project
)
::
Geo
::
RepositoryDeletedEventStore
.
new
(
project
,
::
Geo
::
RepositoryDeletedEventStore
.
new
(
project
,
repo_path:
repo_path
,
repo_path:
repo_path
,
wiki_path:
wiki_path
).
create
wiki_path:
wiki_path
).
create
end
end
# Removes physical repository in a Geo replicated secondary node
# Removes physical repository in a Geo replicated secondary node
...
@@ -37,16 +39,9 @@ module EE
...
@@ -37,16 +39,9 @@ module EE
flush_caches
(
project
)
flush_caches
(
project
)
trash_repositories!
trash_repositories!
remove_tracking_entries!
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
end
end
def
remove_tracking_entries!
return
unless
::
Gitlab
::
Geo
.
secondary?
::
Geo
::
ProjectRegistry
.
where
(
project_id:
project
.
id
).
delete_all
end
private
private
def
log_audit_event
(
project
)
def
log_audit_event
(
project
)
...
...
lib/gitlab/geo/log_cursor/daemon.rb
View file @
b562f53a
...
@@ -122,7 +122,6 @@ module Gitlab
...
@@ -122,7 +122,6 @@ module Gitlab
def
handle_repository_deleted
(
event_log
)
def
handle_repository_deleted
(
event_log
)
event
=
event_log
.
repository_deleted_event
event
=
event_log
.
repository_deleted_event
disk_path
=
File
.
join
(
event
.
repository_storage_path
,
event
.
deleted_path
)
disk_path
=
File
.
join
(
event
.
repository_storage_path
,
event
.
deleted_path
)
job_id
=
::
Geo
::
RepositoryDestroyService
job_id
=
::
Geo
::
RepositoryDestroyService
...
...
spec/lib/gitlab/geo/log_cursor/daemon_spec.rb
View file @
b562f53a
...
@@ -139,11 +139,11 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
...
@@ -139,11 +139,11 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
context
'when replaying a repository deleted event'
do
context
'when replaying a repository deleted event'
do
let
(
:event_log
)
{
create
(
:geo_event_log
,
:deleted_event
)
}
let
(
:event_log
)
{
create
(
:geo_event_log
,
:deleted_event
)
}
let
(
:project
)
{
event_log
.
repository_deleted_event
.
project
}
let!
(
:event_log_state
)
{
create
(
:geo_event_log_state
,
event_id:
event_log
.
id
-
1
)
}
let!
(
:event_log_state
)
{
create
(
:geo_event_log_state
,
event_id:
event_log
.
id
-
1
)
}
let
(
:repository_deleted_event
)
{
event_log
.
repository_deleted_event
}
let
(
:repository_deleted_event
)
{
event_log
.
repository_deleted_event
}
let
(
:project
)
{
repository_deleted_event
.
project
}
it
'does not create a
new project regis
try'
do
it
'does not create a
tracking database en
try'
do
expect
{
daemon
.
run_once!
}.
not_to
change
(
Geo
::
ProjectRegistry
,
:count
)
expect
{
daemon
.
run_once!
}.
not_to
change
(
Geo
::
ProjectRegistry
,
:count
)
end
end
...
@@ -158,6 +158,12 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
...
@@ -158,6 +158,12 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql, :clean_gitlab_redis_shared
daemon
.
run_once!
daemon
.
run_once!
end
end
it
'removes the tracking database entry if exist'
do
create
(
:geo_project_registry
,
:synced
,
project:
project
)
expect
{
daemon
.
run_once!
}.
to
change
(
Geo
::
ProjectRegistry
,
:count
).
by
(
-
1
)
end
end
end
context
'when replaying a repositories changed event'
do
context
'when replaying a repositories changed event'
do
...
...
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