Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
OpenAtomFoundation
pika
提交
dd995ba6
pika
项目概览
镜像
/
OpenAtomFoundation
/
pika
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
pika
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd995ba6
编写于
7月 14, 2016
作者:
Z
zhaoanan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add max-cache-files to control memory
上级
64ab01df
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
3 deletion
+24
-3
conf/pika.conf
conf/pika.conf
+2
-0
include/pika_conf.h
include/pika_conf.h
+2
-0
src/pika_admin.cc
src/pika_admin.cc
+11
-2
src/pika_conf.cc
src/pika_conf.cc
+7
-0
src/pika_server.cc
src/pika_server.cc
+1
-0
third/nemo
third/nemo
+1
-1
未找到文件。
conf/pika.conf
浏览文件 @
dd995ba6
...
...
@@ -60,3 +60,5 @@ compression : snappy
max
-
background
-
flushes
:
1
# max-background-compactions: default is 1, limited in [1, 4]
max
-
background
-
compactions
:
1
# max-cache-files default is 5000
max
-
cache
-
files
:
5000
include/pika_conf.h
浏览文件 @
dd995ba6
...
...
@@ -46,6 +46,7 @@ public:
int
target_file_size_base
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
target_file_size_base_
;
}
int
max_background_flushes
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
max_background_flushes_
;
}
int
max_background_compactions
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
max_background_compactions_
;
}
int
max_cache_files
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
max_cache_files_
;
}
int
expire_logs_nums
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
expire_logs_nums_
;
}
int
expire_logs_days
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
expire_logs_days_
;
}
std
::
string
conf_path
()
{
RWLock
l
(
&
rwlock_
,
false
);
return
conf_path_
;
}
...
...
@@ -149,6 +150,7 @@ private:
std
::
string
conf_path_
;
int
max_background_flushes_
;
int
max_background_compactions_
;
int
max_cache_files_
;
//char username_[30];
//char password_[30];
...
...
src/pika_admin.cc
浏览文件 @
dd995ba6
...
...
@@ -622,9 +622,12 @@ void InfoCmd::InfoLog(std::string &info) {
void
InfoCmd
::
InfoData
(
std
::
string
&
info
)
{
std
::
stringstream
tmp_stream
;
int64_t
db_size
=
slash
::
Du
(
g_pika_conf
->
db_path
());
tmp_stream
<<
"# Data"
<<
"
\r\n
"
;
tmp_stream
<<
"db_size:"
<<
(
slash
::
Du
(
g_pika_conf
->
db_path
())
>>
20
)
<<
"M
\r\n
"
;
tmp_stream
<<
"db_size:"
<<
(
db_size
>>
20
)
<<
"M
\r\n
"
;
tmp_stream
<<
"compression:"
<<
g_pika_conf
->
compression
()
<<
"
\r\n
"
;
tmp_stream
<<
"used_memory:"
<<
db_size
<<
"
\r\n
"
;
info
.
append
(
tmp_stream
.
str
());
return
;
...
...
@@ -787,6 +790,10 @@ void ConfigCmd::ConfigGet(std::string &ret) {
ret
=
"*2
\r\n
"
;
EncodeString
(
&
ret
,
"max-background-compactions"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
max_background_compactions
());
}
else
if
(
get_item
==
"max-cache-files"
)
{
ret
=
"*2
\r\n
"
;
EncodeString
(
&
ret
,
"max-cache-files"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
max_cache_files
());
}
else
if
(
get_item
==
"expire-logs-days"
)
{
ret
=
"*2
\r\n
"
;
EncodeString
(
&
ret
,
"expire-logs-days"
);
...
...
@@ -820,7 +827,7 @@ void ConfigCmd::ConfigGet(std::string &ret) {
EncodeString
(
&
ret
,
"no"
);
}
}
else
if
(
get_item
==
"*"
)
{
ret
=
"*6
0
\r\n
"
;
ret
=
"*6
2
\r\n
"
;
EncodeString
(
&
ret
,
"port"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
port
());
EncodeString
(
&
ret
,
"thread-num"
);
...
...
@@ -863,6 +870,8 @@ void ConfigCmd::ConfigGet(std::string &ret) {
EncodeInt32
(
&
ret
,
g_pika_conf
->
max_background_flushes
());
EncodeString
(
&
ret
,
"max-background-compactions"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
max_background_compactions
());
EncodeString
(
&
ret
,
"max-cache-files"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
max_cache_files
());
EncodeString
(
&
ret
,
"expire-logs-days"
);
EncodeInt32
(
&
ret
,
g_pika_conf
->
expire_logs_days
());
EncodeString
(
&
ret
,
"expire-logs-nums"
);
...
...
src/pika_conf.cc
浏览文件 @
dd995ba6
...
...
@@ -127,6 +127,12 @@ int PikaConf::Load()
max_background_compactions_
=
4
;
}
max_cache_files_
=
5000
;
GetConfInt
(
"max-cache-files"
,
&
max_cache_files_
);
if
(
max_cache_files_
<
-
1
)
{
max_cache_files_
=
5000
;
}
// daemonize
std
::
string
dmz
;
GetConfStr
(
"daemonize"
,
&
dmz
);
...
...
@@ -173,6 +179,7 @@ int PikaConf::ConfigRewrite() {
SetConfInt
(
"target-file-size-base"
,
target_file_size_base_
);
SetConfInt
(
"max-background-flushes"
,
max_background_flushes_
);
SetConfInt
(
"max-background-compactions"
,
max_background_compactions_
);
SetConfInt
(
"max-cache-files"
,
max_cache_files_
);
SetConfInt
(
"expire-logs-nums"
,
expire_logs_nums_
);
SetConfInt
(
"expire-logs-days"
,
expire_logs_days_
);
SetConfBool
(
"slave-read-only"
,
readonly_
);
...
...
src/pika_server.cc
浏览文件 @
dd995ba6
...
...
@@ -50,6 +50,7 @@ PikaServer::PikaServer() :
option
.
target_file_size_base
=
g_pika_conf
->
target_file_size_base
();
option
.
max_background_flushes
=
g_pika_conf
->
max_background_flushes
();
option
.
max_background_compactions
=
g_pika_conf
->
max_background_compactions
();
option
.
max_open_files
=
g_pika_conf
->
max_cache_files
();
if
(
g_pika_conf
->
compression
()
==
"none"
)
{
option
.
compression
=
false
;
}
...
...
nemo
@
672662ae
比较
a1bbdbdf
...
672662ae
Subproject commit
a1bbdbdf2c82fa5573eae901c530fbb101368965
Subproject commit
672662ae5df3b4df0f639a4bd2cd2c1f7be43d9b
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录