-
Notifications
You must be signed in to change notification settings - Fork 143
Feat[Storagetool]: cluster state ledger (CSL) file search support #558
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
[-h|help] | ||
Where: | ||
-r | --record-type <record type> | ||
record type to search {message|queue-op|journal-op} (default: message) | ||
record type to search {<message>|queue-op|journal-op} (default: message) |
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.
Do we need angle brackets for message?
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.
Just follow the style of bmqtool
to highlight default value in case when it is not explicitly defined in balcl::OptionInfo
.
src/applications/bmqstoragetool/m_bmqstoragetool_cslfileprocessor.cpp
Outdated
Show resolved
Hide resolved
src/applications/bmqstoragetool/m_bmqstoragetool_cslfileprocessor.h
Outdated
Show resolved
Hide resolved
src/applications/bmqstoragetool/m_bmqstoragetool_cslprinter.cpp
Outdated
Show resolved
Hide resolved
src/applications/bmqstoragetool/m_bmqstoragetool_cslprinter.cpp
Outdated
Show resolved
Hide resolved
src/applications/bmqstoragetool/m_bmqstoragetool_cslprinter.cpp
Outdated
Show resolved
Hide resolved
{ | ||
d_fields.clear(); | ||
d_fields.reserve(9); // max number of fields | ||
d_fields.push_back("RecordType"); |
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.
Consider using emplace_back
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.
Just follow common bmqu::AlignedPrinter usage, used in codebase. d_fields
is std::vector<const char*>
type, and in this case push_back
and emplace_back
are equivalent - both just store the pointer.
src/applications/bmqstoragetool/m_bmqstoragetool_cslsearchresult.h
Outdated
Show resolved
Hide resolved
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
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.
Reviewed a part of the PR, have comments
files. It allows to search records in: | ||
- `journal` file (.bmq_journal) with the set of different filters and output found results in | ||
the short or detail form; | ||
- `cluster state ledger` (CSL) file (*.bmq_csl) with the set of different filters and output | ||
found results in the short or detail form; |
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.
I think the current form of explanation is a bit too heavy and should be simplified and disambiguated:
files. It allows to search records in: | |
- `journal` file (.bmq_journal) with the set of different filters and output found results in | |
the short or detail form; | |
- `cluster state ledger` (CSL) file (*.bmq_csl) with the set of different filters and output | |
found results in the short or detail form; | |
files. Using a set of different filters, it allows to search records in: | |
- `journal` file (.bmq_journal). | |
- `cluster state ledger` (CSL) file (*.bmq_csl). | |
The output results can be returned in either short or detailed form. |
the short or detail form; | ||
- `cluster state ledger` (CSL) file (*.bmq_csl) with the set of different filters and output | ||
found results in the short or detail form; | ||
NOTE: For this mode, `journal` file (.bmq_journal) **must not** be passed. |
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.
If this is a must, it is better to enforce it in the storage tool itself. Also this note can be merged with the next paragraph
Filter messages with corresponding composite sequence numbers (defined in form `primaryLeaseId-sequenceNumber` for journal file or `electorTerm-sequenceNumber` for CSL file) | ||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
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.
Can make this header shorter by moving the note
Filter messages with corresponding composite sequence numbers (defined in form `primaryLeaseId-sequenceNumber` for journal file or `electorTerm-sequenceNumber` for CSL file) | |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Filter messages with corresponding composite sequence numbers | |
------------------------------------------------------------- | |
Composite sequence numbers are defined in form `primaryLeaseId-sequenceNumber` for journal file or `electorTerm-sequenceNumber` for CSL file. | |
const bsls::Types::Uint64 leaseId, | ||
const bsls::Types::Uint64 sequenceNumber) |
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.
const bsls::Types::Uint64 leaseId, | |
const bsls::Types::Uint64 sequenceNumber) | |
bsls::Types::Uint64 leaseId, | |
bsls::Types::Uint64 sequenceNumber) |
Basic arithmetic types passed by value
explicit CompositeSequenceNumber(const bsls::Types::Uint64 leaseId, | ||
const bsls::Types::Uint64 sequenceNumber); |
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.
explicit CompositeSequenceNumber(const bsls::Types::Uint64 leaseId, | |
const bsls::Types::Uint64 sequenceNumber); | |
explicit CompositeSequenceNumber(bsls::Types::Uint64 leaseId, | |
bsls::Types::Uint64 sequenceNumber); |
|
||
public: | ||
// CREATORS | ||
CslRecordPrinter(bsl::ostream& stream, bslma::Allocator* allocator); |
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.
CslRecordPrinter(bsl::ostream& stream, bslma::Allocator* allocator); | |
explicit CslRecordPrinter(bsl::ostream& stream, bslma::Allocator* allocator = 0); |
- nested traits using bslma allocator
const mqbsi::LedgerRecordId& recId) | ||
{ | ||
d_fields.clear(); | ||
d_fields.reserve(9); // max number of fields |
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.
d_fields.reserve(9); // max number of fields | |
d_fields.reserve(10); // max number of fields |
There is 9 or 10 fields depending on if
branch triggering
|
||
namespace BloombergLP { | ||
namespace m_bmqstoragetool { | ||
|
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.
Let's define destructors here for all classes defined in the header to avoid warnings during compilation
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.
I checked build logs on CI for both ubuntu and darwin and see no warnings for these classes. CslRecordPrinter
is a template class and should be defined in the header. As I know it make sense for virtual classes.
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.
I checked build logs on CI for both ubuntu and darwin and see no warnings for these classes.
CslRecordPrinter
is a template class and should be defined in the header. As I know it make sense for virtual classes.
Good point
|
||
public: | ||
// CREATORS | ||
HumanReadableCslPrinter(bsl::ostream& os, bslma::Allocator* allocator) |
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.
HumanReadableCslPrinter(bsl::ostream& os, bslma::Allocator* allocator) | |
explicit HumanReadableCslPrinter(bsl::ostream& os, bslma::Allocator* allocator = 0) |
- nested trait uses bslma allocator
public: | ||
// CREATORS | ||
|
||
JsonCslPrinter(bsl::ostream& os, bslma::Allocator* allocator) |
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.
JsonCslPrinter(bsl::ostream& os, bslma::Allocator* allocator) | |
explicit JsonCslPrinter(bsl::ostream& os, bslma::Allocator* allocator = 0) |
- nested trait uses bslma allocator
Signed-off-by: Aleksandr Ivanov <[email protected]>
Signed-off-by: Aleksandr Ivanov <[email protected]>
Enhance storage tool to search records in cluster state ledger (CSL) file.
To search records in CSL file, only CSL file path (
--csl-file
option) must be passed, journal file path (--journal-path
/--journal-path` options must not be present.Scenarios of BMQStorageTool usage for CSL file
Output summary for CSL file
Example:
Output records from the beginning of CSL file
Example:
NOTE: by default search is done from the latest snapshot.
Search and otput only desired record types in CSL file
Example:
NOTE:
snapshot
,update
,commit
andack
are supported. Without this option all record types are selected.Search and otput records details in CSL file
Example:
The same search filters could be applied to above scenarios as for journal file search (except
--guid
filter).Example of short result output
Example of detail result output
Example of summary result output