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

TRC: Optimize transactionHistoryStore occupancy space #41

Closed
wubinTron opened this issue May 21, 2019 · 0 comments
Closed

TRC: Optimize transactionHistoryStore occupancy space #41

wubinTron opened this issue May 21, 2019 · 0 comments

Comments

@wubinTron
Copy link
Contributor

@wubinTron wubinTron commented May 21, 2019

tip: 41
title: Optimize transactionHistoryStore occupancy space#40
author: wubin1<wubin1@tron.network> 
discussions to: https://github.com/tronprotocol/TIPs/issues/40
category: TRC
status: accepted
created: 2019-5-20

Simple Summary

This doc describes the solution of optimizing transactionHistoryStore occupancy space

Abstract

In current storage model, transaction result saves in transaction history store and it occupies the most space.
The optimization merges all transactions in a common block and compression the transaction history space.

Motivation

TRON database already occupied 163GB and it increases 20G each month. So how to optimize space is very import.

Specification

TransactionHistory doesn't directly save in transactionHistoryStore after the execution of transactions.

transactionHistoryStore.put(trxCap.getTransactionId().getBytes(), transactionInfo);

Add transaction history in memory and save in disk after executing one whole block.

    transationHistoryCapsule.addTransactionResult(result); 
     if (block.getTransactions().size() != 0) {
      this.transactionHistoryStore.put(ByteArray.fromLong(block.getNum()), block.getResult());
    } 

Rationale

Saving transaction history for a whole block could reduce duplicate data and protocol buffer compression is more effective for large data.

Backwards Compatibility

There are no backwards compatibility concerns.

Test Cases

  1. Compare storage size from optimization version and not optimization version.
  2. Query function for transaction history
@wubinTron wubinTron changed the title TRC: Optimize transactionHistoryStore occupancy space#40 TRC:-40 Optimize transactionHistoryStore occupancy space May 21, 2019
@wubinTron wubinTron changed the title TRC:-40 Optimize transactionHistoryStore occupancy space TRC: Optimize transactionHistoryStore occupancy space May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.