Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Incubator Pegasus
提交
63c4ea84
Incubator Pegasus
项目概览
apache
/
Incubator Pegasus
通知
9
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Incubator Pegasus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
63c4ea84
编写于
5月 11, 2020
作者:
Y
Yingchun Lai
提交者:
GitHub
5月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(rocksdb): Support to config meta data read source (#532)
上级
e9e20c43
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
22 deletion
+30
-22
src/server/meta_store.cpp
src/server/meta_store.cpp
+18
-6
src/server/meta_store.h
src/server/meta_store.h
+5
-3
src/server/pegasus_server_impl.cpp
src/server/pegasus_server_impl.cpp
+7
-13
未找到文件。
src/server/meta_store.cpp
浏览文件 @
63c4ea84
...
...
@@ -5,10 +5,19 @@
#include "meta_store.h"
#include <dsn/dist/fmt_logging.h>
#include <dsn/utility/flags.h>
namespace
pegasus
{
namespace
server
{
DSN_DEFINE_string
(
"pegasus.server"
,
get_meta_store_type
,
"manifest"
,
"Where to get meta data, now support 'manifest' and 'metacf'"
);
DSN_DEFINE_validator
(
get_meta_store_type
,
[](
const
char
*
type
)
{
return
strcmp
(
type
,
"manifest"
)
==
0
||
strcmp
(
type
,
"metacf"
)
==
0
;
});
const
std
::
string
meta_store
::
DATA_VERSION
=
"pegasus_data_version"
;
const
std
::
string
meta_store
::
LAST_FLUSHED_DECREE
=
"pegasus_last_flushed_decree"
;
const
std
::
string
meta_store
::
LAST_MANUAL_COMPACT_FINISH_TIME
=
...
...
@@ -21,11 +30,14 @@ meta_store::meta_store(pegasus_server_impl *server,
{
// disable write ahead logging as replication handles logging instead now
_wt_opts
.
disableWAL
=
true
;
_get_meta_store_type
=
(
strcmp
(
FLAGS_get_meta_store_type
,
"manifest"
)
==
0
?
meta_store_type
::
kManifestOnly
:
meta_store_type
::
kMetaCFOnly
);
}
uint64_t
meta_store
::
get_last_flushed_decree
(
meta_store_type
type
)
const
uint64_t
meta_store
::
get_last_flushed_decree
()
const
{
switch
(
type
)
{
switch
(
_get_meta_store_
type
)
{
case
meta_store_type
::
kManifestOnly
:
return
_db
->
GetLastFlushedDecree
();
case
meta_store_type
::
kMetaCFOnly
:
{
...
...
@@ -39,9 +51,9 @@ uint64_t meta_store::get_last_flushed_decree(meta_store_type type) const
}
}
uint32_t
meta_store
::
get_data_version
(
meta_store_type
type
)
const
uint32_t
meta_store
::
get_data_version
()
const
{
switch
(
type
)
{
switch
(
_get_meta_store_
type
)
{
case
meta_store_type
::
kManifestOnly
:
return
_db
->
GetPegasusDataVersion
();
case
meta_store_type
::
kMetaCFOnly
:
{
...
...
@@ -55,9 +67,9 @@ uint32_t meta_store::get_data_version(meta_store_type type) const
}
}
uint64_t
meta_store
::
get_last_manual_compact_finish_time
(
meta_store_type
type
)
const
uint64_t
meta_store
::
get_last_manual_compact_finish_time
()
const
{
switch
(
type
)
{
switch
(
_get_meta_store_
type
)
{
case
meta_store_type
::
kManifestOnly
:
return
_db
->
GetLastManualCompactFinishTime
();
case
meta_store_type
::
kMetaCFOnly
:
{
...
...
src/server/meta_store.h
浏览文件 @
63c4ea84
...
...
@@ -32,9 +32,9 @@ public:
meta_store
(
pegasus_server_impl
*
server
,
rocksdb
::
DB
*
db
,
rocksdb
::
ColumnFamilyHandle
*
meta_cf
);
uint64_t
get_last_flushed_decree
(
meta_store_type
type
)
const
;
uint32_t
get_data_version
(
meta_store_type
type
)
const
;
uint64_t
get_last_manual_compact_finish_time
(
meta_store_type
type
)
const
;
uint64_t
get_last_flushed_decree
()
const
;
uint32_t
get_data_version
()
const
;
uint64_t
get_last_manual_compact_finish_time
()
const
;
void
set_last_flushed_decree
(
uint64_t
decree
)
const
;
void
set_data_version
(
uint32_t
version
)
const
;
...
...
@@ -55,6 +55,8 @@ private:
rocksdb
::
DB
*
_db
;
rocksdb
::
ColumnFamilyHandle
*
_meta_cf
;
rocksdb
::
WriteOptions
_wt_opts
;
meta_store_type
_get_meta_store_type
;
};
}
// namespace server
...
...
src/server/pegasus_server_impl.cpp
浏览文件 @
63c4ea84
...
...
@@ -1366,12 +1366,9 @@ void pegasus_server_impl::on_clear_scanner(const int64_t &args) { _context_cache
// Create _meta_store which provide Pegasus meta data read and write.
_meta_store
=
dsn
::
make_unique
<
meta_store
>
(
this
,
_db
,
_meta_cf
);
_last_committed_decree
=
_meta_store
->
get_last_flushed_decree
(
meta_store
::
meta_store_type
::
kManifestOnly
);
_pegasus_data_version
=
_meta_store
->
get_data_version
(
meta_store
::
meta_store_type
::
kManifestOnly
);
uint64_t
last_manual_compact_finish_time
=
_meta_store
->
get_last_manual_compact_finish_time
(
meta_store
::
meta_store_type
::
kManifestOnly
);
_last_committed_decree
=
_meta_store
->
get_last_flushed_decree
();
_pegasus_data_version
=
_meta_store
->
get_data_version
();
uint64_t
last_manual_compact_finish_time
=
_meta_store
->
get_last_manual_compact_finish_time
();
if
(
_pegasus_data_version
>
PEGASUS_DATA_VERSION_MAX
)
{
derror_replica
(
"open app failed, unsupported data version {}"
,
_pegasus_data_version
);
release_db
();
...
...
@@ -1594,8 +1591,7 @@ private:
{
::
dsn
::
utils
::
auto_lock
<::
dsn
::
utils
::
ex_lock_nr
>
l
(
_checkpoints_lock
);
dcheck_gt_replica
(
last_commit
,
last_durable_decree
());
int64_t
last_flushed
=
static_cast
<
int64_t
>
(
_meta_store
->
get_last_flushed_decree
(
meta_store
::
meta_store_type
::
kManifestOnly
));
int64_t
last_flushed
=
static_cast
<
int64_t
>
(
_meta_store
->
get_last_flushed_decree
());
dcheck_eq_replica
(
last_commit
,
last_flushed
);
if
(
!
_checkpoints
.
empty
())
{
dcheck_gt_replica
(
last_commit
,
_checkpoints
.
back
());
...
...
@@ -1620,8 +1616,7 @@ private:
return
::
dsn
::
ERR_WRONG_TIMING
;
int64_t
last_durable
=
last_durable_decree
();
int64_t
last_flushed
=
static_cast
<
int64_t
>
(
_meta_store
->
get_last_flushed_decree
(
meta_store
::
meta_store_type
::
kManifestOnly
));
int64_t
last_flushed
=
static_cast
<
int64_t
>
(
_meta_store
->
get_last_flushed_decree
());
int64_t
last_commit
=
last_committed_decree
();
dcheck_le_replica
(
last_durable
,
last_flushed
);
...
...
@@ -2170,7 +2165,7 @@ void pegasus_server_impl::update_app_envs(const std::map<std::string, std::strin
int64_t
pegasus_server_impl
::
last_flushed_decree
()
const
{
return
_meta_store
->
get_last_flushed_decree
(
meta_store
::
meta_store_type
::
kManifestOnly
);
return
_meta_store
->
get_last_flushed_decree
();
}
void
pegasus_server_impl
::
update_app_envs_before_open_db
(
...
...
@@ -2529,8 +2524,7 @@ uint64_t pegasus_server_impl::do_manual_compact(const rocksdb::CompactRangeOptio
// update rocksdb statistics immediately
update_replica_rocksdb_statistics
();
return
_meta_store
->
get_last_manual_compact_finish_time
(
meta_store
::
meta_store_type
::
kManifestOnly
);
return
_meta_store
->
get_last_manual_compact_finish_time
();
}
bool
pegasus_server_impl
::
release_storage_after_manual_compact
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录