Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
66578349
Commit
66578349
authored
Jun 20, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Controller::rpc_dump_meta to Controller::sampled_request
parent
585d5393
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
29 deletions
+28
-29
controller.cpp
src/brpc/controller.cpp
+6
-6
controller.h
src/brpc/controller.h
+5
-5
baidu_rpc_protocol.cpp
src/brpc/policy/baidu_rpc_protocol.cpp
+4
-4
hulu_pbrpc_protocol.cpp
src/brpc/policy/hulu_pbrpc_protocol.cpp
+5
-5
sofa_pbrpc_protocol.cpp
src/brpc/policy/sofa_pbrpc_protocol.cpp
+3
-3
rpc_dump.cpp
src/brpc/rpc_dump.cpp
+0
-1
rpc_replay.cpp
tools/rpc_replay/rpc_replay.cpp
+5
-5
No files found.
src/brpc/controller.cpp
View file @
66578349
...
...
@@ -41,7 +41,7 @@
#include "brpc/retry_policy.h"
#include "brpc/stream_impl.h"
#include "brpc/policy/streaming_rpc_protocol.h" // FIXME
#include "brpc/rpc_dump.
pb.
h"
#include "brpc/rpc_dump.h"
#include "brpc/details/usercode_backup_pool.h" // RunUserCode
#include "brpc/mongo_service_adaptor.h"
...
...
@@ -159,7 +159,7 @@ void Controller::ResetNonPods() {
_server
->
_session_local_data_pool
->
Return
(
_session_local_data
);
}
_mongo_session_data
.
reset
();
delete
_
rpc_dump_meta
;
delete
_
sampled_request
;
if
(
!
is_used_by_rpc
()
&&
_correlation_id
!=
INVALID_BTHREAD_ID
)
{
CHECK_NE
(
EPERM
,
bthread_id_cancel
(
_correlation_id
));
...
...
@@ -213,7 +213,7 @@ void Controller::ResetPods() {
_server
=
NULL
;
_oncancel_id
=
INVALID_BTHREAD_ID
;
_auth_context
=
NULL
;
_
rpc_dump_meta
=
NULL
;
_
sampled_request
=
NULL
;
_request_protocol
=
PROTOCOL_UNKNOWN
;
_max_retry
=
UNSET_MAGIC_NUM
;
_retry_policy
=
NULL
;
...
...
@@ -1331,9 +1331,9 @@ void WebEscape(const std::string& source, std::string* output) {
}
}
void
Controller
::
reset_
rpc_dump_meta
(
RpcDumpMeta
*
meta
)
{
delete
_
rpc_dump_meta
;
_
rpc_dump_meta
=
meta
;
void
Controller
::
reset_
sampled_request
(
SampledRequest
*
req
)
{
delete
_
sampled_request
;
_
sampled_request
=
req
;
}
void
Controller
::
set_stream_creator
(
StreamCreator
*
sc
)
{
...
...
src/brpc/controller.h
View file @
66578349
...
...
@@ -63,7 +63,7 @@ class SharedLoadBalancer;
class
ExcludedServers
;
class
RPCSender
;
class
StreamSettings
;
class
RpcDumpMeta
;
class
SampledRequest
;
class
MongoContext
;
class
RetryPolicy
;
class
InputMessageBase
;
...
...
@@ -258,10 +258,10 @@ public:
int
sub_count
()
const
;
const
Controller
*
sub
(
int
index
)
const
;
// Get/own
RpcDumpMeta
for sending dumped requests.
// Get/own
SampledRquest
for sending dumped requests.
// Deleted along with controller.
void
reset_
rpc_dump_meta
(
RpcDumpMeta
*
meta
);
const
RpcDumpMeta
*
rpc_dump_meta
()
{
return
_rpc_dump_meta
;
}
void
reset_
sampled_request
(
SampledRequest
*
req
);
const
SampledRequest
*
sampled_request
()
{
return
_sampled_request
;
}
// Attach a StreamCreator to this RPC. Notice that the ownership of sc has
// been transferred to cntl, and sc->DestroyStreamCreator() would be called
...
...
@@ -672,7 +672,7 @@ private:
bthread_id_t
_oncancel_id
;
const
AuthContext
*
_auth_context
;
// Authentication result
butil
::
intrusive_ptr
<
MongoContext
>
_mongo_session_data
;
RpcDumpMeta
*
_rpc_dump_meta
;
SampledRequest
*
_sampled_request
;
ProtocolType
_request_protocol
;
// Some of them are copied from `Channel' which might be destroyed
...
...
src/brpc/policy/baidu_rpc_protocol.cpp
View file @
66578349
...
...
@@ -636,11 +636,11 @@ void PackRpcRequest(butil::IOBuf* req_buf,
method
->
service
()
->
name
());
request_meta
->
set_method_name
(
method
->
name
());
meta
.
set_compress_type
(
cntl
->
request_compress_type
());
}
else
if
(
cntl
->
rpc_dump_meta
())
{
}
else
if
(
cntl
->
sampled_request
())
{
// Replaying. Keep service-name as the one seen by server.
request_meta
->
set_service_name
(
cntl
->
rpc_dump_meta
()
->
service_name
());
request_meta
->
set_method_name
(
cntl
->
rpc_dump_meta
()
->
method_name
());
meta
.
set_compress_type
(
cntl
->
rpc_dump_meta
()
->
compress_type
());
request_meta
->
set_service_name
(
cntl
->
sampled_request
()
->
meta
.
service_name
());
request_meta
->
set_method_name
(
cntl
->
sampled_request
()
->
meta
.
method_name
());
meta
.
set_compress_type
(
cntl
->
sampled_request
()
->
meta
.
compress_type
());
}
else
{
return
cntl
->
SetFailed
(
ENOMETHOD
,
"%s.method is NULL"
,
__FUNCTION__
);
}
...
...
src/brpc/policy/hulu_pbrpc_protocol.cpp
View file @
66578349
...
...
@@ -639,13 +639,13 @@ void PackHuluRequest(butil::IOBuf* req_buf,
meta
.
set_service_name
(
method
->
service
()
->
name
());
meta
.
set_method_index
(
method
->
index
());
meta
.
set_compress_type
(
CompressType2Hulu
(
cntl
->
request_compress_type
()));
}
else
if
(
cntl
->
rpc_dump_meta
())
{
}
else
if
(
cntl
->
sampled_request
())
{
// Replaying. Keep service-name as the one seen by server.
meta
.
set_service_name
(
cntl
->
rpc_dump_meta
()
->
service_name
());
meta
.
set_method_index
(
cntl
->
rpc_dump_meta
()
->
method_index
());
meta
.
set_service_name
(
cntl
->
sampled_request
()
->
meta
.
service_name
());
meta
.
set_method_index
(
cntl
->
sampled_request
()
->
meta
.
method_index
());
meta
.
set_compress_type
(
CompressType2Hulu
(
cntl
->
rpc_dump_meta
()
->
compress_type
()));
meta
.
set_user_data
(
cntl
->
rpc_dump_meta
()
->
user_data
());
CompressType2Hulu
(
cntl
->
sampled_request
()
->
meta
.
compress_type
()));
meta
.
set_user_data
(
cntl
->
sampled_request
()
->
meta
.
user_data
());
}
else
{
return
cntl
->
SetFailed
(
ENOMETHOD
,
"method is NULL"
);
}
...
...
src/brpc/policy/sofa_pbrpc_protocol.cpp
View file @
66578349
...
...
@@ -545,11 +545,11 @@ void PackSofaRequest(butil::IOBuf* req_buf,
if
(
method
)
{
meta
.
set_method
(
method
->
full_name
());
meta
.
set_compress_type
(
CompressType2Sofa
(
cntl
->
request_compress_type
()));
}
else
if
(
cntl
->
rpc_dump_meta
())
{
}
else
if
(
cntl
->
sampled_request
())
{
// Replaying.
meta
.
set_method
(
cntl
->
rpc_dump_meta
()
->
method_name
());
meta
.
set_method
(
cntl
->
sampled_request
()
->
meta
.
method_name
());
meta
.
set_compress_type
(
CompressType2Sofa
(
cntl
->
rpc_dump_meta
()
->
compress_type
()));
CompressType2Sofa
(
cntl
->
sampled_request
()
->
meta
.
compress_type
()));
}
else
{
return
cntl
->
SetFailed
(
ENOMETHOD
,
"method is NULL"
);
}
...
...
src/brpc/rpc_dump.cpp
View file @
66578349
...
...
@@ -31,7 +31,6 @@ namespace bvar {
std
::
string
read_command_name
();
}
namespace
brpc
{
DECLARE_uint64
(
max_body_size
);
...
...
tools/rpc_replay/rpc_replay.cpp
View file @
66578349
...
...
@@ -147,21 +147,21 @@ static void* replay_thread(void* arg) {
continue
;
}
brpc
::
Channel
*
chan
=
chan_group
->
channel
(
sample
->
protocol_type
());
chan_group
->
channel
(
sample
->
meta
.
protocol_type
());
if
(
chan
==
NULL
)
{
LOG
(
ERROR
)
<<
"No channel on protocol="
<<
sample
->
protocol_type
();
<<
sample
->
meta
.
protocol_type
();
continue
;
}
brpc
::
Controller
*
cntl
=
new
brpc
::
Controller
;
req
.
Clear
();
cntl
->
reset_
rpc_dump_meta
(
sample_guard
.
release
());
if
(
sample
->
attachment_size
()
>
0
)
{
cntl
->
reset_
sampled_request
(
sample_guard
.
release
());
if
(
sample
->
meta
.
attachment_size
()
>
0
)
{
sample
->
request
.
cutn
(
&
req
.
serialized_data
(),
sample
->
request
.
size
()
-
sample
->
attachment_size
());
sample
->
request
.
size
()
-
sample
->
meta
.
attachment_size
());
cntl
->
request_attachment
()
=
sample
->
request
.
movable
();
}
else
{
req
.
serialized_data
()
=
sample
->
request
.
movable
();
...
...
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