bosnet / sebak

SEBAK, the next BOScoin Blockchain
https://devteam.blockchainos.org
GNU General Public License v3.0
44 stars 15 forks source link

Broken dump from jsonrpc #888

Closed spikeekips closed 5 years ago

spikeekips commented 5 years ago

The DB.Getiterator with empty prefix produces all the data, but a node fails with this data sometimes. It causes the dumped data does not from same leveldb snapshot.

Geod24 commented 5 years ago

It causes the dumped data does not from same leveldb snapshot.

Does not what ?

spikeekips commented 5 years ago

@Geod24 Does not what?

DB.GetIterator acts like listing HTTP API. It does not use real iterator and snapshot. In every request, it creates a new snapshot. Simply like this,

  1. node has [0, 1, 2, 3]
  2. request DB.GetIterator with the limit, 3
  3. jsonrpc returns [0,1, 2]
  4. storage changes [0, 1, 3, 4, 5, 2]
  5. request DB.GetIterator with the limit, 3 and cursor 2
  6. jsonrpc returns [] instead of [3, 4]