From fa231863c3ddd75653ddf5f6fc0eabf797597521 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 1 Jul 2023 11:43:47 +0800 Subject: [PATCH] add metaserver test --- CMakeLists.txt | 15 +++++ Dockerfile | 5 +- Makefile | 13 +++- protocol/eraftkv.proto | 2 + src/async_buffer.cc | 2 +- src/async_buffer.h | 2 +- src/buffer.h | 2 +- src/consts.h | 14 ++++ src/eraftkv.pb.cc | 128 +++++++++++++++++++++++++----------- src/eraftkv.pb.h | 80 +++++++++++++++++++++- src/eraftkv_server.cc | 15 +++++ src/eraftmeta.cc | 2 +- src/eraftmetaserver_test.cc | 116 ++++++++++++++++++++++++++++++++ src/estatus.h | 1 + src/listen_socket.cc | 2 +- src/listen_socket.h | 2 +- src/net_thread_pool.cc | 2 +- src/net_thread_pool.h | 2 +- src/network.h | 2 +- src/poller.h | 2 +- src/proto_parser.cc | 2 +- src/proto_parser.h | 2 +- src/rocksdb_storage_impl.cc | 66 +++++++++++++++++++ src/rocksdb_storage_impl.h | 20 ++++++ src/server.cc | 2 +- src/server.h | 2 +- src/socket.cc | 2 +- src/socket.h | 2 +- src/storage.h | 20 ++++++ src/stream_socket.cc | 2 +- src/stream_socket.h | 2 +- src/task_manager.cc | 2 +- src/task_manager.h | 2 +- src/thread_pool.cc | 2 +- src/thread_pool.h | 2 +- src/unbounded_buffer.cc | 2 +- src/unbounded_buffer.h | 2 +- utils/format-code.sh | 1 + 38 files changed, 476 insertions(+), 68 deletions(-) create mode 100644 src/consts.h create mode 100644 src/eraftmetaserver_test.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index c0e34a74..28268072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,6 +246,21 @@ target_link_libraries(eraftkv_server_test PUBLIC ${Protobuf_LIBRARY} ) +# build eraftmeta_server_tests +add_executable(eraftmeta_server_test + src/eraftmetaserver_test.cc + src/eraftkv.pb.cc + src/eraftkv.grpc.pb.cc + src/util.cc +) +target_link_libraries(eraftmeta_server_test PUBLIC + ${GTEST_LIBRARIES} + rocksdb + pthread + gRPC::grpc++ + ${Protobuf_LIBRARY} +) + add_executable(rocksdb_storage_impl_tests src/rocksdb_storage_impl_tests.cc src/util.cc diff --git a/Dockerfile b/Dockerfile index 706cf657..37f71f07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,10 @@ FROM eraft/eraftkv:v0.0.4 # && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 20 \ # && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 20 -# RUN git clone https://github.com/grpc/grpc.git && cd grpc && git checkout v1.28.0 && git submodule update --init && mkdir .build && cd .build && cmake .. -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release && make install -j4 && cd .. && rm -rf .build/CMakeCache.txt && cd .build && cmake .. -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release && make install -j4 +# RUN git clone https://github.com/grpc/grpc.git && cd grpc && git checkout v1.28.0 && git submodule update --init && \ +# mkdir .build && cd .build && cmake .. -DgRPC_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release \ +# && make install -j4 && cd .. && rm -rf .build/CMakeCache.txt && cd .build && +# cmake .. -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DCMAKE_BUILD_TYPE=Release && make install -j4 # intstall google benchmark # RUN git clone https://github.com/google/benchmark.git && git clone https://github.com/google/googletest.git benchmark/googletest && cd benchmark && cmake -E make_directory "build" && cmake -E chdir "build" cmake -DCMAKE_BUILD_TYPE=Release ../ && cmake --build "build" --config Release --target install diff --git a/Makefile b/Makefile index 68690f20..529f4e2f 100644 --- a/Makefile +++ b/Makefile @@ -52,10 +52,10 @@ rm-net: run-demo: docker run --name kvserver-node1 --network mytestnetwork --ip 172.18.0.2 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftkv 0 /tmp/kv_db0 /tmp/log_db0 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 - sleep 4s + sleep 5 docker run --name kvserver-node2 --network mytestnetwork --ip 172.18.0.3 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftkv 1 /tmp/kv_db1 /tmp/log_db1 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 docker run --name kvserver-node3 --network mytestnetwork --ip 172.18.0.4 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftkv 2 /tmp/kv_db2 /tmp/log_db2 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 - sleep 10s + sleep 10 docker run --name vdbserver-node --network mytestnetwork --ip 172.18.0.6 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraft-vdb 172.18.0.6:12306 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 stop-demo: @@ -67,3 +67,12 @@ run-demo-bench: run-vdb-tests: chmod +x utils/run-vdb-tests.sh docker run --name vdbserver-node-tests --network mytestnetwork --ip 172.18.0.8 -it --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/utils/run-vdb-tests.sh + +run-metaserver-tests: + docker run --name metaserver-node1 --network mytestnetwork --ip 172.18.0.2 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftmeta 0 /tmp/meta_db0 /tmp/log_db0 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 + docker run --name metaserver-node2 --network mytestnetwork --ip 172.18.0.3 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftmeta 1 /tmp/meta_db1 /tmp/log_db1 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 + docker run --name metaserver-node3 --network mytestnetwork --ip 172.18.0.4 -d --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftmeta 2 /tmp/meta_db2 /tmp/log_db2 172.18.0.2:8088,172.18.0.3:8089,172.18.0.4:8090 + sleep 10 + docker run --name metaserver-tests --network mytestnetwork --ip 172.18.0.8 -it --rm -v $(realpath .):/eraft eraft/eraftkv:v0.0.6 /eraft/build/eraftmeta_server_test + sleep 2 + docker stop metaserver-node1 metaserver-node2 metaserver-node3 diff --git a/protocol/eraftkv.proto b/protocol/eraftkv.proto index 6ad7ab96..1f890b1c 100644 --- a/protocol/eraftkv.proto +++ b/protocol/eraftkv.proto @@ -120,6 +120,7 @@ enum ChangeType { SlotMove = 4; ServerJoin = 5; ServerLeave = 6; + MetaMembersQuery = 7; } enum HandleServerType { @@ -135,6 +136,7 @@ message ClusterConfigChangeReq { int64 config_version = 5; int64 op_count = 6; int64 command_id = 7; + ShardGroup shard_group = 8; } message ClusterConfigChangeResp { diff --git a/src/async_buffer.cc b/src/async_buffer.cc index eca5af2a..dd13dc34 100644 --- a/src/async_buffer.cc +++ b/src/async_buffer.cc @@ -1,6 +1,6 @@ /** * @file async_buffer.cc - * @author ERaftGroup + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/async_buffer.h b/src/async_buffer.h index 9da7e736..a9f05ccf 100644 --- a/src/async_buffer.h +++ b/src/async_buffer.h @@ -1,6 +1,6 @@ /** * @file async_buffer.h - * @author ERaftGroup + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/buffer.h b/src/buffer.h index 7e3e9e90..e3496c1c 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1,6 +1,6 @@ /** * @file buffer.h - * @author ERaftGroup + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/consts.h b/src/consts.h new file mode 100644 index 00000000..8a10c526 --- /dev/null +++ b/src/consts.h @@ -0,0 +1,14 @@ +/** + * @file consts.h + * @author jay_jieliu@outlook.com + * @brief + * @version 0.1 + * @date 2023-07-01 + * + * @copyright Copyright (c) 2023 + * + */ + +#pragma once + +#define SG_META_PREFIX "SG_META" \ No newline at end of file diff --git a/src/eraftkv.pb.cc b/src/eraftkv.pb.cc index d53be85a..59ef735f 100644 --- a/src/eraftkv.pb.cc +++ b/src/eraftkv.pb.cc @@ -156,9 +156,10 @@ static void InitDefaultsscc_info_ClusterConfigChangeReq_eraftkv_2eproto() { ::eraftkv::ClusterConfigChangeReq::InitAsDefaultInstance(); } -::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ClusterConfigChangeReq_eraftkv_2eproto = - {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_ClusterConfigChangeReq_eraftkv_2eproto}, { - &scc_info_Server_eraftkv_2eproto.base,}}; +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_ClusterConfigChangeReq_eraftkv_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_ClusterConfigChangeReq_eraftkv_2eproto}, { + &scc_info_Server_eraftkv_2eproto.base, + &scc_info_ShardGroup_eraftkv_2eproto.base,}}; static void InitDefaultsscc_info_ClusterConfigChangeResp_eraftkv_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -444,6 +445,7 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_eraftkv_2eproto::offsets[] PRO PROTOBUF_FIELD_OFFSET(::eraftkv::ClusterConfigChangeReq, config_version_), PROTOBUF_FIELD_OFFSET(::eraftkv::ClusterConfigChangeReq, op_count_), PROTOBUF_FIELD_OFFSET(::eraftkv::ClusterConfigChangeReq, command_id_), + PROTOBUF_FIELD_OFFSET(::eraftkv::ClusterConfigChangeReq, shard_group_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::eraftkv::ClusterConfigChangeResp, _internal_metadata_), ~0u, // no _extensions_ @@ -489,10 +491,10 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB { 92, -1, sizeof(::eraftkv::Server)}, { 100, -1, sizeof(::eraftkv::ShardGroup)}, { 109, -1, sizeof(::eraftkv::ClusterConfigChangeReq)}, - { 121, -1, sizeof(::eraftkv::ClusterConfigChangeResp)}, - { 129, -1, sizeof(::eraftkv::KvOpPair)}, - { 139, -1, sizeof(::eraftkv::ClientOperationReq)}, - { 146, -1, sizeof(::eraftkv::ClientOperationResp)}, + { 122, -1, sizeof(::eraftkv::ClusterConfigChangeResp)}, + { 130, -1, sizeof(::eraftkv::KvOpPair)}, + { 140, -1, sizeof(::eraftkv::ClientOperationReq)}, + { 147, -1, sizeof(::eraftkv::ClientOperationResp)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { @@ -548,43 +550,45 @@ const char descriptor_table_protodef_eraftkv_2eproto[] PROTOBUF_SECTION_VARIABLE "er_status\030\003 \001(\0162\025.eraftkv.ServerStatus\"k" "\n\nShardGroup\022\n\n\002id\030\001 \001(\003\022\034\n\005slots\030\002 \003(\0132" "\r.eraftkv.Slot\022 \n\007servers\030\003 \003(\0132\017.eraftk" - "v.Server\022\021\n\tleader_id\030\004 \001(\003\"\352\001\n\026ClusterC" + "v.Server\022\021\n\tleader_id\030\004 \001(\003\"\224\002\n\026ClusterC" "onfigChangeReq\022(\n\013change_type\030\001 \001(\0162\023.er" "aftkv.ChangeType\0225\n\022handle_server_type\030\002" " \001(\0162\031.eraftkv.HandleServerType\022\020\n\010shard" "_id\030\003 \001(\003\022\037\n\006server\030\004 \001(\0132\017.eraftkv.Serv" "er\022\026\n\016config_version\030\005 \001(\003\022\020\n\010op_count\030\006" - " \001(\003\022\022\n\ncommand_id\030\007 \001(\003\"l\n\027ClusterConfi" - "gChangeResp\022\017\n\007success\030\001 \001(\010\022(\n\013shard_gr" - "oup\030\002 \003(\0132\023.eraftkv.ShardGroup\022\026\n\016config" - "_version\030\003 \001(\003\"q\n\010KvOpPair\022&\n\007op_type\030\001 " - "\001(\0162\025.eraftkv.ClientOpType\022\013\n\003key\030\002 \001(\t\022" - "\r\n\005value\030\003 \001(\t\022\017\n\007success\030\004 \001(\010\022\020\n\010op_co" - "unt\030\005 \001(\003\"J\n\022ClientOperationReq\022\024\n\014op_ti" - "mestamp\030\001 \001(\004\022\036\n\003kvs\030\002 \003(\0132\021.eraftkv.KvO" - "pPair\"5\n\023ClientOperationResp\022\036\n\003ops\030\002 \003(" - "\0132\021.eraftkv.KvOpPair*O\n\tErrorCode\022\033\n\027REQ" - "UEST_NOT_LEADER_NODE\020\000\022\020\n\014NODE_IS_DOWN\020\001" - "\022\023\n\017REQUEST_TIMEOUT\020\002*1\n\tEntryType\022\n\n\006No" - "rmal\020\000\022\016\n\nConfChange\020\001\022\010\n\004NoOp\020\002*A\n\nSlot" - "Status\022\013\n\007Running\020\000\022\r\n\tMigrating\020\001\022\r\n\tIm" - "porting\020\002\022\010\n\004Init\020\003* \n\014ServerStatus\022\006\n\002U" - "p\020\000\022\010\n\004Down\020\001*|\n\nChangeType\022\017\n\013ClusterIn" - "it\020\000\022\r\n\tShardJoin\020\001\022\016\n\nShardLeave\020\002\022\017\n\013S" - "hardsQuery\020\003\022\014\n\010SlotMove\020\004\022\016\n\nServerJoin" - "\020\005\022\017\n\013ServerLeave\020\006*2\n\020HandleServerType\022" - "\016\n\nMetaServer\020\000\022\016\n\nDataServer\020\001*=\n\014Clien" - "tOpType\022\010\n\004Noop\020\000\022\007\n\003Put\020\001\022\007\n\003Get\020\002\022\007\n\003D" - "el\020\003\022\010\n\004Scan\020\0042\367\002\n\007ERaftKv\022@\n\013RequestVot" - "e\022\027.eraftkv.RequestVoteReq\032\030.eraftkv.Req" - "uestVoteResp\022F\n\rAppendEntries\022\031.eraftkv." - "AppendEntriesReq\032\032.eraftkv.AppendEntries" - "Resp\0227\n\010Snapshot\022\024.eraftkv.SnapshotReq\032\025" - ".eraftkv.SnapshotResp\022O\n\022ProcessRWOperat" - "ion\022\033.eraftkv.ClientOperationReq\032\034.eraft" - "kv.ClientOperationResp\022X\n\023ClusterConfigC" - "hange\022\037.eraftkv.ClusterConfigChangeReq\032 " - ".eraftkv.ClusterConfigChangeRespb\006proto3" + " \001(\003\022\022\n\ncommand_id\030\007 \001(\003\022(\n\013shard_group\030" + "\010 \001(\0132\023.eraftkv.ShardGroup\"l\n\027ClusterCon" + "figChangeResp\022\017\n\007success\030\001 \001(\010\022(\n\013shard_" + "group\030\002 \003(\0132\023.eraftkv.ShardGroup\022\026\n\016conf" + "ig_version\030\003 \001(\003\"q\n\010KvOpPair\022&\n\007op_type\030" + "\001 \001(\0162\025.eraftkv.ClientOpType\022\013\n\003key\030\002 \001(" + "\t\022\r\n\005value\030\003 \001(\t\022\017\n\007success\030\004 \001(\010\022\020\n\010op_" + "count\030\005 \001(\003\"J\n\022ClientOperationReq\022\024\n\014op_" + "timestamp\030\001 \001(\004\022\036\n\003kvs\030\002 \003(\0132\021.eraftkv.K" + "vOpPair\"5\n\023ClientOperationResp\022\036\n\003ops\030\002 " + "\003(\0132\021.eraftkv.KvOpPair*O\n\tErrorCode\022\033\n\027R" + "EQUEST_NOT_LEADER_NODE\020\000\022\020\n\014NODE_IS_DOWN" + "\020\001\022\023\n\017REQUEST_TIMEOUT\020\002*1\n\tEntryType\022\n\n\006" + "Normal\020\000\022\016\n\nConfChange\020\001\022\010\n\004NoOp\020\002*A\n\nSl" + "otStatus\022\013\n\007Running\020\000\022\r\n\tMigrating\020\001\022\r\n\t" + "Importing\020\002\022\010\n\004Init\020\003* \n\014ServerStatus\022\006\n" + "\002Up\020\000\022\010\n\004Down\020\001*\222\001\n\nChangeType\022\017\n\013Cluste" + "rInit\020\000\022\r\n\tShardJoin\020\001\022\016\n\nShardLeave\020\002\022\017" + "\n\013ShardsQuery\020\003\022\014\n\010SlotMove\020\004\022\016\n\nServerJ" + "oin\020\005\022\017\n\013ServerLeave\020\006\022\024\n\020MetaMembersQue" + "ry\020\007*2\n\020HandleServerType\022\016\n\nMetaServer\020\000" + "\022\016\n\nDataServer\020\001*=\n\014ClientOpType\022\010\n\004Noop" + "\020\000\022\007\n\003Put\020\001\022\007\n\003Get\020\002\022\007\n\003Del\020\003\022\010\n\004Scan\020\0042" + "\367\002\n\007ERaftKv\022@\n\013RequestVote\022\027.eraftkv.Req" + "uestVoteReq\032\030.eraftkv.RequestVoteResp\022F\n" + "\rAppendEntries\022\031.eraftkv.AppendEntriesRe" + "q\032\032.eraftkv.AppendEntriesResp\0227\n\010Snapsho" + "t\022\024.eraftkv.SnapshotReq\032\025.eraftkv.Snapsh" + "otResp\022O\n\022ProcessRWOperation\022\033.eraftkv.C" + "lientOperationReq\032\034.eraftkv.ClientOperat" + "ionResp\022X\n\023ClusterConfigChange\022\037.eraftkv" + ".ClusterConfigChangeReq\032 .eraftkv.Cluste" + "rConfigChangeRespb\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_eraftkv_2eproto_deps[1] = { }; @@ -609,7 +613,7 @@ static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_era static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_eraftkv_2eproto_once; static bool descriptor_table_eraftkv_2eproto_initialized = false; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_eraftkv_2eproto = { - &descriptor_table_eraftkv_2eproto_initialized, descriptor_table_protodef_eraftkv_2eproto, "eraftkv.proto", 2800, + &descriptor_table_eraftkv_2eproto_initialized, descriptor_table_protodef_eraftkv_2eproto, "eraftkv.proto", 2865, &descriptor_table_eraftkv_2eproto_once, descriptor_table_eraftkv_2eproto_sccs, descriptor_table_eraftkv_2eproto_deps, 16, 0, schemas, file_default_instances, TableStruct_eraftkv_2eproto::offsets, file_level_metadata_eraftkv_2eproto, 16, file_level_enum_descriptors_eraftkv_2eproto, file_level_service_descriptors_eraftkv_2eproto, @@ -691,6 +695,7 @@ bool ChangeType_IsValid(int value) { case 4: case 5: case 6: + case 7: return true; default: return false; @@ -3993,16 +3998,23 @@ ::PROTOBUF_NAMESPACE_ID::Metadata ShardGroup::GetMetadata() const { void ClusterConfigChangeReq::InitAsDefaultInstance() { ::eraftkv::_ClusterConfigChangeReq_default_instance_._instance.get_mutable()->server_ = const_cast< ::eraftkv::Server*>( ::eraftkv::Server::internal_default_instance()); + ::eraftkv::_ClusterConfigChangeReq_default_instance_._instance.get_mutable()->shard_group_ = const_cast< ::eraftkv::ShardGroup*>( + ::eraftkv::ShardGroup::internal_default_instance()); } class ClusterConfigChangeReq::_Internal { public: static const ::eraftkv::Server& server(const ClusterConfigChangeReq* msg); + static const ::eraftkv::ShardGroup& shard_group(const ClusterConfigChangeReq* msg); }; const ::eraftkv::Server& ClusterConfigChangeReq::_Internal::server(const ClusterConfigChangeReq* msg) { return *msg->server_; } +const ::eraftkv::ShardGroup& +ClusterConfigChangeReq::_Internal::shard_group(const ClusterConfigChangeReq* msg) { + return *msg->shard_group_; +} ClusterConfigChangeReq::ClusterConfigChangeReq() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); @@ -4017,6 +4029,11 @@ ClusterConfigChangeReq::ClusterConfigChangeReq(const ClusterConfigChangeReq& fro } else { server_ = nullptr; } + if (from._internal_has_shard_group()) { + shard_group_ = new ::eraftkv::ShardGroup(*from.shard_group_); + } else { + shard_group_ = nullptr; + } ::memcpy(&change_type_, &from.change_type_, static_cast(reinterpret_cast(&command_id_) - reinterpret_cast(&change_type_)) + sizeof(command_id_)); @@ -4037,6 +4054,7 @@ ClusterConfigChangeReq::~ClusterConfigChangeReq() { void ClusterConfigChangeReq::SharedDtor() { if (this != internal_default_instance()) delete server_; + if (this != internal_default_instance()) delete shard_group_; } void ClusterConfigChangeReq::SetCachedSize(int size) const { @@ -4058,6 +4076,10 @@ void ClusterConfigChangeReq::Clear() { delete server_; } server_ = nullptr; + if (GetArenaNoVirtual() == nullptr && shard_group_ != nullptr) { + delete shard_group_; + } + shard_group_ = nullptr; ::memset(&change_type_, 0, static_cast( reinterpret_cast(&command_id_) - reinterpret_cast(&change_type_)) + sizeof(command_id_)); @@ -4122,6 +4144,13 @@ const char* ClusterConfigChangeReq::_InternalParse(const char* ptr, ::PROTOBUF_N CHK_(ptr); } else goto handle_unusual; continue; + // .eraftkv.ShardGroup shard_group = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_shard_group(), ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { @@ -4194,6 +4223,14 @@ ::PROTOBUF_NAMESPACE_ID::uint8* ClusterConfigChangeReq::_InternalSerialize( target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(7, this->_internal_command_id(), target); } + // .eraftkv.ShardGroup shard_group = 8; + if (this->has_shard_group()) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 8, _Internal::shard_group(this), target, stream); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target, stream); @@ -4217,6 +4254,13 @@ size_t ClusterConfigChangeReq::ByteSizeLong() const { *server_); } + // .eraftkv.ShardGroup shard_group = 8; + if (this->has_shard_group()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *shard_group_); + } + // .eraftkv.ChangeType change_type = 1; if (this->change_type() != 0) { total_size += 1 + @@ -4291,6 +4335,9 @@ void ClusterConfigChangeReq::MergeFrom(const ClusterConfigChangeReq& from) { if (from.has_server()) { _internal_mutable_server()->::eraftkv::Server::MergeFrom(from._internal_server()); } + if (from.has_shard_group()) { + _internal_mutable_shard_group()->::eraftkv::ShardGroup::MergeFrom(from._internal_shard_group()); + } if (from.change_type() != 0) { _internal_set_change_type(from._internal_change_type()); } @@ -4333,6 +4380,7 @@ void ClusterConfigChangeReq::InternalSwap(ClusterConfigChangeReq* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); swap(server_, other->server_); + swap(shard_group_, other->shard_group_); swap(change_type_, other->change_type_); swap(handle_server_type_, other->handle_server_type_); swap(shard_id_, other->shard_id_); diff --git a/src/eraftkv.pb.h b/src/eraftkv.pb.h index 65d56e1d..267270ed 100644 --- a/src/eraftkv.pb.h +++ b/src/eraftkv.pb.h @@ -237,12 +237,13 @@ enum ChangeType : int { SlotMove = 4, ServerJoin = 5, ServerLeave = 6, + MetaMembersQuery = 7, ChangeType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), ChangeType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() }; bool ChangeType_IsValid(int value); constexpr ChangeType ChangeType_MIN = ClusterInit; -constexpr ChangeType ChangeType_MAX = ServerLeave; +constexpr ChangeType ChangeType_MAX = MetaMembersQuery; constexpr int ChangeType_ARRAYSIZE = ChangeType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ChangeType_descriptor(); @@ -2377,6 +2378,7 @@ class ClusterConfigChangeReq : enum : int { kServerFieldNumber = 4, + kShardGroupFieldNumber = 8, kChangeTypeFieldNumber = 1, kHandleServerTypeFieldNumber = 2, kShardIdFieldNumber = 3, @@ -2399,6 +2401,21 @@ class ClusterConfigChangeReq : ::eraftkv::Server* _internal_mutable_server(); public: + // .eraftkv.ShardGroup shard_group = 8; + bool has_shard_group() const; + private: + bool _internal_has_shard_group() const; + public: + void clear_shard_group(); + const ::eraftkv::ShardGroup& shard_group() const; + ::eraftkv::ShardGroup* release_shard_group(); + ::eraftkv::ShardGroup* mutable_shard_group(); + void set_allocated_shard_group(::eraftkv::ShardGroup* shard_group); + private: + const ::eraftkv::ShardGroup& _internal_shard_group() const; + ::eraftkv::ShardGroup* _internal_mutable_shard_group(); + public: + // .eraftkv.ChangeType change_type = 1; void clear_change_type(); ::eraftkv::ChangeType change_type() const; @@ -2459,6 +2476,7 @@ class ClusterConfigChangeReq : ::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_; ::eraftkv::Server* server_; + ::eraftkv::ShardGroup* shard_group_; int change_type_; int handle_server_type_; ::PROTOBUF_NAMESPACE_ID::int64 shard_id_; @@ -4750,6 +4768,66 @@ inline void ClusterConfigChangeReq::set_command_id(::PROTOBUF_NAMESPACE_ID::int6 // @@protoc_insertion_point(field_set:eraftkv.ClusterConfigChangeReq.command_id) } +// .eraftkv.ShardGroup shard_group = 8; +inline bool ClusterConfigChangeReq::_internal_has_shard_group() const { + return this != internal_default_instance() && shard_group_ != nullptr; +} +inline bool ClusterConfigChangeReq::has_shard_group() const { + return _internal_has_shard_group(); +} +inline void ClusterConfigChangeReq::clear_shard_group() { + if (GetArenaNoVirtual() == nullptr && shard_group_ != nullptr) { + delete shard_group_; + } + shard_group_ = nullptr; +} +inline const ::eraftkv::ShardGroup& ClusterConfigChangeReq::_internal_shard_group() const { + const ::eraftkv::ShardGroup* p = shard_group_; + return p != nullptr ? *p : *reinterpret_cast( + &::eraftkv::_ShardGroup_default_instance_); +} +inline const ::eraftkv::ShardGroup& ClusterConfigChangeReq::shard_group() const { + // @@protoc_insertion_point(field_get:eraftkv.ClusterConfigChangeReq.shard_group) + return _internal_shard_group(); +} +inline ::eraftkv::ShardGroup* ClusterConfigChangeReq::release_shard_group() { + // @@protoc_insertion_point(field_release:eraftkv.ClusterConfigChangeReq.shard_group) + + ::eraftkv::ShardGroup* temp = shard_group_; + shard_group_ = nullptr; + return temp; +} +inline ::eraftkv::ShardGroup* ClusterConfigChangeReq::_internal_mutable_shard_group() { + + if (shard_group_ == nullptr) { + auto* p = CreateMaybeMessage<::eraftkv::ShardGroup>(GetArenaNoVirtual()); + shard_group_ = p; + } + return shard_group_; +} +inline ::eraftkv::ShardGroup* ClusterConfigChangeReq::mutable_shard_group() { + // @@protoc_insertion_point(field_mutable:eraftkv.ClusterConfigChangeReq.shard_group) + return _internal_mutable_shard_group(); +} +inline void ClusterConfigChangeReq::set_allocated_shard_group(::eraftkv::ShardGroup* shard_group) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual(); + if (message_arena == nullptr) { + delete shard_group_; + } + if (shard_group) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr; + if (message_arena != submessage_arena) { + shard_group = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shard_group, submessage_arena); + } + + } else { + + } + shard_group_ = shard_group; + // @@protoc_insertion_point(field_set_allocated:eraftkv.ClusterConfigChangeReq.shard_group) +} + // ------------------------------------------------------------------- // ClusterConfigChangeResp diff --git a/src/eraftkv_server.cc b/src/eraftkv_server.cc index 8d46d7ca..89646c7e 100644 --- a/src/eraftkv_server.cc +++ b/src/eraftkv_server.cc @@ -34,6 +34,8 @@ #include +#include "consts.h" + RaftServer* ERaftKvServer::raft_context_ = nullptr; std::map ERaftKvServer::ready_cond_vars_; @@ -163,6 +165,19 @@ grpc::Status ERaftKvServer::ClusterConfigChange( // return cluster topology, Currently, only single raft group are supported auto conf_change_req = const_cast(req); if (conf_change_req->change_type() == eraftkv::ChangeType::ShardsQuery) { + resp->set_success(true); + auto kvs = raft_context_->store_->PrefixScan(SG_META_PREFIX, 0, 256); + for (auto kv : kvs) { + eraftkv::ShardGroup* sg = new eraftkv::ShardGroup(); + sg->ParseFromString(kv.second); + auto new_sg = resp->add_shard_group(); + new_sg->CopyFrom(*sg); + delete sg; + } + return grpc::Status::OK; + } + + if (conf_change_req->change_type() == eraftkv::ChangeType::MetaMembersQuery) { resp->set_success(true); auto new_sg = resp->add_shard_group(); new_sg->set_id(0); diff --git a/src/eraftmeta.cc b/src/eraftmeta.cc index 17b120f8..289a561d 100644 --- a/src/eraftmeta.cc +++ b/src/eraftmeta.cc @@ -1,6 +1,6 @@ /** * @file eraftmeta.cc - * @author your name (you@domain.com) + * @author jay_jieliu@outlook.com * @brief * @version 0.1 * @date 2023-06-26 diff --git a/src/eraftmetaserver_test.cc b/src/eraftmetaserver_test.cc new file mode 100644 index 00000000..e3b8d795 --- /dev/null +++ b/src/eraftmetaserver_test.cc @@ -0,0 +1,116 @@ +// MIT License + +// Copyright (c) 2023 ERaftGroup + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +/** + * @file eraftmetaserver_tests.cc + * @author jay_jieliu@outlook.com + * @brief + * @version 0.1 + * @date 2023-07-01 + * + * @copyright Copyright (c) 2023 + * + */ + +#include +#include +#include +#include + +#include +#include + +#include "eraftkv.grpc.pb.h" +#include "eraftkv.pb.h" +#include "util.h" + +using eraftkv::ERaftKv; +using grpc::Channel; +using grpc::ClientContext; +using grpc::Status; + +#define SERVER_ADDR "172.18.0.2:8088" + +TEST(EraftMetaServerTests, TestMetaBasicOp) { + auto chan_ = + grpc::CreateChannel(SERVER_ADDR, grpc::InsecureChannelCredentials()); + std::unique_ptr stub_(ERaftKv::NewStub(chan_)); + ClientContext qm_conext; + eraftkv::ClusterConfigChangeReq qm_req; + qm_req.set_change_type(eraftkv::ChangeType::MetaMembersQuery); + eraftkv::ClusterConfigChangeResp qm_resp; + auto status = stub_->ClusterConfigChange(&qm_conext, qm_req, &qm_resp); + std::string leader_address = ""; + for (auto s : qm_resp.shard_group(0).servers()) { + if (s.id() == qm_resp.shard_group(0).leader_id()) { + leader_address = s.address(); + } + } + + ASSERT_FALSE(leader_address.empty()); + // TraceLog("DEBUG: leader ", leader_address); + + auto leader_chan = + grpc::CreateChannel(leader_address, grpc::InsecureChannelCredentials()); + std::unique_ptr leader_stub(ERaftKv::NewStub(leader_chan)); + + ClientContext add_sg_context; + eraftkv::ClusterConfigChangeReq req; + req.set_handle_server_type(eraftkv::HandleServerType::MetaServer); + req.set_shard_id(888); + req.mutable_shard_group()->set_id(888); + req.mutable_shard_group()->set_leader_id(0); + auto svr0 = req.mutable_shard_group()->add_servers(); + svr0->set_address("127.0.0.1:8080"); + svr0->set_id(0); + svr0->set_server_status(eraftkv::ServerStatus::Up); + auto svr1 = req.mutable_shard_group()->add_servers(); + svr1->set_address("127.0.0.1:8081"); + svr1->set_id(1); + svr1->set_server_status(eraftkv::ServerStatus::Up); + auto svr2 = req.mutable_shard_group()->add_servers(); + svr2->set_address("127.0.0.1:8080"); + svr2->set_id(2); + svr2->set_server_status(eraftkv::ServerStatus::Up); + req.set_change_type(eraftkv::ChangeType::ShardJoin); + eraftkv::ClusterConfigChangeResp resp; + auto status1 = leader_stub->ClusterConfigChange(&add_sg_context, req, &resp); + ASSERT_EQ(status1.ok(), true); + std::this_thread::sleep_for(std::chrono::seconds(2)); + + ClientContext query_context; + eraftkv::ClusterConfigChangeReq query_req; + query_req.set_handle_server_type(eraftkv::HandleServerType::MetaServer); + query_req.set_change_type(eraftkv::ChangeType::ShardsQuery); + eraftkv::ClusterConfigChangeResp query_resp; + auto status2 = + leader_stub->ClusterConfigChange(&query_context, query_req, &query_resp); + ASSERT_EQ(status2.ok(), true); + ASSERT_EQ(query_resp.shard_group_size(), 1); + ASSERT_EQ(query_resp.shard_group(0).servers_size(), 3); + ASSERT_EQ(query_resp.shard_group(0).id(), 888); +} + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/estatus.h b/src/estatus.h index 630d13e2..16fd7966 100644 --- a/src/estatus.h +++ b/src/estatus.h @@ -43,4 +43,5 @@ enum class EStatus { kNotSupport = 2, kPutKeyToRocksDBErr = 3, kError = 4, + kDelFromRocksDBErr = 5, }; diff --git a/src/listen_socket.cc b/src/listen_socket.cc index ef7dc3cb..167c5d8d 100644 --- a/src/listen_socket.cc +++ b/src/listen_socket.cc @@ -1,6 +1,6 @@ /** * @file listen_socket.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/listen_socket.h b/src/listen_socket.h index 758fbbf9..fce4a282 100644 --- a/src/listen_socket.h +++ b/src/listen_socket.h @@ -1,6 +1,6 @@ /** * @file listen_socket.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/net_thread_pool.cc b/src/net_thread_pool.cc index 033c8249..54919c03 100644 --- a/src/net_thread_pool.cc +++ b/src/net_thread_pool.cc @@ -1,6 +1,6 @@ /** * @file net_thread_pool.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/net_thread_pool.h b/src/net_thread_pool.h index 1616bb2f..3ca0790f 100644 --- a/src/net_thread_pool.h +++ b/src/net_thread_pool.h @@ -1,6 +1,6 @@ /** * @file net_thread_pool.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/network.h b/src/network.h index 141304ad..b8569795 100644 --- a/src/network.h +++ b/src/network.h @@ -22,7 +22,7 @@ /** * @file network.h - * @author ERaftGroup + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-05-21 diff --git a/src/poller.h b/src/poller.h index 8863969f..9dc979d4 100644 --- a/src/poller.h +++ b/src/poller.h @@ -1,6 +1,6 @@ /** * @file poller.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/proto_parser.cc b/src/proto_parser.cc index efafd965..8886383e 100644 --- a/src/proto_parser.cc +++ b/src/proto_parser.cc @@ -1,6 +1,6 @@ /** * @file proto_parser.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-16 diff --git a/src/proto_parser.h b/src/proto_parser.h index 9ed20c40..58657685 100644 --- a/src/proto_parser.h +++ b/src/proto_parser.h @@ -1,6 +1,6 @@ /** * @file proto_parser.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-16 diff --git a/src/rocksdb_storage_impl.cc b/src/rocksdb_storage_impl.cc index 56b1d9af..9eb48bca 100644 --- a/src/rocksdb_storage_impl.cc +++ b/src/rocksdb_storage_impl.cc @@ -33,6 +33,7 @@ #include "rocksdb_storage_impl.h" +#include "consts.h" #include "eraftkv.pb.h" #include "eraftkv_server.h" #include "util.h" @@ -172,6 +173,28 @@ EStatus RocksDBStorageImpl::ApplyLog(RaftServer* raft, } break; } + case eraftkv::ChangeType::ShardJoin: { + if (conf_change_req->handle_server_type() == + eraftkv::HandleServerType::MetaServer) { + std::string key; + key.append(SG_META_PREFIX); + EncodeDecodeTool::PutFixed64( + &key, static_cast(conf_change_req->shard_id())); + auto sg = conf_change_req->shard_group(); + std::string val = sg.SerializeAsString(); + raft->store_->PutKV(key, val); + } + } + case eraftkv::ChangeType::ShardLeave: { + if (conf_change_req->handle_server_type() == + eraftkv::HandleServerType::MetaServer) { + std::string key; + key.append(SG_META_PREFIX); + EncodeDecodeTool::PutFixed64( + &key, static_cast(conf_change_req->shard_id())); + raft->store_->DelKV(key); + } + } case eraftkv::ChangeType::SlotMove: { break; } @@ -335,6 +358,49 @@ std::string RocksDBStorageImpl::GetKV(std::string key) { return status.IsNotFound() ? "" : value; } +/** + * @brief + * + * @param prefix + * @param offset + * @param limit + * @return std::map + */ +std::map RocksDBStorageImpl::PrefixScan( + std::string prefix, + int64_t offset, + int64_t limit) { + auto iter = kv_db_->NewIterator(rocksdb::ReadOptions()); + iter->Seek(prefix); + while (iter->Valid() && offset > 0) { + offset -= 1; + iter->Next(); + } + if (!iter->Valid()) { + return std::map{}; + } + std::map kvs; + int64_t res_count = 0; + while (iter->Valid() && limit > res_count) { + kvs.insert(std::make_pair( + iter->key().ToString(), iter->value().ToString())); + iter->Next(); + res_count += 1; + } + return kvs; +} + +/** + * @brief + * + * @param key + * @return EStatus + */ +EStatus RocksDBStorageImpl::DelKV(std::string key) { + auto status = kv_db_->Delete(rocksdb::WriteOptions(), key); + return status.ok() ? EStatus::kOk : EStatus::kDelFromRocksDBErr; +} + /** * @brief Construct a new RocksDB Storage Impl object * diff --git a/src/rocksdb_storage_impl.h b/src/rocksdb_storage_impl.h index afc77d02..043bb1e1 100644 --- a/src/rocksdb_storage_impl.h +++ b/src/rocksdb_storage_impl.h @@ -159,6 +159,26 @@ class RocksDBStorageImpl : public Storage { */ std::string GetKV(std::string key); + /** + * @brief + * + * @param prefix + * @param offset + * @param limit + * @return std::map + */ + std::map PrefixScan(std::string prefix, + int64_t offset, + int64_t limit); + + /** + * @brief + * + * @param key + * @return EStatus + */ + EStatus DelKV(std::string key); + /** * @brief Construct a new RocksDB Storage Impl object * diff --git a/src/server.cc b/src/server.cc index bd1be49c..10cda57f 100644 --- a/src/server.cc +++ b/src/server.cc @@ -1,6 +1,6 @@ /** * @file server.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/server.h b/src/server.h index 6beaeee0..ff552317 100644 --- a/src/server.h +++ b/src/server.h @@ -1,6 +1,6 @@ /** * @file server.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/socket.cc b/src/socket.cc index 113d23e9..1d61c7df 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -1,6 +1,6 @@ /** * @file socket.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/socket.h b/src/socket.h index 6657e1f3..b73c9f66 100644 --- a/src/socket.h +++ b/src/socket.h @@ -1,6 +1,6 @@ /** * @file socket.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/storage.h b/src/storage.h index 2d4f54ed..6285b33a 100644 --- a/src/storage.h +++ b/src/storage.h @@ -168,4 +168,24 @@ class Storage { * @return std::string */ virtual std::string GetKV(std::string key) = 0; + + /** + * @brief + * + * @param prefix + * @param offset + * @param limit + * @return std::map + */ + virtual std::map PrefixScan(std::string prefix, + int64_t offset, + int64_t limit) = 0; + + /** + * @brief + * + * @param key + * @return EStatus + */ + virtual EStatus DelKV(std::string key) = 0; }; diff --git a/src/stream_socket.cc b/src/stream_socket.cc index e9268548..e538df76 100644 --- a/src/stream_socket.cc +++ b/src/stream_socket.cc @@ -1,6 +1,6 @@ /** * @file stream_socket.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/stream_socket.h b/src/stream_socket.h index ebd0fd70..d9423f30 100644 --- a/src/stream_socket.h +++ b/src/stream_socket.h @@ -1,6 +1,6 @@ /** * @file stream_socket.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/task_manager.cc b/src/task_manager.cc index f6717563..8dce5880 100644 --- a/src/task_manager.cc +++ b/src/task_manager.cc @@ -1,6 +1,6 @@ /** * @file task_manager.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/task_manager.h b/src/task_manager.h index c6bb53a2..e3624662 100644 --- a/src/task_manager.h +++ b/src/task_manager.h @@ -1,6 +1,6 @@ /** * @file task_manager.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/thread_pool.cc b/src/thread_pool.cc index b333d1b5..b44cbc1f 100644 --- a/src/thread_pool.cc +++ b/src/thread_pool.cc @@ -1,6 +1,6 @@ /** * @file thread_pool.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/thread_pool.h b/src/thread_pool.h index 753a88b2..b10fdca0 100644 --- a/src/thread_pool.h +++ b/src/thread_pool.h @@ -1,6 +1,6 @@ /** * @file thread_pool.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/unbounded_buffer.cc b/src/unbounded_buffer.cc index f65c9e6b..30cbd1e5 100644 --- a/src/unbounded_buffer.cc +++ b/src/unbounded_buffer.cc @@ -1,6 +1,6 @@ /** * @file unbounded_buffer.cc - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/src/unbounded_buffer.h b/src/unbounded_buffer.h index 04e2f66f..546af4a0 100644 --- a/src/unbounded_buffer.h +++ b/src/unbounded_buffer.h @@ -1,6 +1,6 @@ /** * @file unbounded_buffer.h - * @author your name (you@domain.com) + * @author https://github.com/loveyacper/Qedis * @brief * @version 0.1 * @date 2023-06-17 diff --git a/utils/format-code.sh b/utils/format-code.sh index 0ab62b27..86cc2ee5 100644 --- a/utils/format-code.sh +++ b/utils/format-code.sh @@ -64,3 +64,4 @@ clang-format -style=file --sort-includes -i ${SRCPATH}/src/info_command_handler. clang-format -style=file --sort-includes -i ${SRCPATH}/src/set_command_handler.cc clang-format -style=file --sort-includes -i ${SRCPATH}/src/get_command_handler.cc clang-format -style=file --sort-includes -i ${SRCPATH}/src/unknow_command_handler.cc +clang-format -style=file --sort-includes -i ${SRCPATH}/src/eraftmetaserver_test.cc