Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
OpenAtomFoundation
pika
提交
82054c8d
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,发现更多精彩内容 >>
提交
82054c8d
编写于
3月 29, 2017
作者:
K
KernelMaker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix for ssdb_to_pika
上级
96db964d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
14 deletion
+20
-14
tools/ssdb_to_pika/ssdb_to_pika.cc
tools/ssdb_to_pika/ssdb_to_pika.cc
+20
-14
未找到文件。
tools/ssdb_to_pika/ssdb_to_pika.cc
浏览文件 @
82054c8d
...
...
@@ -21,7 +21,7 @@ void MigrateKv(const std::string& ip, const int port,
delete
client
;
return
;
}
std
::
cout
<<
"k
v client start to migrate, from "
<<
start
<<
" to "
<<
end
<<
std
::
endl
;
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", K
v client start to migrate, from "
<<
start
<<
" to "
<<
end
<<
std
::
endl
;
std
::
vector
<
std
::
string
>
kvs
;
ssdb
::
Status
status_ssdb
;
...
...
@@ -48,6 +48,8 @@ void MigrateKv(const std::string& ip, const int port,
}
prev_start
=
kvs
.
back
();
}
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", Kv client done"
<<
std
::
endl
;
}
...
...
@@ -65,7 +67,7 @@ void MigrateHash(const std::string& ip, const int port,
delete
client
;
return
;
}
std
::
cout
<<
"Hash client start to migrate
, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", Hash client start to migrate, "
<<
keys
.
size
()
<<
" keys
, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
vector
<
std
::
string
>
fvs
;
ssdb
::
Status
status_ssdb
;
...
...
@@ -73,6 +75,7 @@ void MigrateHash(const std::string& ip, const int port,
std
::
string
prev_start_field
=
""
;
for
(
auto
iter
=
keys
.
begin
();
iter
!=
keys
.
end
();
iter
++
)
{
prev_start_field
=
""
;
while
(
true
)
{
fvs
.
clear
();
status_ssdb
=
client
->
hscan
(
*
iter
,
prev_start_field
,
""
,
kBatchLen
,
&
fvs
);
...
...
@@ -93,9 +96,10 @@ void MigrateHash(const std::string& ip, const int port,
return
;
}
}
prev_start_field
=
fvs
.
back
()
;
prev_start_field
=
fvs
[
fvs
.
size
()
-
2
]
;
}
}
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", Hash client done"
<<
std
::
endl
;
}
void
MigrateQueue
(
const
std
::
string
&
ip
,
const
int
port
,
...
...
@@ -112,13 +116,12 @@ void MigrateQueue(const std::string& ip, const int port,
delete
client
;
return
;
}
std
::
cout
<<
"
Queue client start to migrate, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
",
Queue client start to migrate, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
vector
<
std
::
string
>
fs
;
ssdb
::
Status
status_ssdb
;
nemo
::
Status
status_nemo
;
std
::
string
prev_start_field
=
""
;
int64_t
start
=
0
;
int64_t
len
=
0
;
for
(
auto
iter
=
keys
.
begin
();
iter
!=
keys
.
end
();
iter
++
)
{
...
...
@@ -146,6 +149,7 @@ void MigrateQueue(const std::string& ip, const int port,
start
+=
fs
.
size
();
}
}
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", Queue client done"
<<
std
::
endl
;
}
void
MigrateZset
(
const
std
::
string
&
ip
,
const
int
port
,
...
...
@@ -162,7 +166,7 @@ void MigrateZset(const std::string& ip, const int port,
delete
client
;
return
;
}
std
::
cout
<<
"
Zset client start to migrate, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
",
Zset client start to migrate, from "
<<
keys
.
front
()
<<
" to "
<<
keys
.
back
()
<<
std
::
endl
;
std
::
vector
<
std
::
string
>
sms
;
ssdb
::
Status
status_ssdb
;
...
...
@@ -171,6 +175,7 @@ void MigrateZset(const std::string& ip, const int port,
std
::
string
prev_start_member
=
""
;
int64_t
zadd_res
;
for
(
auto
iter
=
keys
.
begin
();
iter
!=
keys
.
end
();
iter
++
)
{
prev_start_member
=
""
;
while
(
true
)
{
sms
.
clear
();
status_ssdb
=
client
->
zscan
(
*
iter
,
prev_start_member
,
NULL
,
NULL
,
kBatchLen
,
&
sms
);
...
...
@@ -194,6 +199,7 @@ void MigrateZset(const std::string& ip, const int port,
prev_start_member
=
sms
[
sms
.
size
()
-
2
];
}
}
std
::
cout
<<
std
::
this_thread
::
get_id
()
<<
", Zset client done"
<<
std
::
endl
;
}
void
DoKv
(
const
std
::
string
&
ip
,
const
int
port
,
...
...
@@ -216,7 +222,7 @@ void DoKv(const std::string& ip, const int port,
ssdb
::
Status
status_ssdb
;
std
::
vector
<
std
::
string
>
keys
;
std
::
thread
*
threads
[
100
];
std
::
thread
*
threads
[
100
0
];
int
thread_num
=
0
;
std
::
string
prev_start
=
""
;
while
(
true
)
{
...
...
@@ -229,7 +235,7 @@ void DoKv(const std::string& ip, const int port,
break
;
}
if
(
keys
.
empty
())
{
std
::
cout
<<
"Kv center client keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
std
::
cout
<<
"Kv center client
dispatch
keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
delete
client
;
break
;
}
...
...
@@ -267,7 +273,7 @@ void DoHash(const std::string& ip, const int port,
std
::
string
end
=
""
;
ssdb
::
Status
status_ssdb
;
std
::
thread
*
threads
[
100
];
std
::
thread
*
threads
[
100
0
];
int
thread_num
=
0
;
std
::
string
prev_start
=
""
;
std
::
vector
<
std
::
string
>
keys
;
...
...
@@ -285,7 +291,7 @@ void DoHash(const std::string& ip, const int port,
keys
.
assign
(
resp
->
begin
()
+
1
,
resp
->
end
());
if
(
keys
.
empty
())
{
std
::
cout
<<
"Hash center client keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
std
::
cout
<<
"Hash center client
dispatch
keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
delete
client
;
break
;
}
...
...
@@ -323,7 +329,7 @@ void DoZset(const std::string& ip, const int port,
std
::
string
end
=
""
;
ssdb
::
Status
status_ssdb
;
std
::
thread
*
threads
[
100
];
std
::
thread
*
threads
[
100
0
];
int
thread_num
=
0
;
std
::
string
prev_start
=
""
;
std
::
vector
<
std
::
string
>
keys
;
...
...
@@ -341,7 +347,7 @@ void DoZset(const std::string& ip, const int port,
keys
.
assign
(
resp
->
begin
()
+
1
,
resp
->
end
());
if
(
keys
.
empty
())
{
std
::
cout
<<
"Zset center client keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
std
::
cout
<<
"Zset center client
dispatch
keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
delete
client
;
break
;
}
...
...
@@ -379,7 +385,7 @@ void DoQueue(const std::string& ip, const int port,
std
::
string
end
=
""
;
ssdb
::
Status
status_ssdb
;
std
::
thread
*
threads
[
100
];
std
::
thread
*
threads
[
100
0
];
int
thread_num
=
0
;
std
::
string
prev_start
=
""
;
std
::
vector
<
std
::
string
>
keys
;
...
...
@@ -397,7 +403,7 @@ void DoQueue(const std::string& ip, const int port,
keys
.
assign
(
resp
->
begin
()
+
1
,
resp
->
end
());
if
(
keys
.
empty
())
{
std
::
cout
<<
"Queue center client keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
std
::
cout
<<
"Queue center client
dispatch
keys done, thread_num: "
<<
thread_num
<<
std
::
endl
;
delete
client
;
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录