[GitHub] [incubator-brpc] kevinmgyu commented on issue #695: gflags(2.1.2-3),g++( 4:5.3.1-1ubuntu1) protobuf( 2.6.1-1.3) Linux make编译错误

2019-03-20 Thread GitBox
kevinmgyu commented on issue #695: gflags(2.1.2-3),g++( 4:5.3.1-1ubuntu1) 
protobuf( 2.6.1-1.3) Linux make编译错误
URL: https://github.com/apache/incubator-brpc/issues/695#issuecomment-475106478
 
 
   cmake编译也报类似错误
   [ 95%] Linking CXX executable ../output/bin/protoc-gen-mcpack
   /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information 
available (required by /usr/bin/cmake)
   ../output/lib/libbrpc.so: undefined reference to 
`google::SetCommandLineOption(char const*, char const*)'
   ../output/lib/libbrpc.so: undefined reference to 
`google::GetCommandLineOption(char const*, std::string*)'
   ../output/lib/libbrpc.so: undefined reference to 
`google::RegisterFlagValidator(std::string const*, bool (*)(char const*, 
std::string const&))'
   collect2: error: ld returned 1 exit status
   src/CMakeFiles/protoc-gen-mcpack.dir/build.make:103: recipe for target 
'output/bin/protoc-gen-mcpack' failed
   make[2]: *** [output/bin/protoc-gen-mcpack] Error 1
   CMakeFiles/Makefile2:245: recipe for target 
'src/CMakeFiles/protoc-gen-mcpack.dir/all' failed
   make[1]: *** [src/CMakeFiles/protoc-gen-mcpack.dir/all] Error 2
   Makefile:127: recipe for target 'all' failed
   make: *** [all] Error 2
   /
   但是静态库的符号表中可以查到这些函数,why?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] xuxiping opened a new issue #696: nameservice can't select server

2019-03-20 Thread GitBox
xuxiping opened a new issue #696: nameservice can't select server
URL: https://github.com/apache/incubator-brpc/issues/696
 
 
   **Describe the bug (描述bug)**
nameservice can't select server after modify system time.
   
   **To Reproduce (复现方法)**
modify system time.
   
   **Expected behavior (期望行为)**

   
   **Versions (各种版本)**
   OS:
   Compiler:
   brpc:
   protobuf:
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen removed a comment on issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen removed a comment on issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693#issuecomment-475089915
 
 
   oh,thank you very much,I misunderstand...


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen opened a new issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen opened a new issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693
 
 
   brpc have not similiar pthread_detach? thread_join() is blocked.
   I want to the current thread exit and free resource.
   for example,in my bthread function,at the end-line,I create a new bthread 
and join,the last join will be blocking...  
   
   oh,it's a while... 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen commented on issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen commented on issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693#issuecomment-475090132
 
 
   > bthreads are "detached" by default and joined or not-joined freely decided 
by users. You can perfectly start a bthread and leave it alone, and it will be 
ended and recycled when the entry function(passed to bthread_start) ends, where 
you can also release your resources. This is different from pthreads, which in 
my mind is more convenient.
   
   oh,thank you very much,I misunderstand...


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen commented on issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen commented on issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693#issuecomment-475089915
 
 
   oh,thank you very much,I misunderstand...


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen closed issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen closed issue #693: brpc have not similiar pthread_detach? 
thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267284976
 
 

 ##
 File path: src/brpc/socket.cpp
 ##
 @@ -1523,7 +1523,7 @@ int Socket::Write(butil::IOBuf* data, const 
WriteOptions* options_in) {
 if (options_in) {
 opt = *options_in;
 }
-if (data->empty()) {
+if (data->empty() && opt.with_auth == false) {
 
 Review comment:
   这里是指对bool的判断没必要用==


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] yanglimingcn commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
yanglimingcn commented on a change in pull request #692: Add Mysql Protocol, 
only support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267283363
 
 

 ##
 File path: src/brpc/socket.cpp
 ##
 @@ -1523,7 +1523,7 @@ int Socket::Write(butil::IOBuf* data, const 
WriteOptions* options_in) {
 if (options_in) {
 opt = *options_in;
 }
-if (data->empty()) {
+if (data->empty() && opt.with_auth == false) {
 
 Review comment:
   
因为mysql的鉴权是首先得先收一个消息,然后再发起鉴权,再发送正常请求,所以第一次write我需要把正常请求保存起来,这样我调用write传入的就是个空消息。


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] yanglimingcn commented on issue #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
yanglimingcn commented on issue #692: Add Mysql Protocol, only support text 
protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#issuecomment-474781405
 
 
   
mysql没有correlation_id机制,需要通过pipelined_count机制,但是如果一次执行10个命令,都执行成功了会有10个回复,如果有1个命令执行失败,那么后边的命令就不会有返回,返回的多个消息判断是否结束是靠is_multi的结果判断的。


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] yanglimingcn commented on issue #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
yanglimingcn commented on issue #692: Add Mysql Protocol, only support text 
protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#issuecomment-474778616
 
 
   
对,现在一个request里面可以写多个命令,用逗号分割,一个request对应一个response,response里面会有多个reply,每个reply对应一个命令的结果。现在的问题是连接在single模式下,多线程读取消息可能错乱。这个是需要修改的。如果以后要是支持事务和prepared
 statement的话,那么一个连接就需要被独占,因为这个连接需要支持事务的多次访问,这种情况下,我觉得不能使用单链接模式了。你看应该如何选择。


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
jamesge commented on issue #693: brpc have not similiar pthread_detach? 
thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693#issuecomment-474777255
 
 
   bthreads are "detached" by default and joined or not-joined freely decided 
by users. You can perfectly start a bthread and leave it alone, and it will be 
ended and recycled when the entry function(passed to bthread_start) ends, where 
you can also release your resources. This is different from pthreads, which in 
my mind is more convenient.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] zyearn commented on a change in pull request #694: Health check by rpc call

2019-03-20 Thread GitBox
zyearn commented on a change in pull request #694: Health check by rpc call
URL: https://github.com/apache/incubator-brpc/pull/694#discussion_r267273523
 
 

 ##
 File path: src/brpc/channel.cpp
 ##
 @@ -281,6 +281,15 @@ int Channel::Init(butil::EndPoint server_addr_and_port,
 return InitSingle(server_addr_and_port, "", options);
 }
 
+int Channel::Init(SocketId id, const ChannelOptions* options) {
 
 Review comment:
   TODO:这个接口暴露给用户有点怪怪的,有没有更好的workaround


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] zyearn opened a new pull request #694: Health check by rpc call

2019-03-20 Thread GitBox
zyearn opened a new pull request #694: Health check by rpc call
URL: https://github.com/apache/incubator-brpc/pull/694
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen commented on issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen commented on issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693#issuecomment-474771920
 
 
   @jamesge 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] DreamTeamWangbowen opened a new issue #693: brpc have not similiar pthread_detach? thread_join() is blocked

2019-03-20 Thread GitBox
DreamTeamWangbowen opened a new issue #693: brpc have not similiar 
pthread_detach? thread_join() is blocked 
URL: https://github.com/apache/incubator-brpc/issues/693
 
 
   brpc have not similiar pthread_detach? thread_join() is blocked.
   I want to the current thread exit and free resource.
   for example,in my bthread function,at the end-line,I create a new bthread 
and join,the last join will be blocking...  
   
   oh,it's a while... 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge edited a comment on issue #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge edited a comment on issue #692: Add Mysql Protocol, only support text 
protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#issuecomment-474713864
 
 
   这里的基本问题还是mysql中reply是怎么和command对上的, 
如果有id,那就是通过correlation_id机制;如果是靠server端保证对一个command一定会回一个reply(类似redis),那就要设置正确的pipelined_count。一个workaround是限制一次query只能包含一个command,要一个request带多个command,就调用多次query。pipelined_count等于command_count,


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge edited a comment on issue #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge edited a comment on issue #692: Add Mysql Protocol, only support text 
protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#issuecomment-474713864
 
 
   这里的基本问题还是mysql中reply是怎么和command对上的, 
如果有id,那就是通过correlation_id机制;如果是靠server端保证对一个command一定会回一个reply(类似redis),那就要设置正确的pipelined_count。一个workaround是限制一次query中只能包含一个command,pipelined_count就可以固定为1,要一个request带多个command,就调用多次query。


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267206377
 
 

 ##
 File path: src/brpc/mysql.cpp
 ##
 @@ -0,0 +1,508 @@
+// Copyright (c) 2019 Baidu, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Authors: Yang,Liming (yanglimin...@baidu.com)
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "butil/string_printf.h"
+#include "butil/macros.h"
+#include "brpc/controller.h"
+#include "brpc/mysql.h"
+#include "brpc/mysql_command.h"
+#include "brpc/mysql_reply.h"
+
+namespace brpc {
+
+DEFINE_int32(mysql_max_replies, 50, "maximum replies size in one 
MysqlResponse");
+DEFINE_bool(mysql_verbose_crlf2space, false, "[DEBUG] Show \\r\\n as a space");
+
+// Internal implementation detail -- do not call these.
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl();
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+void protobuf_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+void protobuf_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto();
+
+namespace {
+
+const ::google::protobuf::Descriptor* MysqlRequest_descriptor_ = NULL;
+const ::google::protobuf::Descriptor* MysqlResponse_descriptor_ = NULL;
+
+}  // namespace
+
+void protobuf_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto() {
+protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+const ::google::protobuf::FileDescriptor* file =
+::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+"baidu/rpc/mysql_base.proto");
+GOOGLE_CHECK(file != NULL);
+MysqlRequest_descriptor_ = file->message_type(0);
+MysqlResponse_descriptor_ = file->message_type(1);
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+::google::protobuf::GoogleOnceInit(_AssignDescriptors_once_,
+   
_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+protobuf_AssignDescriptorsOnce();
+::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+MysqlRequest_descriptor_, ::default_instance());
+::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+MysqlResponse_descriptor_, ::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto() {
+delete MysqlRequest::default_instance_;
+delete MysqlResponse::default_instance_;
+}
+
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl() {
+GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#if GOOGLE_PROTOBUF_VERSION >= 3002000
+::google::protobuf::internal::InitProtobufDefaults();
+#else
+
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+#endif
+::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+"\n\032baidu/rpc/mysql_base.proto\022\tbaidu.rpc\032"
+" google/protobuf/descriptor.proto\"\016\n\014Mys"
+"qlRequest\"\017\n\rMysqlResponseB\003\200\001\001",
+111);
+
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile("baidu/rpc/mysql_base.proto",
+  
_RegisterTypes);
+MysqlRequest::default_instance_ = new MysqlRequest();
+MysqlResponse::default_instance_ = new MysqlResponse();
+MysqlRequest::default_instance_->InitAsDefaultInstance();
+MysqlResponse::default_instance_->InitAsDefaultInstance();
+::google::protobuf::internal::OnShutdown(
+_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto);
+}
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_once);
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto() {
+
::google::protobuf::GoogleOnceInit(_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_once,
+   
_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_baidu_2frpc_2fmysql_5fbase_2eproto {
+StaticDescriptorInitializer_baidu_2frpc_2fmysql_5fbase_2eproto() {
+protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+}
+} 

[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267203881
 
 

 ##
 File path: src/brpc/mysql.h
 ##
 @@ -0,0 +1,187 @@
+// Copyright (c) 2019 Baidu, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Authors: Yang,Liming (yanglimin...@baidu.com)
+
+#ifndef BRPC_MYSQL_H
+#define BRPC_MYSQL_H
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include "google/protobuf/descriptor.pb.h"
+
+#include "butil/iobuf.h"
+#include "butil/strings/string_piece.h"
+#include "butil/arena.h"
+#include "brpc/mysql_reply.h"
+
+namespace brpc {
+// Request to mysql.
+// Notice that you can pipeline multiple commands in one request and sent
+// them to ONE mysql-server together.
+// Example:
+//   MysqlRequest request;
+//   request.Query("select * from table");
+//   MysqlResponse response;
+//   channel.CallMethod(NULL, , , , NULL/*done*/);
+//   if (!cntl.Failed()) {
+//   LOG(INFO) << response.reply(0);
+//   }
+class MysqlRequest : public ::google::protobuf::Message {
+public:
+MysqlRequest();
+virtual ~MysqlRequest();
+MysqlRequest(const MysqlRequest& from);
+inline MysqlRequest& operator=(const MysqlRequest& from) {
+CopyFrom(from);
+return *this;
+}
+void Swap(MysqlRequest* other);
+
+// Serialize the request into `buf'. Return true on success.
+bool SerializeTo(butil::IOBuf* buf) const;
+
+// Protobuf methods.
+MysqlRequest* New() const;
+void CopyFrom(const ::google::protobuf::Message& from);
+void MergeFrom(const ::google::protobuf::Message& from);
+void CopyFrom(const MysqlRequest& from);
+void MergeFrom(const MysqlRequest& from);
+void Clear();
+
+int ByteSize() const;
+bool MergePartialFromCodedStream(::google::protobuf::io::CodedInputStream* 
input);
+void SerializeWithCachedSizes(::google::protobuf::io::CodedOutputStream* 
output) const;
+::google::protobuf::uint8* SerializeWithCachedSizesToArray(
+::google::protobuf::uint8* output) const;
+int GetCachedSize() const {
+return _cached_size_;
+}
+
+static const ::google::protobuf::Descriptor* descriptor();
+static const MysqlRequest& default_instance();
+::google::protobuf::Metadata GetMetadata() const;
+
+bool Query(const std::string& stmt);
+bool Query(const char* stmt);
 
 Review comment:
   参数也可以统一成StringPiece了?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267205848
 
 

 ##
 File path: src/brpc/mysql_command.cpp
 ##
 @@ -0,0 +1,45 @@
