-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fix clusterutil print dereference bug #578
base: main
Are you sure you want to change the base?
Conversation
1449231
to
a456bee
Compare
a456bee
to
d73044c
Compare
Signed-off-by: Emelia Lei <[email protected]>
d73044c
to
3247a1b
Compare
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.
Good job! Some comments here.
|
||
// mqbc_clusterutil.t.cpp -*-C++-*- | ||
#include <bdlb_print.h> | ||
#include <bslstl_string.h> |
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.
Include bsl_string.h
instead
// mqbc_clusterutil.t.cpp -*-C++-*- | ||
#include <bdlb_print.h> | ||
#include <bslstl_string.h> | ||
#include <bslstl_vector.h> |
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.
Remove unused include. (Also, it would have been bsl_vector.h
instead of bslstl_vector.h
)
// limitations under the License. | ||
|
||
// mqbc_clusterutil.t.cpp -*-C++-*- | ||
#include <bdlb_print.h> |
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.
Move all of these BDE-related includes under the // BDE
section at Line 26
|
||
// validate state | ||
bmqu::MemOutStream errorDescription; | ||
int rc = mqbc::ClusterUtil::validateState(errorDescription, |
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.
int rc = mqbc::ClusterUtil::validateState(errorDescription, | |
const int rc = mqbc::ClusterUtil::validateState(errorDescription, |
// 0. Generate different primary lease Id | ||
original.setPartitionPrimary(0, 10, 0); | ||
reference.setPartitionPrimary(0, 9, 0); | ||
|
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.
Could you also add a couple correct queues to make sure we are not generating false alarms?
keyExtraQueue.begin(), | ||
mqbu::StorageKey::e_KEY_LENGTH_BINARY); | ||
out << " partitionId = 2 appIdInfos = [ ] " | ||
"stateOfAssignment = 0 ]"; |
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.
ClusterStateQueueInfo::State
is defined here. To be informative, we should print NONE
instead of 0. The trick is to add the four methods print
, toAscii
,fromAscii
and operator<<
similar to how ClusterStateTableState
does it.
Fixed a bug where in
mqbc_clusterutil.cpp
, functionClusterUtil::validateState
, some shared pointers are not dereferenced correctly.