For a peer which is joined to a channel, if the peer's org is evicted from the channel (and cannot receive blocks), the peer will spend resources and spam log messages attempting to pull blocks from that channel forever.
Similar to the peer reset command, it would be very nice to add an option to simply delete the channel blockchain on the org's peer, effectively 'unjoin'ing the channel.
When a peer is unjoined from a channel, ideally all the ledger data for the channel should be deleted from the peer. However, because a single instance of golevelDB is used for each store (except for blockstore), it is not feasible to delete ledger data at a per-channel basis. Therefore we propose the following design:
Add a “peer node unjoin -c <channelID>” command (peer must be stopped).
The unjoin command will:
- tag the channel as "unjoined" in the peer's ledgerProvider database so that the channel does not get initialized upon next peer start.
- delete the channel's blockstore from the peer's /chains directory
Note that the channel data will not get deleted from the other internal cross-channel data stores. It will be orphaned (unreferenced from peer).
Once tagged as "unjoined", the peer will not be able to re-join the channel (since there is orphaned data for that channel).
If a peer administrator wants to completely delete the channel data from the internal cross-channel data stores, or wants to rejoin the peer to the channel, they can do a "peer node reset" which truncates all channels to genesis block and deletes the internal cross-channel data stores. As of this proposal it will also remove any channels tagged as "unjoined" in ledgerProvider database. Upon next peer restart, the peer will automatically pull blocks and rebuild the internal cross-channel data stores for the remaining joined channels.
Once ledger has truly per-channel databases in a future release, it will be possible for the unjoin command to immediately delete all data for the channel.