+// Copyright (c) 2015 Baidu, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Authors: Ge,Jun (ge...@baidu.com)
+
+#include "brpc/mysql_command.h"
+#include "butil/sys_byteorder.h"
+#include "butil/logging.h"  // LOG()
+
+namespace {
+const uint32_t max_package_size = 0xFF;
+};
+namespace brpc {
+butil::Status MysqlMakeCommand(butil::IOBuf* outbuf,
 
 Review comment:
   建议不要clear outbuf并改名AppendMySQLCommand,在外部clear更加灵活。


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267203582
 
 

 ##
 File path: src/brpc/socket.cpp
 ##
 @@ -1523,7 +1523,7 @@ int Socket::Write(butil::IOBuf* data, const 
WriteOptions* options_in) {
 if (options_in) {
 opt = *options_in;
 }
-if (data->empty()) {
+if (data->empty() && opt.with_auth == false) {
 
 Review comment:
   !opt.with_auth


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



[GitHub] [incubator-brpc] jamesge commented on a change in pull request #692: Add Mysql Protocol, only support text protocol now, not support trans…

2019-03-20 Thread GitBox
jamesge commented on a change in pull request #692: Add Mysql Protocol, only 
support text protocol now, not support trans…
URL: https://github.com/apache/incubator-brpc/pull/692#discussion_r267204181
 
 

 ##
 File path: src/brpc/mysql.cpp
 ##
 @@ -0,0 +1,508 @@
+// Copyright (c) 2019 Baidu, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Authors: Yang,Liming (yanglimin...@baidu.com)
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "butil/string_printf.h"
+#include "butil/macros.h"
+#include "brpc/controller.h"
+#include "brpc/mysql.h"
+#include "brpc/mysql_command.h"
+#include "brpc/mysql_reply.h"
+
+namespace brpc {
+
+DEFINE_int32(mysql_max_replies, 50, "maximum replies size in one 
MysqlResponse");
+DEFINE_bool(mysql_verbose_crlf2space, false, "[DEBUG] Show \\r\\n as a space");
+
+// Internal implementation detail -- do not call these.
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl();
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+void protobuf_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+void protobuf_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto();
+
+namespace {
+
+const ::google::protobuf::Descriptor* MysqlRequest_descriptor_ = NULL;
+const ::google::protobuf::Descriptor* MysqlResponse_descriptor_ = NULL;
+
+}  // namespace
+
+void protobuf_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto() {
+protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+const ::google::protobuf::FileDescriptor* file =
+::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+"baidu/rpc/mysql_base.proto");
+GOOGLE_CHECK(file != NULL);
+MysqlRequest_descriptor_ = file->message_type(0);
+MysqlResponse_descriptor_ = file->message_type(1);
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+::google::protobuf::GoogleOnceInit(_AssignDescriptors_once_,
+   
_AssignDesc_baidu_2frpc_2fmysql_5fbase_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+protobuf_AssignDescriptorsOnce();
+::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+MysqlRequest_descriptor_, ::default_instance());
+::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+MysqlResponse_descriptor_, ::default_instance());
+}
+
+}  // namespace
+
+void protobuf_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto() {
+delete MysqlRequest::default_instance_;
+delete MysqlResponse::default_instance_;
+}
+
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl() {
+GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+#if GOOGLE_PROTOBUF_VERSION >= 3002000
+::google::protobuf::internal::InitProtobufDefaults();
+#else
+
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+#endif
+::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+"\n\032baidu/rpc/mysql_base.proto\022\tbaidu.rpc\032"
+" google/protobuf/descriptor.proto\"\016\n\014Mys"
+"qlRequest\"\017\n\rMysqlResponseB\003\200\001\001",
+111);
+
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile("baidu/rpc/mysql_base.proto",
+  
_RegisterTypes);
+MysqlRequest::default_instance_ = new MysqlRequest();
+MysqlResponse::default_instance_ = new MysqlResponse();
+MysqlRequest::default_instance_->InitAsDefaultInstance();
+MysqlResponse::default_instance_->InitAsDefaultInstance();
+::google::protobuf::internal::OnShutdown(
+_ShutdownFile_baidu_2frpc_2fmysql_5fbase_2eproto);
+}
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_once);
+void protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto() {
+
::google::protobuf::GoogleOnceInit(_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_once,
+   
_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto_impl);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_baidu_2frpc_2fmysql_5fbase_2eproto {
+StaticDescriptorInitializer_baidu_2frpc_2fmysql_5fbase_2eproto() {
+protobuf_AddDesc_baidu_2frpc_2fmysql_5fbase_2eproto();
+}
+}