-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Added RetrieveBlockByNumber into blockledger #2635
Conversation
as per @manish-sethi input #2594 (comment) created a new PR for main. |
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.
Thanks @Param-S - LGTM. Just a couple nit comments
@@ -93,6 +94,7 @@ func (fl *FileLedger) Iterator(startPosition *ab.SeekPosition) (blockledger.Iter | |||
|
|||
iterator, err := fl.blockStore.RetrieveBlocks(startingBlockNumber) | |||
if err != nil { | |||
logger.Warnf("Failed to initialize block iterator from blockNum = [%d] with error = (%v)", startingBlockNumber, err) |
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.
We have been preferring to use the following function for logging
logger.Warnf("Failed to initialize block iterator from blockNum = [%d] with error = (%v)", startingBlockNumber, err) | |
logger.Warnw("Failed to initialize block iterator", "blockNum", startingBlockNumber, "error", err) |
assert.Panics(t, func() { | ||
ConfigBlockOrPanic(l) | ||
}) |
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.
- better to use
require
instead ofassert
- Wherever possible better to use
PanicsWithValue
so you could test for the exact error message expected
GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]>
GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]>
…2648) * FAB-18276 Ch.Part.API: extractSystemChannel must skip empty ledger (#2023) - orderer/common/server/main.go extractSystemChannel() panics when it hits an empty ledger. - In addition this method is not covered with unit tests at all. - Remove some dead code. Signed-off-by: Yoav Tock <[email protected]> Change-Id: Ie13156784d2ec600e3f97d34f20f6836b28f7662 * Added RetrieveBlockByNumber into blockledger (#2635) GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]> Co-authored-by: Yoav Tock <[email protected]>
@Mergifyio backport release-2.3 |
Command
|
GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]> (cherry picked from commit 85ae90c)
GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]> (cherry picked from commit 85ae90c) Co-authored-by: Parameswaran Selvam <[email protected]>
…rledger#2657) GetBlock is used for retrieving a block in ConfigBlockOrPanic which has overhead of Iterator. It is now simplified by exposing a BlockStore function RetrieveBlockByNumber. Signed-off-by: Parameswaran Selvam <[email protected]> (cherry picked from commit 85ae90c) Co-authored-by: Parameswaran Selvam <[email protected]>
Description
GetBlock is used for retrieving a block in ConfigBlockOrPanic
which has overhead of Iterator. It is now simplified by exposing
a BlockStore function RetrieveBlockByNumber.
Signed-off-by: Parameswaran Selvam [email protected]
Type of change