Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove proxy code. proxy made performence low #1274

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions include/pika_proxy.h

This file was deleted.

93 changes: 0 additions & 93 deletions include/pika_proxy_cli.h

This file was deleted.

103 changes: 0 additions & 103 deletions include/pika_proxy_conn.h

This file was deleted.

6 changes: 0 additions & 6 deletions src/pika.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "slash/include/env.h"
#include "include/pika_rm.h"
#include "include/pika_proxy.h"
#include "include/pika_server.h"
#include "include/pika_command.h"
#include "include/pika_conf.h"
Expand All @@ -25,7 +24,6 @@
PikaConf* g_pika_conf;
PikaServer* g_pika_server;
PikaReplicaManager* g_pika_rm;
PikaProxy* g_pika_proxy;

PikaCmdTableManager* g_pika_cmd_table_manager;

Expand Down Expand Up @@ -194,13 +192,11 @@ int main(int argc, char *argv[]) {
g_pika_cmd_table_manager = new PikaCmdTableManager();
g_pika_server = new PikaServer();
g_pika_rm = new PikaReplicaManager();
g_pika_proxy = new PikaProxy();

if (g_pika_conf->daemonize()) {
close_std();
}

g_pika_proxy->Start();
g_pika_rm->Start();
g_pika_server->Start();

Expand All @@ -212,11 +208,9 @@ int main(int argc, char *argv[]) {
// may references to dead PikaServer
g_pika_rm->Stop();

g_pika_proxy->Stop();

delete g_pika_server;
delete g_pika_rm;
delete g_pika_proxy;
delete g_pika_cmd_table_manager;
::google::ShutdownGoogleLogging();
delete g_pika_conf;
Expand Down
20 changes: 3 additions & 17 deletions src/pika_client_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "include/pika_cmd_table_manager.h"
#include "include/pika_admin.h"
#include "include/pika_rm.h"
#include "include/pika_proxy.h"

extern PikaConf* g_pika_conf;
extern PikaServer* g_pika_server;
extern PikaReplicaManager* g_pika_rm;
extern PikaCmdTableManager* g_pika_cmd_table_manager;
extern PikaProxy* g_pika_proxy;

PikaClientConn::PikaClientConn(int fd, std::string ip_port,
pink::Thread* thread,
Expand Down Expand Up @@ -196,27 +194,15 @@ void PikaClientConn::DoBackgroundTask(void* arg) {
conn_ptr->NotifyEpoll(false);
return;
}
for (auto argv : bg_arg->redis_cmds) {
for (const auto& argv : bg_arg->redis_cmds) {
if (argv.size() == 0) {
delete bg_arg;
conn_ptr->NotifyEpoll(false);
return;
}
}
std::vector<Node> dst;
bool all_local = true;
Status s = g_pika_server->GetCmdRouting(
bg_arg->redis_cmds, &dst, &all_local);
if (!s.ok()) {
delete bg_arg;
conn_ptr->NotifyEpoll(false);
return;
}
if (!all_local) {
g_pika_proxy->ScheduleForwardToBackend(conn_ptr, bg_arg->redis_cmds, dst);
} else {
conn_ptr->BatchExecRedisCmd(bg_arg->redis_cmds);
}

conn_ptr->BatchExecRedisCmd(bg_arg->redis_cmds);
delete bg_arg;
}

Expand Down
4 changes: 2 additions & 2 deletions src/pika_cluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ bool PkClusterInfoCmd::ParseInfoTableSubCmd() {
void PkClusterInfoCmd::ClusterInfoSlotRange(const std::string& table_name,
const std::set<uint32_t> slots, std::string* info) {
std::stringstream tmp_stream;
for (auto partition_id : slots) {
for (const auto& partition_id : slots) {
std::string p_info;
Status s = GetSlotInfo(table_name, partition_id, &p_info);
if (!s.ok()) {
Expand Down Expand Up @@ -588,7 +588,7 @@ void PkClusterSlotsSlaveofCmd::Do(std::shared_ptr<Partition> partition) {
}
}

for (auto to_del : to_del_slots) {
for (const auto& to_del : to_del_slots) {
slots_.erase(to_del);
}

Expand Down
6 changes: 3 additions & 3 deletions src/pika_consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ LogOffset SyncProgress::InternalCalCommittedIndex(std::unordered_map<std::string
return LogOffset();
}
std::vector<LogOffset> offsets;
for (auto index : match_index) {
for (const auto& index : match_index) {
offsets.push_back(index.second);
}
std::sort(offsets.begin(), offsets.end());
Expand Down Expand Up @@ -557,7 +557,7 @@ Status ConsensusCoordinator::ScheduleApplyLog(const LogOffset& committed_index)
if (!s.ok()) {
return Status::NotFound("committed index not found " + committed_index.ToString());
}
for (auto log : logs) {
for (const auto& log : logs) {
context_->PrepareUpdateAppliedIndex(log.offset);
InternalApply(log);
}
Expand All @@ -572,7 +572,7 @@ Status ConsensusCoordinator::ScheduleApplyFollowerLog(const LogOffset& committed
if (!s.ok()) {
return Status::NotFound("committed index not found " + committed_index.ToString());
}
for (auto log : logs) {
for (const auto& log : logs) {
context_->PrepareUpdateAppliedIndex(log.offset);
InternalApplyFollower(log);
}
Expand Down
Loading