Switch from compaction mode sequential to full

Full requires the command to be `closed` before it can be removed from
the log during compaction. We don't close commands, thus and retaining
the log forever, allowing users to increase the cluster size. The
downsize is the unbounded growth of the size of the log.

Cluster membership changes need testing.
This commit is contained in:
Thomas Schroeter 2017-11-10 10:28:01 +00:00
parent b23e727685
commit fc8ed34205

View File

@ -27,9 +27,16 @@ class DistributedImmutableMap<K : Any, V : Any, E, EK>(val db: CordaPersistence,
object Commands {
class PutAll<K, V>(val entries: Map<K, V>) : Command<Map<K, V>> {
override fun compaction(): Command.CompactionMode {
// The SEQUENTIAL compaction mode retains the command in the log until it has been stored and applied
// on all servers in the cluster.
return Command.CompactionMode.SEQUENTIAL
// The FULL compaction mode retains the command in the log until it has been stored and applied on all
// servers in the cluster. Once the commit has been applied to a state machine and closed it may be
// removed from the log during minor or major compaction.
//
// Note that we are not closing the commits, thus our log grows without bounds. We let the log grow on
// purpose to be able to increase the size of a running cluster, e.g. to add and decommission nodes.
// TODO: Cluster membership changes need testing.
// TODO: I'm wondering if we should support resizing notary clusters, or if we could require users to
// setup a new cluster of the desired size and transfer the data.
return Command.CompactionMode.FULL
}
}