未验证 提交 871c9b32 编写于 作者: 羽飞's avatar 羽飞 提交者: GitHub

mvcc trx (#156)

### What problem were solved in this pull request?

Issue Number: close #155 close #135 

Problem:
实现了简单的事务处理。
当前支持并发事务数据.

### What is changed and how it works?
- 支持两种事务模式:Vacuous和MVCC。
  Vacuous 事务模式算是没有事务,它的事务接口什么都不做。
MVCC 是多版本并发控制(Multi-Version Concurrency
Control),使用多个版本保留记录数据。启动miniob时增加运行时选项 -t mvcc可以选择mvcc。

- MVCC:简单模式的多版本并发控制。
  当前miniob仅包含insert和delete操作,因此数据最多包含两个版本,并且不需要在record中保留版本链表信息;
  不支持持久化;
  没有做垃圾回收;
  遗留一个BUG:在提交时没有保证提交的数据一次性对外可见;
  使用简单的写写冲突策略:检测到要修改的数据当前有人在修改,就回退

- 编译MINIOB时使用 -DCONCURRENCY=ON 才会支持并发
支持各个模块并发处理,包括buffer pool、bplus、record
manager。如果编译时没有使用CONCURRENCY选项,则保持原样,不支持并发,保持系统的简单性。

- 编译时增加 -DDEBUG=ON 还会增加并发调试日志与严格的运行时检测(ASSERT语句)
- 当前版本代码中包含了bplus tree和record manager的并发测试,参考benchmark目录下的代码。

### Other information
上级 7ec7ab11
......@@ -6,7 +6,6 @@
build/*
build_*
cmake-build-*/*
.vscode/*
.DS_Store
.idea
.ccls-cache
......
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/${defaultBuildTask}/bin/observer",
"args": ["-f", "${workspaceFolder}/etc/observer.ini", "-s", "miniob.sock"],
"cwd": "${workspaceFolder}/${defaultBuildTask}/"
}
]
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "init",
"type": "shell",
"command": "sudo -E env PATH=$PATH bash ${workspaceFolder}/build.sh init"
},
{
"label": "build_debug",
"type": "shell",
"command": "bash build.sh debug",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "build_release",
"type": "shell",
"command": "bash build.sh release"
},
{
"label": "build_release_asan",
"type": "shell",
"command": "bash build.sh release_asan"
}
]
}
\ No newline at end of file
......@@ -40,7 +40,6 @@ ELSE()
ENDIF(WIN32)
# This is for clangd plugin for vscode
#SET(CMAKE_COMMON_FLAGS ${CMAKE_COMMON_FLAGS} " -Wstring-plus-int -Wsizeof-array-argument -Wunused-variable -Wmissing-braces")
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -Wall -DCMAKE_EXPORT_COMPILE_COMMANDS=1")
IF(DEBUG)
MESSAGE("DEBUG has been set as TRUE ${DEBUG}")
......
OceanBase miniob
Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under [Mulan PSL v2.](http://license.coscl.org.cn/MulanPSL2)
......@@ -114,3 +114,19 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================== googl benchmark ===========================
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,7 +12,6 @@ See the Mulan PSL v2 for more details. */
// Created by Wangyunlai on 2023/03/14
//
#include <inttypes.h>
#include <random>
#include <stdexcept>
#include <benchmark/benchmark.h>
......@@ -20,28 +19,12 @@ See the Mulan PSL v2 for more details. */
#include "storage/default/disk_buffer_pool.h"
#include "rc.h"
#include "common/log/log.h"
#include "integer_generator.h"
using namespace std;
using namespace common;
using namespace benchmark;
class IntegerGenerator
{
public:
IntegerGenerator(int min, int max)
: distrib_(min, max)
{}
int next()
{
return distrib_(rd_);
}
private:
random_device rd_;
uniform_int_distribution<> distrib_;
};
once_flag init_bpm_flag;
BufferPoolManager bpm{512};
......@@ -116,7 +99,7 @@ public:
for (uint32_t value = min; value < max; ++value) {
const char *key = reinterpret_cast<const char *>(&value);
RID rid(value, value);
RC rc = handler_.insert_entry(key, &rid);
[[maybe_unused]] RC rc = handler_.insert_entry(key, &rid);
ASSERT(rc == RC::SUCCESS, "failed to insert entry into btree. key=%" PRIu32, value);
}
}
......
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Wangyunlai on 2023/05/04
//
#include <random>
class IntegerGenerator
{
public:
IntegerGenerator(int min, int max)
: distrib_(min, max)
{}
int next()
{
return distrib_(rd_);
}
private:
std::random_device rd_;
std::uniform_int_distribution<> distrib_;
};
\ No newline at end of file
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Wangyunlai on 2023/05/04
//
#include <inttypes.h>
#include <random>
#include <stdexcept>
#include <benchmark/benchmark.h>
#include "storage/record/record_manager.h"
#include "storage/default/disk_buffer_pool.h"
#include "storage/common/condition_filter.h"
#include "storage/trx/vacuous_trx.h"
#include "rc.h"
#include "common/log/log.h"
#include "integer_generator.h"
using namespace std;
using namespace common;
using namespace benchmark;
once_flag init_bpm_flag;
BufferPoolManager bpm{512};
struct Stat
{
int64_t insert_success_count = 0;
int64_t insert_other_count = 0;
int64_t delete_success_count = 0;
int64_t not_exist_count = 0;
int64_t delete_other_count = 0;
int64_t scan_success_count = 0;
int64_t scan_open_failed_count = 0;
int64_t mismatch_count = 0;
int64_t scan_other_count = 0;
};
struct TestRecord
{
int32_t int_fields[15];
};
class TestConditionFilter : public ConditionFilter
{
public:
TestConditionFilter(int32_t begin, int32_t end)
: begin_(begin), end_(end)
{}
bool filter(const Record &rec) const override
{
const char *data = rec.data();
int32_t value = *(int32_t *)data;
return value >= begin_ && value <= end_;
}
private:
int32_t begin_;
int32_t end_;
};
class BenchmarkBase : public Fixture
{
public:
BenchmarkBase()
{
}
virtual ~BenchmarkBase()
{
BufferPoolManager::set_instance(nullptr);
}
virtual string Name() const = 0;
string record_filename() const { return this->Name() + ".record"; }
virtual void SetUp(const State &state)
{
if (0 != state.thread_index()) {
return;
}
string log_name = this->Name() + ".log";
string record_filename = this->record_filename();
LoggerFactory::init_default(log_name.c_str(), LOG_LEVEL_TRACE);
std::call_once(init_bpm_flag, []() { BufferPoolManager::set_instance(&bpm); });
::remove(record_filename.c_str());
RC rc = bpm.create_file(record_filename.c_str());
if (rc != RC::SUCCESS) {
LOG_WARN("failed to create record buffer pool file. filename=%s, rc=%s",
record_filename.c_str(), strrc(rc));
throw runtime_error("failed to create record buffer pool file.");
}
rc = bpm.open_file(record_filename.c_str(), buffer_pool_);
if (rc != RC::SUCCESS) {
LOG_WARN("failed to open record file. filename=%s, rc=%s",
record_filename.c_str(), strrc(rc));
throw runtime_error("failed to open record file");
}
rc = handler_.init(buffer_pool_);
if (rc != RC::SUCCESS) {
LOG_WARN("failed to init record file handler. rc=%s", strrc(rc));
throw runtime_error("failed to init record file handler");
}
LOG_INFO("test %s setup done. threads=%d, thread index=%d",
this->Name().c_str(), state.threads(), state.thread_index());
}
virtual void TearDown(const State &state)
{
if (0 != state.thread_index()) {
return;
}
handler_.close();
bpm.close_file(this->record_filename().c_str());
buffer_pool_ = nullptr;
LOG_INFO("test %s teardown done. threads=%d, thread index=%d",
this->Name().c_str(), state.threads(), state.thread_index());
}
void FillUp(int32_t min, int32_t max, vector<RID> &rids)
{
rids.reserve(max - min);
RID rid;
TestRecord record;
vector<int32_t> record_values;
record_values.reserve(max - min);
for (int32_t value = min; value < max; ++value) {
record_values.push_back(value);
}
random_device rd;
mt19937 random_generator(rd());
shuffle(record_values.begin(), record_values.end(), random_generator);
for (int32_t record_value : record_values) {
record.int_fields[0] = record_value;
[[maybe_unused]] RC rc = handler_.insert_record(reinterpret_cast<const char *>(&record), sizeof(record), &rid);
ASSERT(rc == RC::SUCCESS, "failed to insert record into record file. record value=%" PRIu32, record_value);
rids.push_back(rid);
}
LOG_INFO("fill up done. min=%" PRIu32 ", max=%" PRIu32 ", distance=%" PRIu32, min, max, (max-min));
}
uint32_t GetRangeMax(const State &state) const
{
uint32_t max = static_cast<uint32_t>(state.range(0) * 3);
if (max <= 0) {
max = (1 << 31);
}
return max;
}
void Insert(int32_t value, Stat &stat, RID &rid)
{
TestRecord record;
record.int_fields[0] = value;
RC rc = handler_.insert_record(reinterpret_cast<const char *>(&record), sizeof(record), &rid);
switch (rc) {
case RC::SUCCESS: {
stat.insert_success_count++;
} break;
default: {
stat.insert_other_count++;
} break;
}
}
void Delete(const RID &rid, Stat &stat)
{
RC rc = handler_.delete_record(&rid);
switch (rc) {
case RC::SUCCESS: {
stat.delete_success_count++;
} break;
case RC::RECORD_RECORD_NOT_EXIST: {
stat.not_exist_count++;
} break;
default: {
stat.delete_other_count++;
} break;
}
}
void Scan(int32_t begin, int32_t end, Stat &stat)
{
TestConditionFilter condition_filter(begin, end);
RecordFileScanner scanner;
VacuousTrx trx;
RC rc = scanner.open_scan(nullptr/*table*/, *buffer_pool_, &trx, true/*readonly*/, &condition_filter);
if (rc != RC::SUCCESS) {
stat.scan_open_failed_count++;
} else {
Record record;
int32_t count = 0;
while (scanner.has_next()) {
rc = scanner.next(record);
ASSERT(rc == RC::SUCCESS, "failed to get record, rc=%s", strrc(rc));
count++;
}
if (rc != RC::SUCCESS) {
stat.scan_other_count++;
} else if (count != (end - begin + 1)) {
stat.mismatch_count++;
} else {
stat.scan_success_count++;
}
scanner.close_scan();
}
}
protected:
DiskBufferPool * buffer_pool_ = nullptr;
RecordFileHandler handler_;
};
////////////////////////////////////////////////////////////////////////////////
struct InsertionBenchmark : public BenchmarkBase
{
string Name() const override { return "insertion"; }
};
BENCHMARK_DEFINE_F(InsertionBenchmark, Insertion) (State &state)
{
IntegerGenerator generator(1, 1 << 31);
Stat stat;
RID rid;
for (auto _ : state) {
Insert(generator.next(), stat, rid);
}
state.counters["success"] = Counter(stat.insert_success_count, Counter::kIsRate);
state.counters["other"] = Counter(stat.insert_other_count, Counter::kIsRate);
}
BENCHMARK_REGISTER_F(InsertionBenchmark, Insertion)->Threads(10);
////////////////////////////////////////////////////////////////////////////////
class DeletionBenchmark : public BenchmarkBase
{
public:
string Name() const override { return "deletion"; }
void SetUp(const State &state) override
{
if (0 != state.thread_index()) {
return;
}
BenchmarkBase::SetUp(state);
uint32_t max = GetRangeMax(state);
ASSERT(max > 0, "invalid argument count. %ld", state.range(0));
FillUp(0, max, rids_);
}
protected:
vector<RID> rids_;
};
BENCHMARK_DEFINE_F(DeletionBenchmark, Deletion) (State &state)
{
IntegerGenerator generator(0, static_cast<int>(rids_.size()));
Stat stat;
for (auto _ : state) {
int32_t value = generator.next();
RID rid = rids_[value];
Delete(rid, stat);
}
state.counters["success"] = Counter(stat.delete_success_count, Counter::kIsRate);
state.counters["not_exist"] = Counter(stat.not_exist_count, Counter::kIsRate);
state.counters["other"] = Counter(stat.delete_other_count, Counter::kIsRate);
}
BENCHMARK_REGISTER_F(DeletionBenchmark, Deletion)->Threads(10)->Arg(4* 10000);
////////////////////////////////////////////////////////////////////////////////
class ScanBenchmark : public BenchmarkBase
{
public:
string Name() const override { return "scan"; }
void SetUp(const State &state) override
{
if (0 != state.thread_index()) {
return;
}
BenchmarkBase::SetUp(state);
int32_t max = state.range(0) * 3;
ASSERT(max > 0, "invalid argument count. %ld", state.range(0));
vector<RID> rids;
FillUp(0, max, rids);
}
};
BENCHMARK_DEFINE_F(ScanBenchmark, Scan) (State &state)
{
int max_range_size = 100;
uint32_t max = GetRangeMax(state);
IntegerGenerator begin_generator(1, max - max_range_size);
IntegerGenerator range_generator(1, max_range_size);
Stat stat;
for (auto _ : state) {
int32_t begin = begin_generator.next();
int32_t end = begin + range_generator.next();
Scan(begin, end, stat);
}
state.counters["success"] = Counter(stat.scan_success_count, Counter::kIsRate);
state.counters["open_failed_count"] = Counter(stat.scan_open_failed_count, Counter::kIsRate);
state.counters["mismatch_number_count"] = Counter(stat.mismatch_count, Counter::kIsRate);
state.counters["other"] = Counter(stat.scan_other_count, Counter::kIsRate);
}
BENCHMARK_REGISTER_F(ScanBenchmark, Scan)->Threads(10)->Arg(4 * 10000);
////////////////////////////////////////////////////////////////////////////////
struct MixtureBenchmark : public BenchmarkBase
{
string Name() const override { return "mixture"; }
};
BENCHMARK_DEFINE_F(MixtureBenchmark, Mixture) (State &state)
{
pair<int32_t, int32_t> data_range{0, GetRangeMax(state)};
pair<int32_t, int32_t> scan_range{1, 100};
IntegerGenerator data_generator(data_range.first, data_range.second);
IntegerGenerator scan_range_generator(scan_range.first, scan_range.second);
IntegerGenerator operation_generator(0, 2);
Stat stat;
vector<RID> rids;
for (auto _ : state) {
int operation_type = operation_generator.next();
switch (operation_type) {
case 0: { // insert
int32_t value = data_generator.next();
RID rid;
Insert(value, stat, rid);
if (rids.size() < 1000000) {
rids.push_back(rid);
}
} break;
case 1: { // delete
int32_t index = data_generator.next();
if (!rids.empty()) {
index %= rids.size();
RID rid = rids[index];
rids.erase(rids.begin() + index);
Delete(rid, stat);
}
} break;
case 2: { // scan
int32_t begin = data_generator.next();
int32_t end = begin + scan_range_generator.next();
Scan(begin, end, stat);
} break;
default: {
ASSERT(false, "should not happen. operation=%ld", operation_type);
}
}
}
state.counters.insert({
{"insert_success", Counter(stat.insert_success_count, Counter::kIsRate)},
{"insert_other", Counter(stat.insert_other_count, Counter::kIsRate)},
{"delete_success", Counter(stat.delete_success_count, Counter::kIsRate)},
{"delete_other", Counter(stat.delete_other_count, Counter::kIsRate)},
{"delete_not_exist", Counter(stat.not_exist_count, Counter::kIsRate)},
{"scan_success", Counter(stat.scan_success_count, Counter::kIsRate)},
{"scan_other", Counter(stat.scan_other_count, Counter::kIsRate)},
{"scan_mismatch", Counter(stat.mismatch_count, Counter::kIsRate)},
{"scan_open_failed", Counter(stat.scan_open_failed_count, Counter::kIsRate)}
});
}
BENCHMARK_REGISTER_F(MixtureBenchmark, Mixture)->Threads(10)->Arg(4 * 10000);
////////////////////////////////////////////////////////////////////////////////
BENCHMARK_MAIN();
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Wangyunlai on 2023/04/28
//
#if 0
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <inttypes.h>
#include <random>
#include <stdexcept>
#include <benchmark/benchmark.h>
#include "rc.h"
#include "common/log/log.h"
using namespace std;
using namespace common;
using namespace benchmark;
class Client
{
public:
Client() = default;
virtual ~Client();
RC init(string host, int port);
RC init(string unix_socket);
RC close();
RC send_sql(const char *sql);
RC receive_result(ostream &result_stream);
RC execute(const char *sql, ostream &result_stream);
private:
string server_addr_;
int socket_ = -1;
};
class BenchmarkBase : public Fixture
{
public:
BenchmarkBase()
{}
virtual ~BenchmarkBase()
{}
string Name() const override = 0;
void SetUp(const State &state) override
{
}
void TearDown(const State &state) override
{
}
};
Client::~Client()
{
this->close();
}
RC Client::init(string host, int port)
{
struct hostent *host;
struct sockaddr_in serv_addr;
if ((host = gethostbyname(host.c_str())) == NULL) {
LOG_WARN("failed to gethostbyname. rc=%s", strerror(errno));
return RC::IOERR;
}
int sockfd = -1;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
LOG_WARN("failed to create socket. rc=%s", strerror(errno));
return RC::IOERROR;
}
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons((uint16_t)port);
serv_addr.sin_addr = *((struct in_addr *)host->h_addr);
if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr)) == -1) {
LOG_WARN("failed to connect to server. rc=%s", strerror(errno));
return RC::IOERROR;
}
socket_ = sockfd;
server_addr_ = string("tcp://") + host + string(":") + to_string(port);
LOG_INFO("connect to server sucess");
return RC::SUCCESS;
}
RC Client::init(string unix_socket)
{
int socket_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (socket_fd < 0) {
LOG_WARN("failed to create socket. rc=%s", strerror(errno));
return RC::IOERROR;
}
struct sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, unix_socket.c_str());
int ret = connect(socket_fd, (struct sockaddr*)&addr, sizeof(addr));
if (ret == -1) {
LOG_WARN("failed to connect to server. rc=%s", strerror(errno));
return RC::IOERROR;
}
socket_ = socket_fd;
server_addr_ = string("unix://") + unix_socket;
LOG_INFO("connect to unix socket success");
return RC::SUCCESS;
}
RC Client::close()
{
if (socket_ >= 0) {
LOG_INFO("close connection. server addr: %s", server_addr_.c_str());
::close(socket_);
socket_ = -1;
}
return RC::SUCESS;
}
RC Client::send_sql(const char *sql)
{
int ret = writen(socket_, sql, strlen(sql) + 1);
if (ret != 0) {
LOG_WARN("failed to send sql to server. server=%s, rc=%s", server_addr_.c_str(), strerror(ret));
return RC::IOERROR;
}
return RC::SUCCESS;
}
RC Client::receive_result(ostream &result_stream)
{
char tmp_buf[256];
// 持续接收消息,直到遇到'\0'。将'\0'遇到的后续数据直接丢弃没有处理,因为目前仅支持一收一发的模式
int read_len = 0;
while (true) {
read_len = ::read(socket_, tmp_buf, sizeof(tmp_buf));
if (read_len < 0) {
if (errno == EAGAIN) {
continue;
}
break;
}
if (read_len == 0) {
break;
}
result_stream.write(tmp_buf, read_len);
bool msg_end = false;
for (int i = 0; i < read_len; i++) {
if (tmp_buf[i] == 0) {
msg_end = true;
break;
}
}
if (msg_end) {
break;
}
}
}
RC Client::execute(const char *sql, ostream &result_stream)
{
RC rc = this->send_sql(sql);
if (rc != RC::SUCCESS) {
return rc;
}
return receive_result(result_stream);
}
#endif
int main(void)
{
return 0;
}
\ No newline at end of file
#!/bin/bash
TOPDIR=`readlink -f \`dirname $0\``
# readlink -f cannot work on mac
TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
BUILD_SH=$TOPDIR/build.sh
CMAKE_COMMAND="cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
......@@ -17,7 +19,7 @@ function usage
{
echo "Usage:"
echo "./build.sh -h"
echo "./build.sh init"
echo "./build.sh init # install dependence"
echo "./build.sh clean"
echo "./build.sh [BuildType] [--make [MakeOptions]]"
echo ""
......@@ -75,7 +77,7 @@ function do_init
# build libevent
cd ${TOPDIR}/deps/3rd/libevent && \
git checkout release-2.1.12-stable && \
mkdir build && \
mkdir -p build && \
cd build && \
cmake .. -DEVENT__DISABLE_OPENSSL=ON && \
make -j4 && \
......@@ -83,7 +85,7 @@ function do_init
# build googletest
cd ${TOPDIR}/deps/3rd/googletest && \
mkdir build && \
mkdir -p build && \
cd build && \
cmake .. && \
make -j4 && \
......@@ -91,7 +93,7 @@ function do_init
# build google benchmark
cd ${TOPDIR}/deps/3rd/benchmark && \
mkdir build && \
mkdir -p build && \
cd build && \
cmake .. -DBENCHMARK_ENABLE_TESTING=OFF -DBENCHMARK_INSTALL_DOCS=OFF -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_USE_BUNDLED_GTEST=OFF -DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF && \
make -j4 && \
......@@ -99,7 +101,7 @@ function do_init
# build jsoncpp
cd ${TOPDIR}/deps/3rd/jsoncpp && \
mkdir build && \
mkdir -p build && \
cd build && \
cmake -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF .. && \
make && \
......@@ -119,7 +121,7 @@ function do_build
TYPE=$1; shift
prepare_build_dir $TYPE || return
echo "${CMAKE_COMMAND} ${TOPDIR} $@"
${CMAKE_COMMAND} ${TOPDIR} $@
${CMAKE_COMMAND} -S ${TOPDIR} $@
}
function do_clean
......
Subproject commit 6e1826dd7730330536e1838824bddd0d4d8adb0d
Subproject commit 5df3037d10556bfcb675bc73e516978b75fc7bc7
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_DEFS_H__
#define __COMMON_DEFS_H__
#pragma once
#include <errno.h>
#include <fstream>
......@@ -85,4 +84,3 @@ typedef long long s64_t;
#define EPSILON (1E-6)
} // namespace common
#endif //__COMMON_DEFS_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_IO_IO_H__
#define __COMMON_IO_IO_H__
#pragma once
#include <string>
#include <vector>
......@@ -58,8 +57,15 @@ int touch(const std::string &fileName);
*/
int getFileSize(const char *filePath, u64_t &fileLen);
/**
* @brief 一次性写入所有指定数据
*
* @param fd 写入的描述符
* @param buf 写入的数据
* @param size 写入多少数据
* @return int 0 表示成功,否则返回errno
*/
int writen(int fd, const void *buf, int size);
int readn(int fd, void *buf, int size);
} // namespace common
#endif /* __COMMON_IO_IO_H__ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_IO_SELECT_DIR_H__
#define __COMMON_IO_SELECT_DIR_H__
#pragma once
#include <string>
namespace common {
......@@ -28,4 +27,3 @@ public:
};
} // namespace common
#endif /* __COMMON_IO_SELECT_DIR_H__ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by wangyunlai on 2021/5/7.
//
#ifndef __COMMON_LANG_BITMAP_H__
#define __COMMON_LANG_BITMAP_H__
#pragma once
namespace common {
......@@ -39,5 +38,3 @@ private:
};
} // namespace common
#endif // __COMMON_LANG_BITMAP_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -60,4 +60,4 @@ int compare_string(void *arg1, int arg1_max_length, void *arg2, int arg2_max_len
return 0;
}
}
\ No newline at end of file
} // namespace common
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -347,4 +347,85 @@ void SharedMutex::unlock_shared()
#endif // CONCURRENCY end
} // namespace common
\ No newline at end of file
////////////////////////////////////////////////////////////////////////////////
#ifndef CONCURRENCY
void RecursiveSharedMutex::lock_shared()
{}
bool RecursiveSharedMutex::try_lock_shared()
{
return true;
}
void RecursiveSharedMutex::unlock_shared()
{}
void RecursiveSharedMutex::lock()
{}
void RecursiveSharedMutex::unlock()
{}
#else // ifdef CONCURRENCY
void RecursiveSharedMutex::lock_shared()
{
unique_lock<mutex> lock(mutex_);
while (exclusive_lock_count_ > 0) {
shared_lock_cv_.wait(lock);
}
shared_lock_count_++;
}
bool RecursiveSharedMutex::try_lock_shared()
{
unique_lock<mutex> lock(mutex_);
if (exclusive_lock_count_ == 0) {
shared_lock_count_++;
return true;
}
return false;
}
void RecursiveSharedMutex::unlock_shared()
{
unique_lock<mutex> lock(mutex_);
shared_lock_count_--;
if (shared_lock_count_ == 0) {
exclusive_lock_cv_.notify_one();
}
}
void RecursiveSharedMutex::lock()
{
unique_lock<mutex> lock(mutex_);
while (shared_lock_count_ > 0 || exclusive_lock_count_ > 0) {
if (recursive_owner_ == this_thread::get_id()) {
recursive_count_++;
return;
}
exclusive_lock_cv_.wait(lock);
}
recursive_owner_ = this_thread::get_id();
recursive_count_ = 1;
exclusive_lock_count_++;
}
void RecursiveSharedMutex::unlock()
{
unique_lock<mutex> lock(mutex_);
if (recursive_owner_ == this_thread::get_id() && recursive_count_ > 1) {
recursive_count_--;
} else {
recursive_owner_ = thread::id();
recursive_count_ = 0;
exclusive_lock_count_--;
if (exclusive_lock_count_ == 0) {
shared_lock_cv_.notify_all();
exclusive_lock_cv_.notify_one();
}
}
}
#endif // CONCURRENCY
} // namespace common
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -18,15 +18,18 @@ See the Mulan PSL v2 for more details. */
#include <errno.h>
#include <pthread.h>
#include <string.h>
#include <unordered_map>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <mutex>
#include <shared_mutex>
#include <thread>
#include "common/log/log.h"
using namespace std;
namespace common {
#define MUTEX_LOG LOG_DEBUG
......@@ -290,4 +293,35 @@ private:
#endif
};
} // namespace common
\ No newline at end of file
/**
* 支持写锁递归加锁的读写锁
* 读锁本身就可以递归加锁。但是某个线程加了读锁后,也不能再加写锁。
* 但是一个线程可以加多次写锁
* 与其它类型的锁一样,在CONCURRENCY编译模式下才会真正的生效
*/
class RecursiveSharedMutex
{
public:
RecursiveSharedMutex() = default;
~RecursiveSharedMutex() = default;
void lock_shared();
bool try_lock_shared();
void unlock_shared();
void lock();
void unlock();
private:
#ifdef CONCURRENCY
std::mutex mutex_;
std::condition_variable shared_lock_cv_;
std::condition_variable exclusive_lock_cv_;
int shared_lock_count_ = 0;
int exclusive_lock_count_ = 0;
std::thread::id recursive_owner_;
int recursive_count_ = 0; // 表示当前线程加写锁加了多少次
#endif // CONCURRENCY
};
} // namespace common
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_LANG_STRING_H__
#define __COMMON_LANG_STRING_H__
#pragma once
// Basic includes
#include <cxxabi.h>
......@@ -173,4 +172,3 @@ std::string get_type_name(const T &val)
}
} // namespace common
#endif // __COMMON_LANG_STRING_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -29,7 +29,7 @@ Log::Log(const std::string &log_file_name, const LOG_LEVEL log_level, const LOG_
{
prefix_map_[LOG_LEVEL_PANIC] = "PANIC:";
prefix_map_[LOG_LEVEL_ERR] = "ERROR:";
prefix_map_[LOG_LEVEL_WARN] = "WARNNING:";
prefix_map_[LOG_LEVEL_WARN] = "WARN:";
prefix_map_[LOG_LEVEL_INFO] = "INFO:";
prefix_map_[LOG_LEVEL_DEBUG] = "DEBUG:";
prefix_map_[LOG_LEVEL_TRACE] = "TRACE:";
......@@ -365,4 +365,4 @@ const char *lbt()
return backtrace_buffer;
}
} // namespace common
\ No newline at end of file
} // namespace common
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -294,15 +294,18 @@ int Log::out(const LOG_LEVEL console_level, const LOG_LEVEL log_level, T &msg)
#define ASSERT(expression, description, ...) \
do { \
if (!(expression)) { \
if (common::g_log) { \
LOG_PANIC(description, ##__VA_ARGS__); \
} \
LOG_PANIC(description, ##__VA_ARGS__); \
assert(expression); \
} \
} while (0)
#else // DEBUG
#define ASSERT(expression, description, ...)
#define ASSERT(expression, description, ...) \
do { \
if (!(expression)) { \
LOG_ERROR(description, ##__VA_ARGS__); \
} \
} while (0)
#endif // DEBUG
#endif // ASSERT
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2021/4/20.
//
#ifndef __COMMON_METRICS_SNAPSHOT_H__
#define __COMMON_METRICS_SNAPSHOT_H__
#pragma once
#include <string>
#include "common/lang/string.h"
......@@ -80,4 +79,3 @@ private:
double tps = 1.0;
};
} // namespace common
#endif //__COMMON_METRICS_SNAPSHOT_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2021/4/20.
//
#ifndef __COMMON_METRICS_TIMER_SNAPSHOT_H__
#define __COMMON_METRICS_TIMER_SNAPSHOT_H__
#pragma once
#include "common/metrics/histogram_snapshot.h"
......@@ -32,4 +31,3 @@ protected:
double tps = 1.0;
};
} // namespace common
#endif //__COMMON_METRICS_TIMER_SNAPSHOT_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -11,8 +11,7 @@ See the Mulan PSL v2 for more details. */
//
// Created by Longda on 2021/4/20.
//
#ifndef __COMMON_METRICS_UNIFORM_RESERVOIR_H_
#define __COMMON_METRICS_UNIFORM_RESERVOIR_H_
#pragma once
#include <pthread.h>
......@@ -57,5 +56,3 @@ protected:
};
} // namespace common
#endif /* __COMMON_METRICS_UNIFORM_RESERVOIR_H_ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_MM_DEBUG_NEW_H__
#define __COMMON_MM_DEBUG_NEW_H__
#pragma once
#include <new>
#include <stdlib.h>
......@@ -48,4 +47,3 @@ extern bool new_verbose_flag; // default to false: no verbose information
extern bool new_autocheck_flag; // default to true: call check_leaks() on exit
} // namespace common
#endif // __COMMON_MM_DEBUG_NEW_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_MM_MEM_H__
#define __COMMON_MM_MEM_H__
#pragma once
#include <stdlib.h>
#include <string.h>
......@@ -132,4 +131,3 @@ static void operator delete[](void *pointer);
#endif /* MEM_DEBUG */
} // namespace common
#endif /* __COMMON_MM_MEM_H__ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -34,7 +34,8 @@ namespace common {
typedef bool (*match)(void *item, void *input_arg);
template <class T>
class MemPool {
class MemPool
{
public:
MemPool(const char *tag) : name(tag)
{
......@@ -110,10 +111,13 @@ protected:
};
/**
* MemoryPoolSimple is a simple Memory Pool manager,
* MemoryPoolSimple is a simple Memory Pool manager
* The objects is constructed when creating the pool and destructed when the pool is cleanup.
* `alloc` calls T's `reinit` routine and `free` calls T's `reset`
*/
template <class T>
class MemPoolSimple : public MemPool<T> {
class MemPoolSimple : public MemPool<T>
{
public:
MemPoolSimple(const char *tag) : MemPool<T>(tag)
{}
......@@ -189,9 +193,7 @@ int MemPoolSimple<T>::init(bool dynamic, int pool_num, int item_num_per_pool)
if (pool_num <= 0 || item_num_per_pool <= 0) {
LOG_ERROR("Invalid arguments, pool_num:%d, item_num_per_pool:%d, this->name:%s.",
pool_num,
item_num_per_pool,
this->name.c_str());
pool_num, item_num_per_pool, this->name.c_str());
return -1;
}
......@@ -207,9 +209,7 @@ int MemPoolSimple<T>::init(bool dynamic, int pool_num, int item_num_per_pool)
this->dynamic = dynamic;
LOG_INFO("Extend one pool, this->size:%d, item_num_per_pool:%d, this->name:%s.",
this->size,
item_num_per_pool,
this->name.c_str());
this->size, item_num_per_pool, this->name.c_str());
return 0;
}
......@@ -250,9 +250,7 @@ int MemPoolSimple<T>::extend()
if (pool == nullptr) {
MUTEX_UNLOCK(&this->mutex);
LOG_ERROR("Failed to extend memory pool, this->size:%d, item_num_per_pool:%d, this->name:%s.",
this->size,
item_num_per_pool,
this->name.c_str());
this->size, item_num_per_pool, this->name.c_str());
return -1;
}
......@@ -264,9 +262,7 @@ int MemPoolSimple<T>::extend()
MUTEX_UNLOCK(&this->mutex);
LOG_INFO("Extend one pool, this->size:%d, item_num_per_pool:%d, this->name:%s.",
this->size,
item_num_per_pool,
this->name.c_str());
this->size, item_num_per_pool, this->name.c_str());
return 0;
}
......@@ -291,14 +287,14 @@ T *MemPoolSimple<T>::alloc()
used.insert(buffer);
MUTEX_UNLOCK(&this->mutex);
new (buffer) T();
buffer->reinit();
return buffer;
}
template <class T>
void MemPoolSimple<T>::free(T *buf)
{
buf->~T();
buf->reset();
MUTEX_LOCK(&this->mutex);
......@@ -330,7 +326,8 @@ std::string MemPoolSimple<T>::to_string()
return ss.str();
}
class MemPoolItem {
class MemPoolItem
{
public:
using unique_ptr = std::unique_ptr<void, std::function<void(void * const)>>;
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,8 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_OS_OS_H__
#define __COMMON_OS_OS_H__
#pragma once
namespace common {
u32_t getCpuNum();
......@@ -21,4 +21,3 @@ u32_t getCpuNum();
void print_stacktrace();
} // namespace common
#endif /* __COMMON_OS_OS_H__ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2021/3/27.
//
#ifndef __COMMON_OS_PATH_H__
#define __COMMON_OS_PATH_H__
#pragma once
#include <string>
namespace common {
......@@ -68,4 +67,3 @@ bool check_directory(std::string &path);
int list_file(const char *path, const char *filter_pattern, std::vector<std::string> &files); // io/io.h::getFileList
} // namespace common
#endif //__COMMON_OS_PATH_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,8 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_OS_PIDFILE_H__
#define __COMMON_OS_PIDFILE_H__
#pragma once
namespace common {
//! Generates a PID file for the current component
......@@ -37,4 +37,3 @@ void removePidFile(void);
std::string &getPidPath();
} // namespace common
#endif // __COMMON_OS_PIDFILE_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,8 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_OS_PROCESS_H__
#define __COMMON_OS_PROCESS_H__
#pragma once
namespace common {
//! Get process Name
......@@ -43,4 +43,3 @@ int daemonize_service(const char *std_out_file, const char *std_err_file);
void sys_log_redirect(const char *std_out_file, const char *std_err_file);
} // namespace common
#endif //__COMMON_OS_PROCESS_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -120,6 +120,17 @@ public:
return protocol_;
}
void set_trx_kit_name(const char *kit_name)
{
if (kit_name) {
trx_kit_name_ = kit_name;
}
}
const std::string &trx_kit_name() const
{
return trx_kit_name_;
}
private:
std::string std_out_; // The output file
std::string std_err_; // The err output file
......@@ -130,6 +141,7 @@ private:
int server_port_ = -1; // server port(if valid, will overwrite the port in the config file)
std::string unix_socket_path_;
std::string protocol_;
std::string trx_kit_name_;
};
ProcessParam *&the_process_param();
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_OS_SIGNAL_H__
#define __COMMON_OS_SIGNAL_H__
#pragma once
#include <signal.h>
......@@ -42,4 +41,3 @@ void setSignalHandler(sighandler_t func);
void setSignalHandler(int sig, sighandler_t func);
} // namespace common
#endif /* __COMMON_OS_SIGNAL_H__ */
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_CALLBACK_H__
#define __COMMON_SEDA_CALLBACK_H__
#pragma once
// Include Files
#include "common/defs.h"
......@@ -122,4 +121,3 @@ private:
};
} // namespace common
#endif // __COMMON_SEDA_CALLBACK_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_CLASS_FACTORY_H__
#define __COMMON_SEDA_CLASS_FACTORY_H__
#pragma once
#include <list>
......@@ -139,4 +138,3 @@ T *ClassFactory<T>::make_instance(const std::string &tag)
}
} // namespace common
#endif // __COMMON_SEDA_CLASS_FACTORY_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_EVENT_DISPATCHER_H__
#define __COMMON_SEDA_EVENT_DISPATCHER_H__
#pragma once
// Include Files
#include <list>
......@@ -156,4 +155,3 @@ public:
};
} // namespace common
#endif // __COMMON_SEDA_EVENT_DISPATCHER_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2021/4/13.
//
#ifndef __COMMON_SEDA_EXAMPLE_STAGE_H__
#define __COMMON_SEDA_EXAMPLE_STAGE_H__
#pragma once
#include "common/seda/stage.h"
......@@ -35,4 +34,4 @@ protected:
void callback_event(StageEvent *event, CallbackContext *context);
};
} // namespace common
#endif //__COMMON_SEDA_EXAMPLE_STAGE_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_KILL_THREAD_H__
#define __COMMON_SEDA_KILL_THREAD_H__
#pragma once
#include <list>
......@@ -99,4 +98,3 @@ protected:
};
} // namespace common
#endif // __COMMON_SEDA_KILL_THREAD_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2021/4/21.
//
#ifndef __COMMON_SEDA_SEDA_DEFS_H__
#define __COMMON_SEDA_SEDA_DEFS_H__
#pragma once
#define SEDA_BASE_NAME "SEDA_BASE"
#define THREAD_POOLS_NAME "ThreadPools"
......@@ -29,5 +28,3 @@ See the Mulan PSL v2 for more details. */
#define NEXT_STAGES "NextStages"
#define DEFAULT_THREAD_POOL "DefaultThreads"
#define METRCS_REPORT_INTERVAL "MetricsReportInterval"
#endif //__COMMON_SEDA_SEDA_DEFS_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -11,8 +11,7 @@ See the Mulan PSL v2 for more details. */
//
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_STAGE_EVENT_H__
#define __COMMON_SEDA_STAGE_EVENT_H__
#pragma once
// Include Files
#include <time.h>
......@@ -177,4 +176,3 @@ bool &get_event_history_flag();
u32_t &get_max_event_hops();
} // namespace common
#endif // __COMMON_SEDA_STAGE_EVENT_H__
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
......@@ -12,8 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by Longda on 2010
//
#ifndef __COMMON_SEDA_STAGE_FACTORY_H__
#define __COMMON_SEDA_STAGE_FACTORY_H__
#pragma once
#include "common/seda/class_factory.h"
#include "common/seda/stage.h"
......@@ -24,4 +23,3 @@ class Stage;
typedef ClassFactory<Stage> StageFactory;
} // namespace common
#endif // __COMMON_SEDA_STAGE_FACTORY_H__
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册