-
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?
Changes from 79 commits
4438797
465076c
32f36b3
e0cf5a1
bd9001d
cff0b26
1fd8eac
81ba90f
8a5d825
fd3f96b
42e6b9a
2343748
5189f9c
80c58ce
9175303
ec47845
8a46f56
d270645
98655ac
3e9f3f4
9be7be8
13522a6
096a3fa
77a57a5
062979d
05192f0
a82b95f
d69dbf6
15cc481
042b1ff
06aebf7
817ec28
eb3740b
a1d976b
0dd4c44
f62b30a
15c024f
42cb59e
3d1fb70
75770c2
ccd7137
6b08426
8c97579
d7c8afd
3d9276b
db75178
fd39205
6f6f4b5
bd008d5
d89518b
74a0952
8df6bd1
6a4507c
c8aa29f
26f3e37
8f9ad5e
f078ed5
d76df1c
a29b8a6
7078547
666837a
a0ac39e
a654560
901e924
66efe9b
5346292
afc64f3
d99958c
b7b366f
fa4a54c
aaad48f
ab2fbba
99288c3
45001cd
82fc964
b508729
d951bc2
fe0bced
c79785b
4153fd5
c883ff4
0cd1dd4
bccbdf3
6cb9945
bcf4415
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,22 +2,30 @@ BMQStorageTool | |||||||||||||||
============== | ||||||||||||||||
|
||||||||||||||||
BMQStorageTool is a command-line tool for analyzing of BlazingMQ Broker storage | ||||||||||||||||
files. It allows to search records in `journal` file with set of different | ||||||||||||||||
filters and output found results in the short or detail form. | ||||||||||||||||
As input, a `journal` file (*.bmq_journal) is *always* required. To dump | ||||||||||||||||
payload, `data` file (*.bmq_data) is required. To filter by queue Uri, cluster | ||||||||||||||||
state ledger (CSL) file (*.bmq_csl) is required. | ||||||||||||||||
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; | ||||||||||||||||
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 commentThe 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 |
||||||||||||||||
|
||||||||||||||||
As an input, either a `journal` file (*.bmq_journal) or `cluster state ledger` | ||||||||||||||||
(CSL) file (*.bmq_csl) is **always** required. To dump payload, `data` file (*.bmq_data) | ||||||||||||||||
is required. To filter by queue Uri, cluster state ledger (CSL) file (*.bmq_csl) is required. | ||||||||||||||||
|
||||||||||||||||
The tool can be found under your `CMAKE` build directory after making | ||||||||||||||||
the project. From the command-line, there are a few options you can use when | ||||||||||||||||
invoking the tool. | ||||||||||||||||
|
||||||||||||||||
```bash | ||||||||||||||||
Usage: bmqstoragetool [-r|record-type <record type>]* | ||||||||||||||||
[--csl-record-type <csl record type>]* | ||||||||||||||||
[--journal-path <journal path>] | ||||||||||||||||
[--journal-file <journal file>] | ||||||||||||||||
[--data-file <data file>] | ||||||||||||||||
[--csl-file <csl file>] | ||||||||||||||||
[--csl-from-begin] | ||||||||||||||||
[--print-mode <print mode>] | ||||||||||||||||
[--guid <guid>]* | ||||||||||||||||
[--seqnum <seqnum>]* | ||||||||||||||||
[--offset <offset>]* | ||||||||||||||||
|
@@ -35,12 +43,15 @@ Usage: bmqstoragetool [-r|record-type <record type>]* | |||||||||||||||
[--details] | ||||||||||||||||
[--dump-payload] | ||||||||||||||||
[--dump-limit <dump limit>] | ||||||||||||||||
[--min-records-per-queue <threshold>] | ||||||||||||||||
[--summary] | ||||||||||||||||
[--min-records-per-queue <threshold>] | ||||||||||||||||
[--summary-queues-limit <queues limit>] | ||||||||||||||||
[-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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Just follow the style of |
||||||||||||||||
--csl-record-type <csl record type> | ||||||||||||||||
CSL record type to search {<snapshot>|update|commit|ack} (default: all record types) | ||||||||||||||||
--journal-path <pattern> | ||||||||||||||||
'*'-ended file path pattern, where the tool will try to find journal | ||||||||||||||||
and data files | ||||||||||||||||
|
@@ -50,6 +61,10 @@ Where: | |||||||||||||||
path to a .bmq_data file | ||||||||||||||||
--csl-file <csl file> | ||||||||||||||||
path to a .bmq_csl file | ||||||||||||||||
--csl-from-begin | ||||||||||||||||
force to iterate CSL file from the beginning. By default: iterate from the latest snapshot | ||||||||||||||||
--print-mode <print mode> | ||||||||||||||||
can be one of the following {<human>|json-prety|json-line} (default: human) | ||||||||||||||||
--guid <guid> | ||||||||||||||||
message guid | ||||||||||||||||
--seqnum <seqnum> | ||||||||||||||||
|
@@ -89,15 +104,17 @@ Where: | |||||||||||||||
--summary | ||||||||||||||||
summary of all matching messages (number of outstanding messages and | ||||||||||||||||
other statistics) | ||||||||||||||||
--summary-queues-limit <queues limit> | ||||||||||||||||
limit of queues to display in CSL file summary (default: 50) | ||||||||||||||||
-h | --help | ||||||||||||||||
print usage | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Scenarios of BMQStorageTool usage | ||||||||||||||||
================================= | ||||||||||||||||
Scenarios of BMQStorageTool usage for journal file | ||||||||||||||||
================================================== | ||||||||||||||||
|
||||||||||||||||
Output summary for journal file | ||||||||||||||||
---------------------------------------- | ||||||||||||||||
------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --summary | ||||||||||||||||
|
@@ -111,7 +128,7 @@ Example: | |||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Search and otput all queueOp/journalOp records or all records in journal file | ||||||||||||||||
-------------------------------------------------- | ||||||||||||||||
----------------------------------------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --record-type=queue-op | ||||||||||||||||
|
@@ -136,14 +153,48 @@ Example: | |||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Search all message GUIDs with payload dump in journal file | ||||||||||||||||
---------------------------------------------------------------------- | ||||||||||||||||
---------------------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<journal-path> --data-file=<data-path> --dump-payload | ||||||||||||||||
./bmqstoragetool.tsk --journal-path=<path.*> --dump-payload | ||||||||||||||||
./bmqstoragetool.tsk --journal-path=<path.*> --dump-payload --dump-limit=64 | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Scenarios of BMQStorageTool usage for CSL file | ||||||||||||||||
============================================== | ||||||||||||||||
|
||||||||||||||||
Output summary for CSL file | ||||||||||||||||
--------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --summary | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --summary --summary-queues-limit=100 | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Output records from the beginning of CSL file | ||||||||||||||||
--------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --csl-from-begin | ||||||||||||||||
``` | ||||||||||||||||
NOTE: by default search is done from the latest snapshot. | ||||||||||||||||
|
||||||||||||||||
Search and otput only desired record types in CSL file | ||||||||||||||||
------------------------------------------------------ | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --csl-record-type=snapshot --csl-record-type=update | ||||||||||||||||
``` | ||||||||||||||||
NOTE: `snapshot`, `update`, `commit` and `ack ` are supported. Without this option all record types are selected. | ||||||||||||||||
|
||||||||||||||||
Search and otput records details in CSL file | ||||||||||||||||
-------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --details | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Applying search filters to above scenarios | ||||||||||||||||
========================================== | ||||||||||||||||
|
||||||||||||||||
|
@@ -153,6 +204,24 @@ Example: | |||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --guid=<guid_1> --guid=<guid_N> | ||||||||||||||||
``` | ||||||||||||||||
NOTE: no other filters are allowed with this one. Not suitable for CSL file search. | ||||||||||||||||
|
||||||||||||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Can make this header shorter by moving the note
Suggested change
|
||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --seqnum=<leaseId1-sequenceNumber_1> --seqnum=<leaseId_N-sequenceNumber_N> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --seqnum=<electorTerm1-sequenceNumber_1> --seqnum=<electorTerm_N-sequenceNumber_N> | ||||||||||||||||
``` | ||||||||||||||||
NOTE: no other filters are allowed with this one | ||||||||||||||||
|
||||||||||||||||
Filter messages with corresponding record offsets | ||||||||||||||||
------------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --offset=<offset_1> --offset=<offset_N> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --offset=<offset_1> --offset=<offset_N> | ||||||||||||||||
``` | ||||||||||||||||
NOTE: no other filters are allowed with this one | ||||||||||||||||
|
||||||||||||||||
Filter messages with corresponding composite sequence numbers (defined in form <primaryLeaseId-sequenceNumber>) | ||||||||||||||||
|
@@ -178,6 +247,27 @@ Example: | |||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --timestamp-lt=<stamp> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --timestamp-gt=<stamp> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --timestamp-lt=<stamp1> --timestamp-gt=<stamp2> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --timestamp-lt=<stamp1> --timestamp-gt=<stamp2> | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Filter messages within composite sequence numbers (primaryLeaseId/electorTerm, sequenceNumber) range | ||||||||||||||||
---------------------------------------------------------------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --seqnum-lt=<leaseId-sequenceNumber> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --seqnum-gt=<leaseId-sequenceNumber> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --seqnum-lt=<leaseId1-sequenceNumber1> --seqnum-gt=<leaseId2-sequenceNumber2> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --seqnum-lt=<electorTerm1-sequenceNumber1> --seqnum-gt=<electorTerm2-sequenceNumber2> | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Filter messages within record offsets range | ||||||||||||||||
------------------------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --offset-lt=<offset> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --offset-gt=<offset> | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --offset-lt=<offset1> --offset-gt=<offset2> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --offset-lt=<offset1> --offset-gt=<offset2> | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Filter messages within composite sequence numbers (primaryLeaseId, sequenceNumber) range | ||||||||||||||||
|
@@ -203,16 +293,35 @@ Filter messages by queue key | |||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<path> --queue-key=<key_1> --queue-key=<key_N> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<path> --queue-key=<key_1> --queue-key=<key_N> | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Filter messages by queue Uri | ||||||||||||||||
---------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --journal-file=<journal_path> --csl-file=<csl_path> --queue-name=<queue_uri_1> --queue-name=<queue_uri_N> | ||||||||||||||||
./bmqstoragetool.tsk --csl-file=<csl_path> --queue-name=<queue_uri_1> --queue-name=<queue_uri_N> | ||||||||||||||||
``` | ||||||||||||||||
NOTE: CSL file is required | ||||||||||||||||
|
||||||||||||||||
Output search results in machine readable (JSON) format for all above scenarios | ||||||||||||||||
=============================================================================== | ||||||||||||||||
|
||||||||||||||||
Output in JSON pretty format | ||||||||||||||||
---------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --print-mode=json-pretty | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Output in JSON line format | ||||||||||||||||
-------------------------- | ||||||||||||||||
Example: | ||||||||||||||||
```bash | ||||||||||||||||
./bmqstoragetool.tsk --print-mode=json-line | ||||||||||||||||
``` | ||||||||||||||||
|
||||||||||||||||
Display number of records per type (e.g. Message, Confirm, Delete, etc.) per queue. | ||||||||||||||||
The number of Confirm records are displayed per AppId if there are more than 1 AppId. | ||||||||||||||||
The information is displayed for the queues with a total number of records greater or | ||||||||||||||||
|
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: