Skip to content
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

tx index optimized #8

Open
wants to merge 1 commit into
base: performance
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions common/ledger/blkstorage/fsblkstorage/blockindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,17 @@ func (index *blockIndex) isAttributeIndexed(attribute blkstorage.IndexableAttr)

func (index *blockIndex) markDuplicateTxids(blockIdxInfo *blockIdxInfo) error {
uniqueTxids := make(map[string]bool)
for _, txIdxInfo := range blockIdxInfo.txOffsets {
txflg := ledgerUtil.TxValidationFlags(blockIdxInfo.metadata.Metadata[common.BlockMetadataIndex_TRANSACTIONS_FILTER])
for idx, txIdxInfo := range blockIdxInfo.txOffsets {
txid := txIdxInfo.txID
if uniqueTxids[txid] { // txid is duplicate of a previous tx in the block
txIdxInfo.isDuplicate = true
continue
}

loc, err := index.getTxLoc(txid)
if loc != nil { // txid is duplicate of a previous tx in the index
if txflg.Flag(idx) == peer.TxValidationCode_DUPLICATE_TXID{
txIdxInfo.isDuplicate = true
continue
}
if err != blkstorage.ErrNotFoundInIndex {
return err
}
uniqueTxids[txid] = true
}
return nil
Expand Down