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(wal): fix recover with insufficient buffer #568

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

mattisonchao
Copy link
Member

@mattisonchao mattisonchao commented Nov 12, 2024

Motivation

We are using mmap for WAL, which will reflect a larger buffer than we need. We should skip the index recovery if the current segment is insufficient for a record header.

panic: runtime error: slice bounds out of range [:67108867] with capacity 67108864

goroutine 704 [running]:
github.com/streamnative/oxia/server/wal/codec.ReadInt(...)
	/src/oxia/server/wal/codec/codec.go:165
github.com/streamnative/oxia/server/wal/codec.(*V2).ReadHeaderWithValidation(0xc001728000?, {0x7fd418691000?, 0x4000000, 0x4000000?}, 0x1a920ac?)
	/src/oxia/server/wal/codec/v2.go:109 +0x3ca
github.com/streamnative/oxia/server/wal/codec.(*V2).RecoverIndex(0x34a4da0, {0x7fd418691000, 0x4000000, 0x4000000}, 0x0, 0xff7299, 0xc00087fe40)
	/src/oxia/server/wal/codec/v2.go:212 +0x13b
github.com/streamnative/oxia/server/wal.newReadWriteSegment({0xc0003595e0, 0x1f}, 0xff7299, 0x4000000, 0xbad4b142, {0x2475060, 0xc00126a900})
	/src/oxia/server/wal/wal_rw_segment.go:105 +0x39f
github.com/streamnative/oxia/server/wal.(*wal).recoverWal(0xc00037b1e0)
	/src/oxia/server/wal/wal_impl.go:561 +0xbc
github.com/streamnative/oxia/server/wal.newWal({0xc00087fbd0, 0xc}, 0xc, 0xc000781220, {0x2475060, 0xc00126a900}, {0x2474740, 0x35b77c0}, 0x8bb2c97000)
	/src/oxia/server/wal/wal_impl.go:144 +0x76f
github.com/streamnative/oxia/server/wal.(*walFactory).NewWal(0x2493280?, {0xc00087fbd0?, 0xc00087fbd0?}, 0xc?, {0x2475060?, 0xc00126a900?})

@mattisonchao mattisonchao self-assigned this Nov 12, 2024
@mattisonchao mattisonchao changed the title fix(wal): fix recover with not enough buf fix(wal): fix recover with insufficient buf Nov 12, 2024
@mattisonchao mattisonchao changed the title fix(wal): fix recover with insufficient buf fix(wal): fix recover with insufficient buffer Nov 12, 2024
@merlimat merlimat merged commit ab60cd9 into main Nov 12, 2024
7 checks passed
@merlimat merlimat deleted the fix.recovery.not.enough.buf branch November 12, 2024 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants