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
dc220a3d
Commit
dc220a3d
authored
Aug 09, 2019
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Add more debug logging in log_cursor
parent
c57622a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
ee/lib/gitlab/geo/log_cursor/daemon.rb
ee/lib/gitlab/geo/log_cursor/daemon.rb
+15
-7
No files found.
ee/lib/gitlab/geo/log_cursor/daemon.rb
View file @
dc220a3d
...
@@ -16,11 +16,13 @@ module Gitlab
...
@@ -16,11 +16,13 @@ module Gitlab
end
end
def
run!
def
run!
logger
.
debug
(
'#run!: start'
)
trap_signals
trap_signals
until
exit
?
until
exit
?
# Prevent the node from processing events unless it's a secondary
# Prevent the node from processing events unless it's a secondary
unless
Geo
.
secondary?
unless
Geo
.
secondary?
logger
.
debug
(
"#run!: not a secondary, sleeping for
#{
SECONDARY_CHECK_INTERVAL
}
secs"
)
sleep_break
(
SECONDARY_CHECK_INTERVAL
)
sleep_break
(
SECONDARY_CHECK_INTERVAL
)
next
next
end
end
...
@@ -31,6 +33,8 @@ module Gitlab
...
@@ -31,6 +33,8 @@ module Gitlab
# When no new event is found sleep for a few moments
# When no new event is found sleep for a few moments
arbitrary_sleep
(
lease
[:
ttl
])
arbitrary_sleep
(
lease
[:
ttl
])
end
end
logger
.
debug
(
'#run!: finish'
)
end
end
def
run_once!
def
run_once!
...
@@ -54,7 +58,7 @@ module Gitlab
...
@@ -54,7 +58,7 @@ module Gitlab
end
end
def
handle_events
(
batch
,
previous_batch_last_id
)
def
handle_events
(
batch
,
previous_batch_last_id
)
logger
.
info
(
"
Handling events
"
,
first_id:
batch
.
first
.
id
,
last_id:
batch
.
last
.
id
)
logger
.
info
(
"
#handle_events:
"
,
first_id:
batch
.
first
.
id
,
last_id:
batch
.
last
.
id
)
gap_tracking
.
previous_id
=
previous_batch_last_id
gap_tracking
.
previous_id
=
previous_batch_last_id
...
@@ -71,7 +75,7 @@ module Gitlab
...
@@ -71,7 +75,7 @@ module Gitlab
# If a project is deleted, the event log and its associated event data
# If a project is deleted, the event log and its associated event data
# could be purged from the log. We ignore this and move along.
# could be purged from the log. We ignore this and move along.
unless
event
unless
event
logger
.
warn
(
"
U
nknown event"
,
event_log_id:
event_log
.
id
)
logger
.
warn
(
"
#handle_single_event: u
nknown event"
,
event_log_id:
event_log
.
id
)
return
return
end
end
...
@@ -97,13 +101,13 @@ module Gitlab
...
@@ -97,13 +101,13 @@ module Gitlab
end
end
def
trap_signals
def
trap_signals
trap
(:
TERM
)
{
quit!
}
trap
(
:TERM
)
{
quit!
(:
term
)
}
trap
(:
INT
)
{
quit!
}
trap
(
:INT
)
{
quit!
(:
int
)
}
end
end
# Safe shutdown
# Safe shutdown
def
quit!
def
quit!
(
signal
)
$stdout
.
puts
'Exiting...'
warn
(
"Signal
#{
signal
}
received, Exiting..."
)
@exit
=
true
@exit
=
true
end
end
...
@@ -140,7 +144,11 @@ module Gitlab
...
@@ -140,7 +144,11 @@ module Gitlab
end
end
def
log_level
def
log_level
options
[
:debug
]
?
:debug
:
Rails
.
logger
.
level
# rubocop:disable Gitlab/RailsLogger
debug_logging?
?
:debug
:
Rails
.
logger
.
level
# rubocop:disable Gitlab/RailsLogger
end
def
debug_logging?
options
[
:debug
]
end
end
def
event_data
(
event_log
)
def
event_data
(
event_log
)
...
...
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