Closed srderson closed 8 years ago
@manish-sethi and I met this morning to discuss the DB design. @manish-sethi made many good points as to why the transactions should not be separated from the block bytes. These include
The plan is to create column families that will act as indexes and map transaction hashes to the block # and transaction index in the block. Calculating the transaction hash will be performed in a separate thread so that it does not slow down transaction processing.
One though about the column family that maps transactions hashes to block # and transaction index number. Currently, a transaction hash is not unique. You could send the same transaction in different blocks or the same block. To make transaction hashes unique, we need to do one of the following
@jeffgarratt If we do one of these, the transaction hash will be unique and that can be used as the ID.
Added a separate column family to RocksDB for maintaining a mapping between queries keys and (blockId,txIndex). When a new block is committed, the entries in this column families are made in a separate thread. The client query thread waits for index completion up to the block level that the client thread notices when the query arrives.
@srderson we can make this configurable to add entries into this column families if we prefer to have these only on the peer nodes and not on the validator.
Deferring the implementation of some of the queries to issue #73 because of missing information in proto structures as yet.
The database design needs to support two modes of operation.
Currently the database format is
Block number -> Block bytes
which is fast for consensus, but my be slow for queries. We could considerbut this may be slower for consensus. However, this could reduce the overall size of the DB as we do not need to store duplicate transactions.
Should we consider two different database schemas, one optimized for validating peers and one optimized for non-validating peers?