danicoin/src/blockchain_db/lmdb
warptangent ffcf6bdb95
BlockchainLMDB: When removing, find amount output index fast by starting at end
This improves blockchain reorganization time by allowing one of the more
expensive DB lookups when popping a block to not have to seek through a
long dup list in the "output_amounts" subdb. This is most noticeable for
HDDs.

As before, the dup list is still walked if necessary (but in reverse),
and the global output index still confirmed to be the one looked for.
But under proper use, the result will be found at the end of the dup
list, so we start there.

Removing an amount output index is always done in the context of popping
a block, so the global output index being looked for should be the last
one in that amount key's dup list. Even if the txs themselves aren't
removed in reverse order (supposed to be according to original
implementation), the specified amount output index will still be near
the end, because the txs are in the same block.

TEST:

Pop blocks with blockchain_import.

Blocks should be successfully removed with no errors shown.

bitmonerod should be able to start syncing from the reduced blockchain
height.
2015-12-24 13:32:35 -08:00
..
db_lmdb.cpp BlockchainLMDB: When removing, find amount output index fast by starting at end 2015-12-24 13:32:35 -08:00
db_lmdb.h Replace tabs with two spaces for consistency with rest of codebase 2015-12-15 06:22:06 -08:00