fix: state listener observe writes at wrong time (#13516)
* fix: state listener observe writes at wrong time Closes: #13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync * synchronous abci call, and format doc * fix comment * update file streamer readme and fix typos * typo * fix: state listener observe writes at wrong time Closes: #13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync synchronous abci call, and format doc fix comment update file streamer readme and fix typos typo * improve UX of file streamer, make it immediately usable after enabled - set default value to write_dir. - make write_dir based on home directory by default. - auto-create the directory if not exists. * get homePage from opts Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
+16
-1
@@ -194,6 +194,15 @@ type (
|
||||
Keys []string `mapstructure:"keys"`
|
||||
WriteDir string `mapstructure:"write_dir"`
|
||||
Prefix string `mapstructure:"prefix"`
|
||||
// OutputMetadata specifies if output the block metadata file which includes
|
||||
// the abci requests/responses, otherwise only the data file is outputted.
|
||||
OutputMetadata bool `mapstructure:"output-metadata"`
|
||||
// StopNodeOnError specifies if propagate the streamer errors to the consensus
|
||||
// state machine, it's nesserary for data integrity of output.
|
||||
StopNodeOnError bool `mapstructure:"stop-node-on-error"`
|
||||
// Fsync specifies if calling fsync after writing the files, it slows down
|
||||
// the commit, but don't lose data in face of system crash.
|
||||
Fsync bool `mapstructure:"fsync"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -285,7 +294,13 @@ func DefaultConfig() *Config {
|
||||
},
|
||||
Streamers: StreamersConfig{
|
||||
File: FileStreamerConfig{
|
||||
Keys: []string{"*"},
|
||||
Keys: []string{"*"},
|
||||
WriteDir: "data/file_streamer",
|
||||
OutputMetadata: true,
|
||||
StopNodeOnError: true,
|
||||
// NOTICE: the default config don't protect the streamer data integrity
|
||||
// in face of system crash.
|
||||
Fsync: false,
|
||||
},
|
||||
},
|
||||
Mempool: MempoolConfig{
|
||||
|
||||
@@ -212,6 +212,13 @@ streamers = [{{ range .Store.Streamers }}{{ printf "%q, " . }}{{end}}]
|
||||
keys = [{{ range .Streamers.File.Keys }}{{ printf "%q, " . }}{{end}}]
|
||||
write_dir = "{{ .Streamers.File.WriteDir }}"
|
||||
prefix = "{{ .Streamers.File.Prefix }}"
|
||||
# output-metadata specifies if output the metadata file which includes the abci request/responses
|
||||
# during processing the block.
|
||||
output-metadata = "{{ .Streamers.File.OutputMetadata }}"
|
||||
# stop-node-on-error specifies if propagate the file streamer errors to consensus state machine.
|
||||
stop-node-on-error = "{{ .Streamers.File.StopNodeOnError }}"
|
||||
# fsync specifies if call fsync after writing the files.
|
||||
fsync = "{{ .Streamers.File.Fsync }}"
|
||||
|
||||
###############################################################################
|
||||
### Mempool ###
|
||||
|
||||
Reference in New Issue
Block a user