-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bfs_status() SDK API,activate FSImpl::ChangeReplicaNum() #930
base: master
Are you sure you want to change the base?
Conversation
bug: bfs_change_replica_num()接口找不到定义 原因:bfs_c.cc函数命名与bfs_c.h命名不一致
bfs_change_replica_num()
src/sdk/bfs_c.cc
Outdated
if (ret != 0) { | ||
return ret; | ||
} | ||
status=result.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里返回后,result析构,status中有野指针吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我把前一个return删了,您看这样能解决问题吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不解,result是栈上的变量
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我重写了status接口,能请您看看还会有野指针的问题吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c_str()
返回的 const char*
生命周期跟随 std::string result
, result
为栈变量,当函数生命周期结束后会被编译器释放,可能导致status 成为野指针。
1.可以通过API 查看BFS 当前状态;
2.激活FSImpl::ChangeReplicaNum()方法。