Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

apady
Copy link
Contributor

@apady apady commented Nov 30, 2018

1.可以通过API 查看BFS 当前状态;
2.激活FSImpl::ChangeReplicaNum()方法。

bug: bfs_change_replica_num()接口找不到定义
原因:bfs_c.cc函数命名与bfs_c.h命名不一致
bfs_change_replica_num()
开放bfs_change_replica_num();
增加bfs_status() API;
src/sdk/bfs_c.cc Outdated
if (ret != 0) {
return ret;
}
status=result.c_str();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里返回后,result析构,status中有野指针吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我把前一个return删了,您看这样能解决问题吗

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不解,result是栈上的变量

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我重写了status接口,能请您看看还会有野指针的问题吗?

Copy link
Contributor Author

@apady apady left a 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 成为野指针。

@apady apady closed this Dec 4, 2018
@apady apady reopened this Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants