-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command reference doc for ledgerutil
Add command reference doc for ledgerutil. Includes minor edits to the command's user messages. Signed-off-by: David Enyeart <enyeart@us.ibm.com>
- Loading branch information
1 parent
45707ac
commit f15b4ee
Showing
7 changed files
with
135 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!--- | ||
File generated by help_docs.sh. DO NOT EDIT. | ||
Please make changes to preamble and postscript wrappers as appropriate. | ||
---> | ||
|
||
# ledgerutil | ||
|
||
The `ledgerutil compare` command allows administrators to compare channel snapshots from two different peers. | ||
Although channel snapshots from the same height should be identical across peers, if the snapshot | ||
files indicate different state hashes (as seen in `_snapshot_signable_metadata.json` file from each snapshot) | ||
then it indicates that at least one of the peers state databases is not correct relative to the blockchain and | ||
may have gotten corrupted. | ||
|
||
The `ledgerutil compare` utility will output a set of JSON files if the snapshots are not identical to assist with troubleshooting in these situations. | ||
Two output JSON files will include any key/value differences sorted by key (one for public key/value differences and one for private key/value differences), | ||
another JSON file will include any key/value differences (public or private) sorted by block and transaction height so that you can identify the height where a divergence may have first occurred. | ||
|
||
The output files may help an administrator to understand the scope of a state database issue and identify which keys are impacted. | ||
Snapshots from additional peers can be compared to determine which peer has incorrect state. | ||
The block and transaction height of the first difference can be used as a reference point when looking at the peer's logs to understand what may have happened to the state database at that time. | ||
|
||
## Syntax | ||
|
||
The `ledgerutil` command has one subcommand | ||
|
||
* compare | ||
|
||
## ledgerutil compare | ||
``` | ||
usage: ledgerutil compare [<flags>] <snapshotPath1> <snapshotPath2> | ||
Compare channel snapshots from two different peers. | ||
Flags: | ||
--help Show context-sensitive help (also try --help-long | ||
and --help-man). | ||
-o, --outputDir=OUTPUTDIR Snapshot comparison json results output directory. | ||
Default is the current directory. | ||
-f, --firstDiffs=10 Maximum number of differences to record in | ||
first_diffs_by_height.json. Requesting a report | ||
with many differences may result in a large amount | ||
of memory usage. Defaults to 10. If set to 0, will | ||
not produce first_diffs_by_height.json. | ||
Args: | ||
<snapshotPath1> First ledger snapshot directory. | ||
<snapshotPath2> Second ledger snapshot directory. | ||
``` | ||
|
||
## Example Usage | ||
|
||
### ledgerutil compare example | ||
|
||
Here is an example of the `ledgerutil compare` command. | ||
|
||
* Compare snapshots from two different peers for mychannel at snapshot height 5. | ||
|
||
``` | ||
ledgerutil compare -o ./compare_output -f 10 ./peer0.org1.example.com/snapshots/completed/mychannel/5 ./peer1.org1.example.com/snapshots/completed/mychannel/5 | ||
Both snapshot public state and private state hashes were the same. No results were generated. | ||
``` | ||
|
||
The response above indicates that the snapshots are identical. If the snapshots were not identical, the command results will indicate where the comparison output files are written, for example: | ||
|
||
``` | ||
Successfully compared snapshots. Results saved to compare_output/mychannel_5_comparison. Total differences found: 3 | ||
``` | ||
|
||
* Note that both snapshot locations must be accessible by the command, for example by mounting volumes from two different peers, or by copying the snapshots to a common location. | ||
|
||
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Example Usage | ||
|
||
### ledgerutil compare example | ||
|
||
Here is an example of the `ledgerutil compare` command. | ||
|
||
* Compare snapshots from two different peers for mychannel at snapshot height 5. | ||
|
||
``` | ||
ledgerutil compare -o ./compare_output -f 10 ./peer0.org1.example.com/snapshots/completed/mychannel/5 ./peer1.org1.example.com/snapshots/completed/mychannel/5 | ||
Both snapshot public state and private state hashes were the same. No results were generated. | ||
``` | ||
|
||
The response above indicates that the snapshots are identical. If the snapshots were not identical, the command results will indicate where the comparison output files are written, for example: | ||
|
||
``` | ||
Successfully compared snapshots. Results saved to compare_output/mychannel_5_comparison. Total differences found: 3 | ||
``` | ||
|
||
* Note that both snapshot locations must be accessible by the command, for example by mounting volumes from two different peers, or by copying the snapshots to a common location. | ||
|
||
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ledgerutil | ||
|
||
The `ledgerutil compare` command allows administrators to compare channel snapshots from two different peers. | ||
Although channel snapshots from the same height should be identical across peers, if the snapshot | ||
files indicate different state hashes (as seen in `_snapshot_signable_metadata.json` file from each snapshot) | ||
then it indicates that at least one of the peers state databases is not correct relative to the blockchain and | ||
may have gotten corrupted. | ||
|
||
The `ledgerutil compare` utility will output a set of JSON files if the snapshots are not identical to assist with troubleshooting in these situations. | ||
Two output JSON files will include any key/value differences sorted by key (one for public key/value differences and one for private key/value differences), | ||
another JSON file will include any key/value differences (public or private) sorted by block and transaction height so that you can identify the height where a divergence may have first occurred. | ||
|
||
The output files may help an administrator to understand the scope of a state database issue and identify which keys are impacted. | ||
Snapshots from additional peers can be compared to determine which peer has incorrect state. | ||
The block and transaction height of the first difference can be used as a reference point when looking at the peer's logs to understand what may have happened to the state database at that time. | ||
|
||
## Syntax | ||
|
||
The `ledgerutil` command has one subcommand | ||
|
||
* compare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters