Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
176054c3
Commit
176054c3
authored
2 years ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
refactor(governor): Loop::RETRY_TIMEOUT
parent
cec405ef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!430
Refactor/governor/action plan
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/governor/mod.rs
+8
-8
8 additions, 8 deletions
src/governor/mod.rs
with
8 additions
and
8 deletions
src/governor/mod.rs
+
8
−
8
View file @
176054c3
...
...
@@ -42,6 +42,7 @@ pub(crate) use migration::waiting_migrations;
impl
Loop
{
const
SYNC_TIMEOUT
:
Duration
=
Duration
::
from_secs
(
10
);
const
RETRY_TIMEOUT
:
Duration
=
Duration
::
from_millis
(
250
);
async
fn
iter_fn
(
Args
{
...
...
@@ -84,7 +85,7 @@ impl Loop {
Err
(
e
)
=>
{
tlog!
(
Warning
,
"failed constructing an action plan: {e}"
);
// TODO don't hard code timeout
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_millis
(
500
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
);
...
...
@@ -107,7 +108,7 @@ impl Loop {
Plan
::
TransferLeadership
(
TransferLeadership
{
to
})
=>
{
tlog!
(
Info
,
"transferring leadership to {}"
,
to
.instance_id
);
node
.transfer_leadership_and_yield
(
to
.raft_id
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_secs
(
1
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
}
Plan
::
TransferMastership
(
TransferMastership
{
to
,
rpc
,
op
})
=>
{
...
...
@@ -129,7 +130,7 @@ impl Loop {
"master_id"
=>
%
instance_id
,
"replicaset_id"
=>
%
replicaset_id
,
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_secs
(
1
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
...
...
@@ -145,7 +146,7 @@ impl Loop {
"master_id"
=>
%
instance_id
,
"replicaset_id"
=>
%
replicaset_id
,
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_secs
(
1
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
}
...
...
@@ -179,7 +180,7 @@ impl Loop {
.await
;
if
let
Err
(
e
)
=
res
{
tlog!
(
Warning
,
"failed reconfiguring sharding: {e}"
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_secs
(
1
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
...
...
@@ -192,7 +193,7 @@ impl Loop {
tlog!
(
Warning
,
"failed handling instance grade change: {e}"
;
"instance_id"
=>
%
instance_id
,
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_secs
(
1
)
)
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
}
...
...
@@ -214,8 +215,7 @@ impl Loop {
.await
;
if
let
Err
(
e
)
=
res
{
tlog!
(
Warning
,
"failed syncing raft log: {e}"
;
"instance_id"
=>
%
instance_id
);
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Duration
::
from_millis
(
250
))
.unwrap
();
event
::
wait_timeout
(
Event
::
TopologyChanged
,
Loop
::
RETRY_TIMEOUT
)
.unwrap
();
return
Continue
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment