From 08f6c5353507cd4abdeb141207de2655122c73cb Mon Sep 17 00:00:00 2001 From: taohe Date: Wed, 2 Aug 2017 14:42:21 +0800 Subject: [PATCH 01/17] update sub modules --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index e6ef001..f8b13a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,12 @@ [submodule "third_party/colib"] path = third_party/colib - url = https://github.com/tencent-wechat/libco + url = https://github.com/Tencent/libco [submodule "third_party/phxrpc"] path = third_party/phxrpc - url = https://github.com/tencent-wechat/phxrpc + url = https://github.com/Tencent/phxrpc [submodule "third_party/phxpaxos"] path = third_party/phxpaxos - url = https://github.com/tencent-wechat/phxpaxos + url = https://github.com/Tencent/phxpaxos [submodule "third_party/leveldb"] path = third_party/leveldb url = https://github.com/google/leveldb From 6e4749137b497ef76e0b749ba2146162f6f3fd14 Mon Sep 17 00:00:00 2001 From: taohe Date: Wed, 2 Aug 2017 15:45:36 +0800 Subject: [PATCH 02/17] fix sub modules --- .gitmodules | 18 +++++++++--------- third_party/colib | 2 +- third_party/phxpaxos | 2 +- third_party/phxrpc | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitmodules b/.gitmodules index f8b13a8..8a0170e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,3 @@ -[submodule "third_party/colib"] - path = third_party/colib - url = https://github.com/Tencent/libco -[submodule "third_party/phxrpc"] - path = third_party/phxrpc - url = https://github.com/Tencent/phxrpc -[submodule "third_party/phxpaxos"] - path = third_party/phxpaxos - url = https://github.com/Tencent/phxpaxos [submodule "third_party/leveldb"] path = third_party/leveldb url = https://github.com/google/leveldb @@ -16,3 +7,12 @@ [submodule "third_party/glog"] path = third_party/glog url = https://github.com/google/glog +[submodule "third_party/colib"] + path = third_party/colib + url = https://github.com/Tencent/libco +[submodule "third_party/phxpaxos"] + path = third_party/phxpaxos + url = https://github.com/Tencent/phxpaxos +[submodule "third_party/phxrpc"] + path = third_party/phxrpc + url = https://github.com/Tencent/phxrpc diff --git a/third_party/colib b/third_party/colib index 44c4ae9..7e8d001 160000 --- a/third_party/colib +++ b/third_party/colib @@ -1 +1 @@ -Subproject commit 44c4ae9d059f72d051fe25b032b554016c896080 +Subproject commit 7e8d001a250018cff859db5f6f4a6edf4a38bc24 diff --git a/third_party/phxpaxos b/third_party/phxpaxos index f851064..0d57dd5 160000 --- a/third_party/phxpaxos +++ b/third_party/phxpaxos @@ -1 +1 @@ -Subproject commit f851064bb23192b2f6f866de091799580fa5b086 +Subproject commit 0d57dd5a9d29c91c134891948019f05d0fb1aeca diff --git a/third_party/phxrpc b/third_party/phxrpc index 1e7914e..05bebb9 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit 1e7914eeca71551446c978a43b1d4240ec40b1dc +Subproject commit 05bebb99a627862c009c0ee2bb78a3869c77b97f From 8b413178293ed097ff05910e119795ada05914cf Mon Sep 17 00:00:00 2001 From: taohe Date: Wed, 2 Aug 2017 16:10:37 +0800 Subject: [PATCH 03/17] update readme --- README.md | 12 ++++++------ README.zh_cn.md | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 64b7b48..a78635a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[简体中文README](https://github.com/tencent-wechat/phxsql/blob/master/README.zh_cn.md) +[简体中文README](https://github.com/Tencent/phxsql/blob/master/README.zh_cn.md) **PhxSQL is a high-availability and strong-consistency MySQL cluster built on Paxos and Percona.** @@ -6,7 +6,7 @@ Authors: Junchao Chen, Haochuan Cui, Duokai Huang, Ming Chen and Sifan Liu Contact us: phxteam@tencent.com -[![Build Status](https://travis-ci.org/tencent-wechat/phxsql.svg?branch=master)](https://travis-ci.org/tencent-wechat/phxsql) +[![Build Status](https://travis-ci.org/Tencent/phxsql.svg?branch=master)](https://travis-ci.org/Tencent/phxsql) #PhxSQL features: - high availability by automatic failovers: the cluster works well when more than half of cluster nodes work and are interconnected. @@ -21,14 +21,14 @@ This project includes * Third party submodules * Pre-compiled binaries for Ubuntu 64bit system. -Projects on which this project depends are also published by tencent-wechat( phxpaxos, phxrpc, libco ). +Projects on which this project depends are also published by Tencent( phxpaxos, phxrpc, libco ). You can download or clone them with --recurse-submodule. -**phxpaxos:** [http://github.com/tencent-wechat/phxpaxos](http://github.com/tencent-wechat/phxpaxos "http://github.com/tencent-wechat/phxpaxos") +**phxpaxos:** [http://github.com/Tencent/phxpaxos](http://github.com/Tencent/phxpaxos "http://github.com/Tencent/phxpaxos") -**phxrpc:** [http://github.com/tencent-wechat/phxrpc](http://github.com/tencent-wechat/phxrpc "http://github.com/tencent-wechat/phxrpc") +**phxrpc:** [http://github.com/Tencent/phxrpc](http://github.com/Tencent/phxrpc "http://github.com/Tencent/phxrpc") -**libco:** [http://github.com/tencent-wechat/libco](http://github.com/tencent-wechat/libco "http://github.com/tencent-wechat/libco") +**libco:** [http://github.com/Tencent/libco](http://github.com/Tencent/libco "http://github.com/Tencent/libco") # Compilation of PhxSQL diff --git a/README.zh_cn.md b/README.zh_cn.md index 46cb865..031adcf 100644 --- a/README.zh_cn.md +++ b/README.zh_cn.md @@ -6,7 +6,7 @@ 联系我们:phxteam@tencent.com -想了解更多, 以及更详细的编译手册,请进入[中文WIKI](https://github.com/tencent-wechat/phxsql/wiki),和扫描右侧二维码关注我们的公众号 +想了解更多, 以及更详细的编译手册,请进入[中文WIKI](https://github.com/Tencent/phxsql/wiki),和扫描右侧二维码关注我们的公众号 方案说明:[微信开源PhxSQL:高可用、强一致的MySQL集群](http://mp.weixin.qq.com/s?__biz=MzI4NDMyNTU2Mw==&mid=2247483783&idx=1&sn=a2d6e589f1f591ded7703eb74aefccbe&scene=0#wechat_redirect) @@ -22,11 +22,11 @@ PhxSQL设计和实现哲学:[上篇](https://zhuanlan.zhihu.com/p/22345242), 项目中包含PhxSQL源代码,源代码编译时所需要的一些第三方库,及可直接在Linux环境下运行的二进制包。其中代码使用到了微信团队自研的另外三个开源项目(phxpaxos,phxrpc,colib)。若需编译源代码,需额外下载,也可以在clone时通过--recurse-submodule获得代码。 -**phxpaxos项目地址:** [http://github.com/tencent-wechat/phxpaxos](http://github.com/tencent-wechat/phxpaxos "http://github.com/tencent-wechat/phxpaxos") +**phxpaxos项目地址:** [http://github.com/Tencent/phxpaxos](http://github.com/Tencent/phxpaxos "http://github.com/Tencent/phxpaxos") -**phxrpc项目地址:** [http://github.com/tencent-wechat/phxrpc](http://github.com/tencent-wechat/phxrpc "http://github.com/tencent-wechat/phxrpc") +**phxrpc项目地址:** [http://github.com/Tencent/phxrpc](http://github.com/Tencent/phxrpc "http://github.com/Tencent/phxrpc") -**colib项目地址:** [http://github.com/tencent-wechat/libco](http://github.com/tencent-wechat/libco "http://github.com/tencent-wechat/libco") +**colib项目地址:** [http://github.com/Tencent/libco](http://github.com/Tencent/libco "http://github.com/Tencent/libco") # PhxSQL编译 @@ -88,7 +88,7 @@ PhxSQL需要用到一些第三方库(glog, leveldb, protobuf, phxpaxos, colib, 2. 若想打包二进制运行包(集群运行时所需要的所有文件和配置)`make package` 3. `install`完成后,二进制会生成到`PhxSQL`目录下的`sbin`目录,运行所需要的相关文件和配置会安装到PhxSQL目录下的`install_package`目录。打包二进制运行包会把`install_package`进行tar格式的打包,并生成`phxsql.tar.gz`。若想更改`install`的安装目录,可在`sh autoinstall.sh` 后加入`-prefix=`路径 -> 详细的编译步骤请参阅WIKI [中文编译手册](https://github.com/tencent-wechat/phxsql/wiki/%E4%B8%AD%E6%96%87%E8%AF%A6%E7%BB%86%E7%BC%96%E8%AF%91%E6%89%8B%E5%86%8C) +> 详细的编译步骤请参阅WIKI [中文编译手册](https://github.com/Tencent/phxsql/wiki/%E4%B8%AD%E6%96%87%E8%AF%A6%E7%BB%86%E7%BC%96%E8%AF%91%E6%89%8B%E5%86%8C) # PhxSQL部署和运行 From c64002ede0cd2886d5e56a6571cfb5038e83469f Mon Sep 17 00:00:00 2001 From: liusifan Date: Thu, 16 Nov 2017 18:29:07 +0800 Subject: [PATCH 04/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a78635a..3e0305a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Contact us: phxteam@tencent.com #PhxSQL features: - high availability by automatic failovers: the cluster works well when more than half of cluster nodes work and are interconnected. - guarantee of data consistency among cluster nodes: replacing loss-less semi-sync between MySQL master and MySQL slaves with Paxos, PhxSQL ensures zero-loss binlogs between master and slaves and supports linearizable consistency, which is as strong as that of Zookeeper. - - complete compliance with MySQL for and MySQL client: PhxSQL supports up to serializable isolation level of transaction. + - complete compliance with MySQL and MySQL client: PhxSQL supports up to serializable isolation level of transaction. - easy deployment and easy maintenance: PhxSQL, powered by in-house implementation of Paxos, has only 4 components including MySQL and doesn't depend on zookeeper or etcd for anything. PhxSql supports automated cluster membership hot reconfiguration. From a1a8b416c75416b890de29d555fef4b6209957f1 Mon Sep 17 00:00:00 2001 From: taohe Date: Fri, 8 Dec 2017 15:19:14 +0800 Subject: [PATCH 05/17] fix phxrpc --- .../framework/phxrpc/svr/phxbinlog_server.cpp | 22 ++++++----- .../framework/phxrpc/svr/phxbinlog_server.h | 39 ++++++++++++++----- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp index 76b14ab..e81ccec 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -92,7 +92,7 @@ void Server::Run() { ServiceArgs_t service_args; service_args.svr_handler_ = GetSvrHandler(); - phxrpc::HshaServer server(config_->GetServerConfig(), Server::HttpDispatch, &service_args); + phxrpc::HshaServer server(config_->GetServerConfig(), Server::Dispatch, &service_args); server.RunForever(); @@ -107,16 +107,18 @@ PhxBinLogSvrHandler *Server::GetSvrHandler() { return svr_handler_; } -void Server::HttpDispatch(const phxrpc::HttpRequest & request, phxrpc::HttpResponse * response, - phxrpc::DispatcherArgs_t * args) { - ServiceArgs_t * service_args = (ServiceArgs_t *) (args->service_args); +void Server::Dispatch(const phxrpc::BaseRequest *const request, + phxrpc::BaseResponse *const response, + phxrpc::DispatcherArgs_t *args) { + ServiceArgs_t *service_args = (ServiceArgs_t *)(args->service_args); PhxbinlogServiceImpl service(service_args); PhxbinlogDispatcher dispatcher(service, args); - phxrpc::HttpDispatcher < PhxbinlogDispatcher > http_dispatcher(dispatcher, PhxbinlogDispatcher::GetURIFuncMap()); - if (!http_dispatcher.Dispatch(request, response)) { - response->SetStatusCode(404); - response->SetReasonPhrase("Not Found"); + phxrpc::BaseDispatcher + base_dispatcher(dispatcher, PhxbinlogDispatcher::GetMqttFuncMap(), + PhxbinlogDispatcher::GetURIFuncMap()); + if (!base_dispatcher.Dispatch(request, response)) { + response->DispatchErr(); } } diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h index 1148ea0..f7c4cd8 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -13,29 +13,46 @@ #include #include "phxrpc/rpc.h" + namespace phxbinlog { + + class Option; + + } + namespace phxbinlogsvr { + + class PhxBinLogSvrHandler; class PhxBinLogClientFactoryInterface; + + } + namespace phxrpc { + + class BaseTcpStream; -class HttpRequest; -class HttpResponse; +class BaseRequest; +class BaseResponse; + + } + class PhxbinlogServerConfig; + class Server { - public: + public: Server(); virtual ~Server(); void Run(); - private: + private: virtual void InitMonitor(); virtual phxbinlogsvr::PhxBinLogClientFactoryInterface * GetPhxBinLogClientFactory(); void InitConfig(); @@ -46,17 +63,19 @@ class Server { PhxbinlogServerConfig *GetServerConfig(); phxbinlogsvr::PhxBinLogSvrHandler *GetSvrHandler(); - static void HttpDispatch(const phxrpc::HttpRequest & request, phxrpc::HttpResponse * response, - phxrpc::DispatcherArgs_t * args); + static void Dispatch(const phxrpc::BaseRequest *const request, + phxrpc::BaseResponse *const response, + phxrpc::DispatcherArgs_t *args); - protected: + protected: typedef void (*OpenLogFunc)(const char *, const int &log_level, const char * log_path, const uint32_t &log_file_max_size); typedef void (*LogFunc)(int log_level, const char *format, va_list args); void InitLog(LogFunc log_func, OpenLogFunc openlog_func); - protected: + PhxbinlogServerConfig *config_; phxbinlogsvr::PhxBinLogSvrHandler *svr_handler_; phxbinlog::Option *phxbin_option_; }; + From ef8e6213bd82af9cf1a9720ad03640857562df77 Mon Sep 17 00:00:00 2001 From: taohe Date: Fri, 8 Dec 2017 18:16:33 +0800 Subject: [PATCH 06/17] fix phxrpc --- .../framework/phxrpc/svr/phxbinlog_service_impl.cpp | 6 +++--- phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.h | 6 +++--- phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.cpp | 6 +++--- phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.h | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.cpp b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.cpp index e7fc23f..f716c8f 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.cpp +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.cpp @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -23,7 +23,7 @@ PhxbinlogServiceImpl::PhxbinlogServiceImpl(ServiceArgs_t * service_args) : PhxbinlogServiceImpl::~PhxbinlogServiceImpl() { } -int PhxbinlogServiceImpl::PHXEcho(const google::protobuf::StringValue &req, google::protobuf::StringValue *resp) { +int PhxbinlogServiceImpl::PhxEcho(const google::protobuf::StringValue &req, google::protobuf::StringValue *resp) { resp->set_value(req.value()); return 0; } diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.h b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.h index 7698abb..3de6009 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.h +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_service_impl.h @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -28,7 +28,7 @@ class PhxbinlogServiceImpl : public PhxbinlogService { PhxbinlogServiceImpl(ServiceArgs_t * service_args); virtual ~PhxbinlogServiceImpl(); - virtual int PHXEcho(const google::protobuf::StringValue & req, google::protobuf::StringValue *resp); + virtual int PhxEcho(const google::protobuf::StringValue & req, google::protobuf::StringValue *resp); virtual int SendBinLog(const google::protobuf::BytesValue & req, google::protobuf::Empty *resp); diff --git a/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.cpp b/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.cpp index 91521a0..a54f4e3 100644 --- a/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.cpp +++ b/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.cpp @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -29,7 +29,7 @@ PhxbinlogToolImpl::PhxbinlogToolImpl() { PhxbinlogToolImpl::~PhxbinlogToolImpl() { } -int PhxbinlogToolImpl::PHXEcho(phxrpc::OptMap & optMap) { +int PhxbinlogToolImpl::PhxEcho(phxrpc::OptMap & optMap) { google::protobuf::StringValue req; google::protobuf::StringValue resp; diff --git a/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.h b/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.h index 7d691f2..c6bfaa3 100644 --- a/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.h +++ b/phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_impl.h @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -24,7 +24,7 @@ class PhxbinlogToolImpl : public PhxbinlogTool { PhxbinlogToolImpl(); virtual ~PhxbinlogToolImpl(); - virtual int PHXEcho(phxrpc::OptMap & opt_map); + virtual int PhxEcho(phxrpc::OptMap & opt_map); virtual int SendBinLog(phxrpc::OptMap & opt_map); From e56f433324af66b6f0044d88b513320f297a4055 Mon Sep 17 00:00:00 2001 From: taohe Date: Sat, 9 Dec 2017 15:43:52 +0800 Subject: [PATCH 07/17] fix phxrpc --- third_party/phxrpc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/phxrpc b/third_party/phxrpc index 05bebb9..a1b7ce5 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit 05bebb99a627862c009c0ee2bb78a3869c77b97f +Subproject commit a1b7ce5c5ae633bac3d9df85ee874a1e8a82d353 From 70634f1972602183fd74b2b1968bdebc40bfa785 Mon Sep 17 00:00:00 2001 From: taohe Date: Tue, 27 Feb 2018 18:08:59 +0800 Subject: [PATCH 08/17] add log --- phxbinlogsvr/core/paxos/event_executer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phxbinlogsvr/core/paxos/event_executer.cpp b/phxbinlogsvr/core/paxos/event_executer.cpp index e68a011..88b8fa1 100644 --- a/phxbinlogsvr/core/paxos/event_executer.cpp +++ b/phxbinlogsvr/core/paxos/event_executer.cpp @@ -99,9 +99,9 @@ int EventExecuter::SMExecute(const uint64_t &instance_id, const string &paxos_va return ret; } - //LogVerbose("%s current gtid %s event gtid %s sm gtid %s old checksum %llu run %u ms", __func__, - // data.current_gtid().c_str(), data.event_gtid().c_str(), newest_gtid.c_str(), old_checksum, - // timer.GetTime() / 1000); + LogVerbose("%s current gtid %s event gtid %s sm gtid %s old checksum %llu run %u ms", __func__, + data.current_gtid().c_str(), data.event_gtid().c_str(), newest_gtid.c_str(), old_checksum, + timer.GetTime() / 1000); uint64_t new_checksum = Utils::GetCheckSum(old_checksum, data.buffer().c_str(), data.buffer().size()); if (new_checksum != data.checksum()) { From c915dadf5f68e332f8bdf5af902f1d6a2f7da681 Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Wed, 30 May 2018 11:29:32 +0800 Subject: [PATCH 09/17] fix phxrpc --- .../framework/phxrpc/svr/phxbinlog_server.cpp | 14 +++++++------- .../framework/phxrpc/svr/phxbinlog_server.h | 4 ++-- third_party/phxrpc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp index e81ccec..e8ded0f 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.cpp @@ -107,18 +107,18 @@ PhxBinLogSvrHandler *Server::GetSvrHandler() { return svr_handler_; } -void Server::Dispatch(const phxrpc::BaseRequest *const request, - phxrpc::BaseResponse *const response, +void Server::Dispatch(const phxrpc::HttpRequest &req, + phxrpc::HttpResponse *const resp, phxrpc::DispatcherArgs_t *args) { ServiceArgs_t *service_args = (ServiceArgs_t *)(args->service_args); PhxbinlogServiceImpl service(service_args); PhxbinlogDispatcher dispatcher(service, args); - phxrpc::BaseDispatcher - base_dispatcher(dispatcher, PhxbinlogDispatcher::GetMqttFuncMap(), - PhxbinlogDispatcher::GetURIFuncMap()); - if (!base_dispatcher.Dispatch(request, response)) { - response->DispatchErr(); + phxrpc::HttpDispatcher + base_dispatcher(dispatcher, PhxbinlogDispatcher::GetURIFuncMap()); + if (!base_dispatcher.Dispatch(req, resp)) { + resp->SetStatusCode(404); + resp->SetReasonPhrase("Not Found"); } } diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h index f7c4cd8..01d7dbf 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h @@ -63,8 +63,8 @@ class Server { PhxbinlogServerConfig *GetServerConfig(); phxbinlogsvr::PhxBinLogSvrHandler *GetSvrHandler(); - static void Dispatch(const phxrpc::BaseRequest *const request, - phxrpc::BaseResponse *const response, + static void Dispatch(const phxrpc::HttpRequest &req, + phxrpc::HttpResponse *const resp, phxrpc::DispatcherArgs_t *args); protected: diff --git a/third_party/phxrpc b/third_party/phxrpc index a1b7ce5..78aaf98 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit a1b7ce5c5ae633bac3d9df85ee874a1e8a82d353 +Subproject commit 78aaf98cb5582235b8555c4d17c520509c54b510 From 2ac92f9cf170756c9c33d7462bb40626e87fb75b Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Sat, 2 Jun 2018 00:20:00 +0800 Subject: [PATCH 10/17] update travis --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2ff64c1..1416b09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,7 @@ script: - docker build -t phxsql/phxsql:latest . && ./test-with-docker.sh notifications: email: true +branches: + only: + - /.*/ + From eb3f4f6f352e1efc486941d11d5b0d74d77d3d0e Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Sat, 2 Jun 2018 00:31:37 +0800 Subject: [PATCH 11/17] fix third party --- .gitmodules | 21 ++++++++++++--------- third_party/gflags | 1 + third_party/glog | 2 +- third_party/leveldb | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) create mode 160000 third_party/gflags diff --git a/.gitmodules b/.gitmodules index 8a0170e..ab607f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,3 @@ -[submodule "third_party/leveldb"] - path = third_party/leveldb - url = https://github.com/google/leveldb -[submodule "third_party/protobuf"] - path = third_party/protobuf - url = https://github.com/google/protobuf -[submodule "third_party/glog"] - path = third_party/glog - url = https://github.com/google/glog [submodule "third_party/colib"] path = third_party/colib url = https://github.com/Tencent/libco @@ -16,3 +7,15 @@ [submodule "third_party/phxrpc"] path = third_party/phxrpc url = https://github.com/Tencent/phxrpc +[submodule "third_party/gflags"] + path = third_party/gflags + url = https://github.com/gflags/gflags +[submodule "third_party/glog"] + path = third_party/glog + url = https://github.com/google/glog +[submodule "third_party/protobuf"] + path = third_party/protobuf + url = https://github.com/google/protobuf +[submodule "third_party/leveldb"] + path = third_party/leveldb + url = https://github.com/google/leveldb diff --git a/third_party/gflags b/third_party/gflags new file mode 160000 index 0000000..46f73f8 --- /dev/null +++ b/third_party/gflags @@ -0,0 +1 @@ +Subproject commit 46f73f88b18aee341538c0dfc22b1710a6abedef diff --git a/third_party/glog b/third_party/glog index 0b0b022..a6a166d 160000 --- a/third_party/glog +++ b/third_party/glog @@ -1 +1 @@ -Subproject commit 0b0b022be1c9c9139955af578fe477529d4b7b3c +Subproject commit a6a166db069520dbbd653c97c2e5b12e08a8bb26 diff --git a/third_party/leveldb b/third_party/leveldb index 3080a45..a53934a 160000 --- a/third_party/leveldb +++ b/third_party/leveldb @@ -1 +1 @@ -Subproject commit 3080a45b626f8ddb474bc5e860796a48b51b3cf0 +Subproject commit a53934a3ae1244679f812d998a4f16f2c7f309a6 From ec3f562965ce04b18e3f973f8b3114fd6767e22f Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Sun, 3 Jun 2018 16:52:30 +0800 Subject: [PATCH 12/17] fix gflags --- third_party/autoinstall.sh | 42 ++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/third_party/autoinstall.sh b/third_party/autoinstall.sh index 59998da..d62586b 100755 --- a/third_party/autoinstall.sh +++ b/third_party/autoinstall.sh @@ -16,7 +16,7 @@ function go_back() cd $current_path; } -function check_dir_exist() +function check_dir_exist() { dir_path=$current_path"/$1"; if [ ! -d $dir_path ]; then @@ -25,7 +25,7 @@ function check_dir_exist() fi } -function check_file_exist() +function check_file_exist() { if [ ! -f $1 ]; then return 1; @@ -145,7 +145,40 @@ function install_glog() go_back; cd $lib_name; - ./configure CXXFLAGS=-fPIC --prefix=$(pwd); + ./autogen.sh + exist_gflags_dir="../gflags"; + if [ -d $exist_gflags_dir ]; then + # use local gflags + ./configure CXXFLAGS=-fPIC --prefix=$(pwd) --with-gflags=$(pwd)/gflags; + else + # use system gflags + ./configure CXXFLAGS=-fPIC --prefix=$(pwd); + fi + make && make install; + + check_lib_exist $lib_name; + if [ $? -eq 1 ]; then + perror "$lib_name install fail. please check compile error info." + exit 1; + fi + psucc "install $lib_name ok." +} + +function install_gflags() +{ + lib_name="gflags"; + check_dir_exist $lib_name; + + # check if aready install. + check_lib_exist $lib_name; + if [ $? -eq 0 ]; then + psucc "$lib_name already installed." + return; + fi + # end check. + go_back; + cd $lib_name; + cmake . -DCMAKE_INSTALL_PREFIX=$(pwd); make && make install; check_lib_exist $lib_name; @@ -257,9 +290,10 @@ function install_phxrpc() psucc "install $lib_name ok." } +install_gflags; +install_glog; install_leveldb; install_protobuf; -install_glog; install_colib; install_phxpaxos; install_phxrpc; From 269f78de34b1285c93b4794e81b33340185772b2 Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Wed, 6 Jun 2018 14:55:23 +0800 Subject: [PATCH 13/17] fix gflags --- .gitmodules | 12 ++++++------ makefile.mk | 12 +++++++----- .../plugin/phxsync_phxrpc/CMakeLists.txt | 11 ++++++----- phxcomm/log/phxglog/Makefile.define | 16 ++++++++-------- third_party/autoinstall.sh | 9 +++++---- third_party/phxpaxos | 2 +- third_party/phxrpc | 2 +- tools/check_install.py | 18 +++++++++--------- 8 files changed, 43 insertions(+), 39 deletions(-) diff --git a/.gitmodules b/.gitmodules index ab607f2..bd9fde5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,6 @@ [submodule "third_party/colib"] path = third_party/colib url = https://github.com/Tencent/libco -[submodule "third_party/phxpaxos"] - path = third_party/phxpaxos - url = https://github.com/Tencent/phxpaxos -[submodule "third_party/phxrpc"] - path = third_party/phxrpc - url = https://github.com/Tencent/phxrpc [submodule "third_party/gflags"] path = third_party/gflags url = https://github.com/gflags/gflags @@ -19,3 +13,9 @@ [submodule "third_party/leveldb"] path = third_party/leveldb url = https://github.com/google/leveldb +[submodule "third_party/phxrpc"] + path = third_party/phxrpc + url = https://github.com/Tencent/phxrpc +[submodule "third_party/phxpaxos"] + path = third_party/phxpaxos + url = https://github.com/Tencent/phxpaxos diff --git a/makefile.mk b/makefile.mk index c9c3251..8b3e36c 100644 --- a/makefile.mk +++ b/makefile.mk @@ -11,6 +11,7 @@ NANOPBPATH=$(SRC_BASE_PATH)/third_party/nanopb/ PROTOBUF_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/protobuf/include LEVELDB_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/leveldb/include +GFLAGS_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/gflags/include GLOG_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/glog/include PHXPAXOS_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/phxpaxos/include PHXPAXOS_PLUGIN_PATH=$(SRC_BASE_PATH)/third_party/phxpaxos/plugin/include @@ -20,6 +21,7 @@ PHXRPC_INCLUDE_PATH=$(SRC_BASE_PATH)/third_party/phxrpc PROTOBUF_LIB_PATH=$(SRC_BASE_PATH)/third_party/protobuf/lib LEVELDB_LIB_PATH=$(SRC_BASE_PATH)/third_party/leveldb/lib/ +GFLAGS_LIB_PATH=$(SRC_BASE_PATH)/third_party/gflags/lib GLOG_LIB_PATH=$(SRC_BASE_PATH)/third_party/glog/lib MYSQL_LIB_PATH=$(SRC_BASE_PATH)/percona/libmysql PHXPAXOS_LIB_PATH=$(SRC_BASE_PATH)/third_party/phxpaxos/lib @@ -30,12 +32,12 @@ PHXRPC_LIB_PATH=$(SRC_BASE_PATH)/third_party/phxrpc/lib CXX=g++ CXXFLAGS+=-std=c++11 CPPFLAGS+=-I$(SRC_BASE_PATH) -I$(PROTOBUF_INCLUDE_PATH) -I$(LEVELDB_INCLUDE_PATH) -CPPFLAGS+=-I$(GLOG_INCLUDE_PATH) -CPPFLAGS+=-Wall -g -fPIC -m64 +CPPFLAGS+=-I$(GFLAGS_INCLUDE_PATH) -I$(GLOG_INCLUDE_PATH) +CPPFLAGS+=-Wall -g -fPIC -m64 -LDFLAGS += -L$(PHXPAXOS_LIB_PATH) -L$(PHXSQL_LIB_PATH) -L$(PROTOBUF_LIB_PATH) -L$(LEVELDB_LIB_PATH) -LDFLAGS += -L$(GLOG_LIB_PATH) -L$(GRPC_LIBE_PATH) -L$(OPEN_SSL_LIB_PATH) -L$(MYSQL_LIB_PATH) -LDFLAGS += -L$(COLIB_LIB_PATH) +LDFLAGS += -L$(PHXPAXOS_LIB_PATH) -L$(PHXSQL_LIB_PATH) -L$(PROTOBUF_LIB_PATH) -L$(LEVELDB_LIB_PATH) +LDFLAGS += -L$(GFLAGS_LIB_PATH) -L$(GLOG_LIB_PATH) -L$(GRPC_LIBE_PATH) -L$(OPEN_SSL_LIB_PATH) -L$(MYSQL_LIB_PATH) +LDFLAGS += -L$(COLIB_LIB_PATH) LDFLAGS += -static-libgcc -static-libstdc++ LDFLAGS += -Wl,--no-as-needed diff --git a/phx_percona/percona/plugin/phxsync_phxrpc/CMakeLists.txt b/phx_percona/percona/plugin/phxsync_phxrpc/CMakeLists.txt index 0039e09..6ad4609 100644 --- a/phx_percona/percona/plugin/phxsync_phxrpc/CMakeLists.txt +++ b/phx_percona/percona/plugin/phxsync_phxrpc/CMakeLists.txt @@ -1,14 +1,14 @@ # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -19,16 +19,17 @@ ADD_DEFINITIONS(-std=gnu++0x -DNO_USE_PAXOS_PLUGIN -DMYSQL_SERVER ) EXEC_PROGRAM(g++ ARGS -print-file-name=libstdc++.a OUTPUT_VARIABLE STDCLIBPATH) EXEC_PROGRAM(cp ARGS ${STDCLIBPATH} ${BASE_PATH}/.lib/extlib/libstdcxx.a) -INCLUDE_DIRECTORIES( +INCLUDE_DIRECTORIES( ${BASE_PATH}/include ${BASE_PATH}/third_party/phxpaxos/include ${BASE_PATH}/third_party/phxpaxos/plugin/include/ ) -SET( PHXCLIENTLIB_SRC +SET( PHXCLIENTLIB_SRC ${BASE_PATH}/.lib/extlib/libphxbinlogsvrclient_phxrpc.a ${BASE_PATH}/.lib/extlib/libphxglog.a ${BASE_PATH}/third_party/glog/lib/libglog.a + ${BASE_PATH}/third_party/gflags/lib/libgflags.a ${BASE_PATH}/third_party/phxrpc/lib/libphxrpc.a ${BASE_PATH}/third_party/protobuf/lib/libprotobuf.a ${BASE_PATH}/.lib/extlib/libstdcxx.a diff --git a/phxcomm/log/phxglog/Makefile.define b/phxcomm/log/phxglog/Makefile.define index db2c73b..3d70ed0 100644 --- a/phxcomm/log/phxglog/Makefile.define +++ b/phxcomm/log/phxglog/Makefile.define @@ -1,31 +1,31 @@ -# Copyright (c) 2016 Tencent. See the AUTHORS file for names +# Copyright (c) 2016 Tencent. See the AUTHORS file for names # of contributors. -# +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. -# +# # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. -# +# # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301, USA. -# +# -allobject=elibphxglog.a +allobject=elibphxglog.a PHXGLOG_OBJ=phx_glog.o PHXGLOG_LIB=phxglog include:phxcomm_include -PHXGLOG_SYS_LIB=$(GLOG_LIB_PATH)/libglog.a -lpthread +PHXGLOG_SYS_LIB=$(GLOG_LIB_PATH)/libglog.a $(GFLAGS_LIB_PATH)/libgflags.a -lpthread -PHXGLOG_INCS=$(SRC_BASE_PATH)/phxcomm/log/phxglog +PHXGLOG_INCS=$(SRC_BASE_PATH)/phxcomm/log/phxglog PHXGLOG_EXTRA_CPPFLAGS=-Wall diff --git a/third_party/autoinstall.sh b/third_party/autoinstall.sh index d62586b..94c2452 100755 --- a/third_party/autoinstall.sh +++ b/third_party/autoinstall.sh @@ -114,7 +114,7 @@ function install_protobuf() exist_gmock_dir="../phxpaxos/third_party/gmock"; if [ -d $exist_gmock_dir ]; then if [ ! -d gmock ]; then - cp -r $exist_gmock_dir gmock; + cp -r $exist_gmock_dir gmock; fi fi @@ -149,7 +149,7 @@ function install_glog() exist_gflags_dir="../gflags"; if [ -d $exist_gflags_dir ]; then # use local gflags - ./configure CXXFLAGS=-fPIC --prefix=$(pwd) --with-gflags=$(pwd)/gflags; + ./configure CXXFLAGS=-fPIC --prefix=$(pwd) --with-gflags=$exist_gflags_dir; else # use system gflags ./configure CXXFLAGS=-fPIC --prefix=$(pwd); @@ -178,7 +178,7 @@ function install_gflags() # end check. go_back; cd $lib_name; - cmake . -DCMAKE_INSTALL_PREFIX=$(pwd); + CXXFLAGS=-fPIC cmake . -DCMAKE_INSTALL_PREFIX=$(pwd); make && make install; check_lib_exist $lib_name; @@ -245,7 +245,8 @@ function install_phxpaxos() go_back; cd $lib_name; cd third_party; - rm -rf glog leveldb protobuf; + rm -rf gflags glog leveldb protobuf; + ln -s ../../gflags gflags; ln -s ../../glog glog; ln -s ../../leveldb leveldb ln -s ../../protobuf protobuf; diff --git a/third_party/phxpaxos b/third_party/phxpaxos index 0d57dd5..c6c8806 160000 --- a/third_party/phxpaxos +++ b/third_party/phxpaxos @@ -1 +1 @@ -Subproject commit 0d57dd5a9d29c91c134891948019f05d0fb1aeca +Subproject commit c6c8806c3497cabe6e74dc09aa4487b6fd2057f7 diff --git a/third_party/phxrpc b/third_party/phxrpc index 78aaf98..3ff32cc 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit 78aaf98cb5582235b8555c4d17c520509c54b510 +Subproject commit 3ff32cccd14a25cf57312e9c611b54686d87cd3a diff --git a/tools/check_install.py b/tools/check_install.py index ca99e10..1af0664 100644 --- a/tools/check_install.py +++ b/tools/check_install.py @@ -6,7 +6,7 @@ lib_dir="" bin_dir="" -third_party_list=["PROTOBUF", "LEVELDB", "GLOG", "PHXPAXOS", "PHXPAXOS_PLUGIN", "COLIB"] +third_party_list=["PROTOBUF", "LEVELDB", "GFLAGS", "GLOG", "PHXPAXOS", "PHXPAXOS_PLUGIN", "COLIB"] def GetPath(key): makefile_def=open("makefile.mk") @@ -40,30 +40,30 @@ def GetPathPrefix(key): def CheckMySql(): if( not os.path.exists( base_dir+"/percona") ): print "percona directory(%s) not found" % (base_dir + "/percona") - print "please make sure percona 5.6 has been placed on the source directory and named \"percona\"," + print "please make sure percona 5.6 has been placed on the source directory and named \"percona\"," print "you can download percona 5.6 from https://github.com/percona/percona-server.git." exit(1) - + def CheckBasePath(): global lib_dir, sbin_dir - lib_dir=GetPath("PHXSQL_LIB_PATH") + lib_dir=GetPath("PHXSQL_LIB_PATH") if( not os.path.exists( lib_dir ) ): os.mkdir( lib_dir ) - sbin_dir=GetPath("PHXSQL_SBIN_PATH") + sbin_dir=GetPath("PHXSQL_SBIN_PATH") if( not os.path.exists( sbin_dir ) ): os.mkdir( sbin_dir ) - extlib_dir=GetPath("PHXSQL_EXTLIB_PATH") + extlib_dir=GetPath("PHXSQL_EXTLIB_PATH") if( not os.path.exists( extlib_dir ) ): os.mkdir( extlib_dir ) def Check3rdPath(): for lib in third_party_list: - path_list=GetPathPrefix(lib) + path_list=GetPathPrefix(lib) for path in path_list: if( not os.path.exists( path[1] ) ): print "%s not found" % path[1] @@ -73,7 +73,7 @@ def Check3rdPath(): def CheckProtobufVersion(): protobuf_bin_path = base_dir + "/third_party/protobuf/bin" if( not os.path.exists( protobuf_bin_path ) ): - print "please make sure protobuf 3.0+ has been installed on the third party directory" + print "please make sure protobuf 3.0+ has been installed on the third party directory" print "and %s/protoc can be detected" % protobuf_bin_path exit(1) @@ -83,7 +83,7 @@ def CheckProtobufVersion(): cmd_res.close() if( res == '' ): print "protobuf %s has beed found",res - print "please make sure protobuf 3.0+ has been installed on the third party directory" + print "please make sure protobuf 3.0+ has been installed on the third party directory" exit(1) if(__name__ == '__main__'): From b7939539f08a5408a84aacd5d26b7ab78c64e0f6 Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Mon, 13 Aug 2018 10:55:26 +0800 Subject: [PATCH 14/17] update phxrpc --- .gitmodules | 6 +++--- third_party/phxrpc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index bd9fde5..b462a6c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,9 @@ [submodule "third_party/leveldb"] path = third_party/leveldb url = https://github.com/google/leveldb -[submodule "third_party/phxrpc"] - path = third_party/phxrpc - url = https://github.com/Tencent/phxrpc [submodule "third_party/phxpaxos"] path = third_party/phxpaxos url = https://github.com/Tencent/phxpaxos +[submodule "third_party/phxrpc"] + path = third_party/phxrpc + url = https://github.com/Tencent/phxrpc diff --git a/third_party/phxrpc b/third_party/phxrpc index 3ff32cc..367e4cc 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit 3ff32cccd14a25cf57312e9c611b54686d87cd3a +Subproject commit 367e4cca7940d5aec54ea866c789566398e3547a From b64b19ca03ed144683baf56d8c70bcdd45822066 Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Sat, 11 Aug 2018 01:47:23 +0800 Subject: [PATCH 15/17] fix phxrpc --- .../framework/phxrpc/client/phxbinlog_stub_phxrpc.cpp | 11 +++++++---- .../framework/phxrpc/svr/phxbinlog_server.cpp | 11 +++++------ phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h | 8 ++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/phxbinlogsvr/framework/phxrpc/client/phxbinlog_stub_phxrpc.cpp b/phxbinlogsvr/framework/phxrpc/client/phxbinlog_stub_phxrpc.cpp index dbca854..8f36d9e 100644 --- a/phxbinlogsvr/framework/phxrpc/client/phxbinlog_stub_phxrpc.cpp +++ b/phxbinlogsvr/framework/phxrpc/client/phxbinlog_stub_phxrpc.cpp @@ -2,9 +2,9 @@ Tencent is pleased to support the open source community by making PhxSQL available. Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the GNU General Public 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 - + https://opensource.org/licenses/GPL-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. */ @@ -12,6 +12,7 @@ #include "phxrpc_phxbinlog_stub.h" #include "phxcomm/phx_log.h" +#include "phxrpc/http.h" #include "phxrpc/rpc.h" #include @@ -80,7 +81,8 @@ int PhxBinlogStub_PhxRPC::RpcCallWithIPList(const FuncName &func, const vectorservice_args); PhxbinlogServiceImpl service(service_args); PhxbinlogDispatcher dispatcher(service, args); - phxrpc::HttpDispatcher + phxrpc::BaseDispatcher base_dispatcher(dispatcher, PhxbinlogDispatcher::GetURIFuncMap()); if (!base_dispatcher.Dispatch(req, resp)) { - resp->SetStatusCode(404); - resp->SetReasonPhrase("Not Found"); + resp->SetFake(phxrpc::BaseResponse::FakeReason::DISPATCH_ERROR); } } diff --git a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h index 01d7dbf..0eb96a8 100644 --- a/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h +++ b/phxbinlogsvr/framework/phxrpc/svr/phxbinlog_server.h @@ -63,12 +63,12 @@ class Server { PhxbinlogServerConfig *GetServerConfig(); phxbinlogsvr::PhxBinLogSvrHandler *GetSvrHandler(); - static void Dispatch(const phxrpc::HttpRequest &req, - phxrpc::HttpResponse *const resp, - phxrpc::DispatcherArgs_t *args); + static void Dispatch(const phxrpc::BaseRequest &req, + phxrpc::BaseResponse *const resp, + phxrpc::DispatcherArgs_t *const args); protected: - typedef void (*OpenLogFunc)(const char *, const int &log_level, const char * log_path, + typedef void (*OpenLogFunc)(const char *, const int &log_level, const char *log_path, const uint32_t &log_file_max_size); typedef void (*LogFunc)(int log_level, const char *format, va_list args); From db62b7b7c4bf483405d41bb5f4f92c5155f319ef Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Tue, 14 Aug 2018 15:47:12 +0800 Subject: [PATCH 16/17] update phxrpc --- third_party/phxrpc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/phxrpc b/third_party/phxrpc index 367e4cc..180bc75 160000 --- a/third_party/phxrpc +++ b/third_party/phxrpc @@ -1 +1 @@ -Subproject commit 367e4cca7940d5aec54ea866c789566398e3547a +Subproject commit 180bc75198131c5749e71ed0d0f00ed31596d619 From 6689e99e2a5b5dd1518570ea56c85475e3e5b59f Mon Sep 17 00:00:00 2001 From: taohe <102320170@qq.com> Date: Mon, 27 Aug 2018 12:08:25 +0800 Subject: [PATCH 17/17] fix make install --- makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile.mk b/makefile.mk index 8b3e36c..54529b4 100644 --- a/makefile.mk +++ b/makefile.mk @@ -60,6 +60,7 @@ vpath %.proto $(PROTOS_PATH) %.pb.cc: %.proto $(PROTOC) -I$(PROTOBUF_INCLUDE_PATH) -I $(PROTOS_PATH) --cpp_out=. $< +.PHONY: install install: make install -C percona @mkdir $(PREFIX)/lib -p;\