Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiaoshuai123 committed Apr 15, 2024
2 parents 4fdbf7e + 74c584b commit 851d5b6
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 24 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/import_braft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Import BRaft Actions (Temporary)

on:
push:
pull_request:
branches: [ "import-braft" ]

jobs:
check_format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build
run: bash ci/build.sh

- name: Check Format
working-directory: ${{ github.workspace }}/build
run: make check-format

build_on_macos:
runs-on: macos-latest
needs: check_format

steps:
- uses: actions/checkout@v4

- name: Build
env:
CPLUS_INCLUDE_PATH: /usr/local/opt/openssl/include
run: |
sh build.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tests
go mod tidy
go test ./pikiwidb_suite_test.go ./consistency_test.go -v
build_on_ubuntu:
runs-on: ubuntu-latest
needs: check_format

steps:
- uses: actions/checkout@v4

- name: Build
run: |
bash build.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tests
go mod tidy
go test ./pikiwidb_suite_test.go ./consistency_test.go -v
4 changes: 2 additions & 2 deletions cmake/braft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ExternalProject_Add(
extern_braft
${EXTERNAL_PROJECT_LOG_ARGS}
DEPENDS brpc
URL "https://github.com/baidu/braft/archive/v1.1.2.tar.gz"
URL_HASH SHA256=bb3705f61874f8488e616ae38464efdec1a20610ddd6cd82468adc814488f14e
URL "https://github.com/pikiwidb/braft/archive/refs/heads/stable.zip"
URL_HASH SHA256=e73831f9768ac57d07f01ed81a11c8368e259c25315a960c29a6422f31f42fd1
PREFIX ${BRAFT_SOURCES_DIR}
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
Expand Down
3 changes: 1 addition & 2 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ enum ClientFlag {
kClientFlagMaster = (1 << 3),
};

class DB;
struct PSlaveInfo;

class PClient : public std::enable_shared_from_this<PClient>, public CmdRes {
Expand Down Expand Up @@ -250,4 +249,4 @@ class PClient : public std::enable_shared_from_this<PClient>, public CmdRes {

static thread_local PClient* s_current;
};
} // namespace pikiwidb
} // namespace pikiwidb
7 changes: 4 additions & 3 deletions src/cmd_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#include "cmd_admin.h"
#include "braft/raft.h"
#include "praft.h"

#include "cmd_admin.h"
#include "praft/praft.h"
#include "store.h"

namespace pikiwidb {
Expand Down Expand Up @@ -154,4 +155,4 @@ void InfoCmd::DoCmd(PClient* client) {
}
}

} // namespace pikiwidb
} // namespace pikiwidb
18 changes: 10 additions & 8 deletions src/cmd_raft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#include "cmd_raft.h"

#include <cstdint>
#include <optional>
#include <string>

#include "net/event_loop.h"
#include "praft/praft.h"
#include "pstd/log.h"
#include "pstd/pstd_string.h"

#include "client.h"
#include "cmd_raft.h"
#include "event_loop.h"
#include "log.h"
#include "pikiwidb.h"
#include "praft.h"
#include "pstd_string.h"

namespace pikiwidb {

Expand All @@ -36,10 +38,10 @@ void RaftNodeCmd::DoCmd(PClient* client) {
DoCmdAdd(client);
} else if (!strcasecmp(cmd.c_str(), "REMOVE")) {
DoCmdRemove(client);
} else if (!strcasecmp(cmd.c_str(), "DSS")) {
} else if (!strcasecmp(cmd.c_str(), "DOSNAPSHOT")) {
DoCmdSnapshot(client);
} else {
client->SetRes(CmdRes::kErrOther, "RAFT.NODE supports ADD / REMOVE only");
client->SetRes(CmdRes::kErrOther, "RAFT.NODE supports ADD / REMOVE / DOSNAPSHOT only");
}
}

Expand Down Expand Up @@ -180,4 +182,4 @@ void RaftClusterCmd::DoCmdJoin(PClient* client) {
client->Clear();
}

} // namespace pikiwidb
} // namespace pikiwidb
2 changes: 1 addition & 1 deletion src/cmd_raft.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ class RaftClusterCmd : public BaseCmd {
static constexpr std::string_view kJoinCmd = "JOIN";
};

} // namespace pikiwidb
} // namespace pikiwidb
3 changes: 2 additions & 1 deletion src/cmd_table_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

#include "cmd_table_manager.h"

#include <memory>

#include "cmd_admin.h"
Expand All @@ -14,7 +16,6 @@
#include "cmd_list.h"
#include "cmd_raft.h"
#include "cmd_set.h"
#include "cmd_table_manager.h"
#include "cmd_zset.h"

namespace pikiwidb {
Expand Down
5 changes: 2 additions & 3 deletions src/db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

#include "db.h"

#include "praft/praft.h"
#include "pstd/log.h"

#include "checkpoint_manager.h"
#include "config.h"
#include "praft/praft.h"
#include "pstd/log.h"

extern pikiwidb::PConfig g_config;

Expand Down
3 changes: 2 additions & 1 deletion src/pikiwidb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//
// PikiwiDB.cc

#include "pikiwidb.h"

#include <sys/fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
Expand All @@ -21,7 +23,6 @@
#include "client.h"
#include "config.h"
#include "helper.h"
#include "pikiwidb.h"
#include "pikiwidb_logo.h"
#include "slow_log.h"
#include "store.h"
Expand Down
1 change: 0 additions & 1 deletion src/praft/praft.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <filesystem>
#include <future>
#include <memory>
#include <mutex>
#include <string>
#include <tuple>
Expand Down
1 change: 1 addition & 0 deletions src/storage/src/log_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#pragma once

#include <array>
#include <atomic>
#include <deque>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion src/storage/src/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Status Storage::CreateCheckpoint(const std::string& dump_path, int i) {

// 3) Create a checkpoint
std::unique_ptr<rocksdb::Checkpoint> checkpoint_guard(checkpoint);
s = checkpoint->CreateCheckpoint(tmp_dir, kFlush, nullptr);
s = checkpoint->CreateCheckpoint(tmp_dir, kNoFlush, nullptr);
if (!s.ok()) {
WARN("DB{}'s RocksDB {} create checkpoint failed!. Error: {}", db_id_, i, s.ToString());
return s;
Expand Down
2 changes: 1 addition & 1 deletion src/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#define GLOG_NO_ABBREVIATED_SEVERITIES

#include <map>
#include <memory>
#include <shared_mutex>
#include <vector>

#include "db.h"

namespace pikiwidb {
Expand Down

0 comments on commit 851d5b6

Please sign in to comment.