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
903048ed
Commit
903048ed
authored
5 months ago
by
Kurdakov Alexander
Committed by
Alexander Kurdakov
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: prettify error message in resolve_rpc_target
parent
46821352
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1289
fix: prettify error message in resolve_rpc_target
Pipeline
#50872
passed
5 months ago
Stage: test
Stage: docker
Stage: stress-test
Stage: front-deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugin/rpc/client.rs
+27
-6
27 additions, 6 deletions
src/plugin/rpc/client.rs
test/int/test_plugin.py
+1
-1
1 addition, 1 deletion
test/int/test_plugin.py
with
28 additions
and
7 deletions
src/plugin/rpc/client.rs
+
27
−
6
View file @
903048ed
...
...
@@ -173,13 +173,25 @@ fn encode_request_arguments(
Ok
(())
}
/// Gets instance id
fn
get_replicaset_uuid_by_bucket_id
(
tier_name
:
&
str
,
bucket_id
:
u64
,
node
:
&
Node
,
)
->
Result
<
String
,
Error
>
{
let
res
=
vshard
::
get_replicaset_uuid_by_bucket_id
(
tier_name
,
bucket_id
);
if
res
.is_err
()
&&
node
.storage.tiers
.by_name
(
tier_name
)
?
.is_none
()
{
return
Err
(
Error
::
NoSuchTier
(
tier_name
.into
()));
}
res
}
fn
get_instance_id_of_master_of_replicaset
(
tier
:
&
str
,
tier
_name
:
&
str
,
bucket_id
:
u64
,
node
:
&
Node
,
)
->
Result
<
InstanceId
,
Error
>
{
let
replicaset_uuid
=
vshard
::
get_replicaset_uuid_by_bucket_id
(
tier
,
bucket_id
)
?
;
let
replicaset_uuid
=
get_replicaset_uuid_by_bucket_id
(
tier
_name
,
bucket_id
,
node
)
?
;
let
tuple
=
node
.storage.replicasets
.by_uuid_raw
(
&
replicaset_uuid
)
?
;
let
Some
(
master_id
)
=
tuple
.field
(
Replicaset
::
FIELD_TARGET_MASTER_ID
)
...
...
@@ -329,7 +341,7 @@ fn resolve_rpc_target(
.tier
()
?
.expect
(
"storage for instance should exists"
);
let
replicaset_uuid
=
vshard
::
get_replicaset_uuid_by_bucket_id
(
&
tier
,
bucket_id
)
?
;
let
replicaset_uuid
=
get_replicaset_uuid_by_bucket_id
(
&
tier
,
bucket_id
,
node
)
?
;
tier_and_replicaset_uuid
=
Some
((
tier
,
replicaset_uuid
));
}
...
...
@@ -340,7 +352,7 @@ fn resolve_rpc_target(
}
=>
{
// SAFETY: it's required that argument pointers are valid for the lifetime of this function's call
let
tier
=
unsafe
{
tier
.as_str
()
.to_string
()
};
let
replicaset_uuid
=
vshard
::
get_replicaset_uuid_by_bucket_id
(
&
tier
,
bucket_id
)
?
;
let
replicaset_uuid
=
get_replicaset_uuid_by_bucket_id
(
&
tier
,
bucket_id
,
node
)
?
;
tier_and_replicaset_uuid
=
Some
((
tier
,
replicaset_uuid
));
}
...
...
@@ -350,7 +362,16 @@ fn resolve_rpc_target(
if
let
Some
((
tier
,
replicaset_uuid
))
=
tier_and_replicaset_uuid
{
// Need to pick a replica from given replicaset
let
replicas
=
vshard
::
get_replicaset_priority_list
(
&
tier
,
&
replicaset_uuid
)
?
;
let
replicas
=
match
vshard
::
get_replicaset_priority_list
(
&
tier
,
&
replicaset_uuid
)
{
Ok
(
replicas
)
=>
replicas
,
Err
(
err
)
=>
{
if
node
.storage.tiers
.by_name
(
&
tier
)
?
.is_none
()
{
return
Err
(
Error
::
NoSuchTier
(
tier
));
}
return
Err
(
err
);
}
};
// XXX: this shouldn't be a problem if replicasets aren't too big,
// but if they are we might want to construct a HashSet from candidates
...
...
This diff is collapsed.
Click to expand it.
test/int/test_plugin.py
+
1
−
1
View file @
903048ed
...
...
@@ -2334,7 +2334,7 @@ cluster:
# Check requesting RPC to unknown tier
with
pytest
.
raises
(
TarantoolError
,
match
=
"
no router found for tier
'
undefined
'"
,
match
=
'
tier with name
"
undefined
"
not found
'
,
):
context
=
make_context
()
input
=
dict
(
...
...
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