bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 649 forks source link

ElasticSearch plugin stores duplicate operation history data (1.11.x) in ElasticSearch database #2564

Closed abitmore closed 2 years ago

abitmore commented 2 years ago

Description

Logically, an operation history object (1.11.x) can be linked to multiple account history objects (2.9.x). When stored in the in-memory object database through the account history plugin, they are of 2 types and stored separately. But in ES, they are stored together, and the data is indexed by the account history ID. This means that every document (entry) in the ES database contains an operation history object and an account history object. Therefore, the complete data of an operation history object may exist in multiple documents, that is, duplicates.

On the one hand, this mode uses a lot of disk spaces.

On the other hand, this mode makes it easy to search for data because it avoids join-queries.

It is a trade-off.

I think this is worth discussing.

Impacts Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.

CORE TEAM TASK LIST

abitmore commented 2 years ago

ES is not a rational database. It is by design.