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

fix: revert double close fix #15255

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions snapshots/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func snapshotItems(items [][]byte) [][]byte {
_ = snapshottypes.WriteExtensionItem(protoWriter, item)
}
_ = protoWriter.Close()
_ = zWriter.Close()
_ = bufWriter.Flush()
_ = chunkWriter.Close()
}()
Expand Down
2 changes: 1 addition & 1 deletion snapshots/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestManager_Take(t *testing.T) {
Height: 5,
Format: snapshotter.SnapshotFormat(),
Chunks: 1,
Hash: []uint8{0xcf, 0xd8, 0x16, 0xd2, 0xf8, 0x11, 0xe8, 0x90, 0x92, 0xf1, 0xfe, 0x3b, 0xea, 0xd2, 0x94, 0xfc, 0xfa, 0x4f, 0x9e, 0x2a, 0x91, 0xbe, 0xb0, 0x50, 0x83, 0xe9, 0x28, 0x62, 0x48, 0x6a, 0x4b, 0x4},
Hash: []uint8{0x14, 0x38, 0x97, 0x96, 0xba, 0xe4, 0x81, 0xaf, 0x6c, 0xac, 0xff, 0xa5, 0xb8, 0x7e, 0x63, 0x4b, 0xac, 0x69, 0x3f, 0x38, 0x90, 0x5c, 0x7d, 0x57, 0xb3, 0xf, 0x69, 0x73, 0xb3, 0xa0, 0xe0, 0xad},
Metadata: types.Metadata{
ChunkHashes: checksums(expectChunks),
},
Expand Down
4 changes: 4 additions & 0 deletions snapshots/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func (sw *StreamWriter) Close() error {
sw.chunkWriter.CloseWithError(err)
return err
}
if err := sw.zWriter.Close(); err != nil {
sw.chunkWriter.CloseWithError(err)
return err
}
if err := sw.bufWriter.Flush(); err != nil {
sw.chunkWriter.CloseWithError(err)
return err
Expand Down
2 changes: 1 addition & 1 deletion snapshots/types/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package types
// CurrentFormat is the currently used format for snapshots. Snapshots using the same format
// must be identical across all nodes for a given height, so this must be bumped when the binary
// snapshot output changes.
const CurrentFormat uint32 = 3
const CurrentFormat uint32 = 2
2 changes: 1 addition & 1 deletion store/rootmulti/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestMultistoreSnapshot_Checksum(t *testing.T) {
"aa048b4ee0f484965d7b3b06822cf0772cdcaad02f3b1b9055e69f2cb365ef3c",
"7921eaa3ed4921341e504d9308a9877986a879fe216a099c86e8db66fcba4c63",
"a4a864e6c02c9fca5837ec80dc84f650b25276ed7e4820cf7516ced9f9901b86",
"980925390cc50f14998ecb1e87de719ca9dd7e72f5fefbe445397bf670f36c31",
"8ca5b957e36fa13e704c31494649b2a74305148d70d70f0f26dee066b615c1d0",
}},
}
for _, tc := range testcases {
Expand Down