Re: Differences in private_state_hashes.data of snapshots when using different StateDB


David Enyeart
 

public_state.data will be different depending on whether you use leveldb or couchdb, since couchdb saves the JSON in a different format.
private_state_hashes.data should always be the same since the hashes are stored consistently as binary regardless of the state database choice.

If you are seeing differences in private_state_hashes.data, then your private state database may not be correct on one of your peers. You can check snapshot on a 3rd peer to determine which of your original peers may not be correct. This is one of the purposes of the new snapshot capability - to determine if one of the state databases has gotten corrupted.


Dave Enyeart

"Yoojin Chang" ---02/24/2021 02:07:44 AM---I created snapshots from 2 peers for same channel and same height. When I checked _snapshot_signable

From: "Yoojin Chang" <arashi213@...>
To: fabric@...
Date: 02/24/2021 02:07 AM
Subject: [EXTERNAL] [Hyperledger Fabric] Differences in private_state_hashes.data of snapshots when using different StateDB
Sent by: fabric@...





I created snapshots from 2 peers for same channel and same height. When I checked _snapshot_signable_metadata.json file, "private_state_hashes.data" and "public_state.data" were different in each snapshot. I thought it is because peers use

I created snapshots from 2 peers for same channel and same height.

When I checked _snapshot_signable_metadata.json file, "private_state_hashes.data" and "public_state.data" were different in each snapshot.

I thought it is because peers use different StateDB and couchdb sorts keys of data in alphabetical order.

peer id
statedb
key order in statedb (chaincode - fabcar)
peer0.org1.example.comleveldbmake, model, colour, owner
peer0.org2.example.comcouchdbcolour, make, model, owner

So I created another channel and deployed chaincode which has data keys sorted by alphabetical order.

(As a result, channels have same peers, chaincode definition and chaincode data except for channel name and chaincode name.)

In this case, snapshots from peers have same "private_state_hashes.data" and "public_state.data”.

But I can’t understand that private_state_hashes in snapshots are sometimes equal and sometimes different.

As I know, all peers in a channel always share same private data hashes.

If it would be different depends on StateDB type, I should always have gotten different results, but I didn’t.

When do differences of private data hashes in snapshots occur?




Join {fabric@lists.hyperledger.org to automatically receive all group messages.