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

[codereview]:saveCrc(prevCrc uint32) parameter make no sense #13287

Closed
woodliu opened this issue Aug 11, 2021 · 1 comment
Closed

[codereview]:saveCrc(prevCrc uint32) parameter make no sense #13287

woodliu opened this issue Aug 11, 2021 · 1 comment
Labels

Comments

@woodliu
Copy link

woodliu commented Aug 11, 2021

func (w *WAL) saveCrc(prevCrc uint32) error {

saveCrc use prevCrc as it's only parameter, then pass it to w.encoder.encode(&walpb.Record{Type: crcType, Crc: prevCrc}).
But in function encode, it just override the input rec.Crc like below, so i think the parameter for saveCrc is useless

func (e *encoder) encode(rec *walpb.Record) error {
	e.mu.Lock()
	defer e.mu.Unlock()

	e.crc.Write(rec.Data)
	rec.Crc = e.crc.Sum32()
        ......
}
@woodliu woodliu changed the title saveCrc(prevCrc uint32) parameter make no sense [codereview]:saveCrc(prevCrc uint32) parameter make no sense Aug 11, 2021
@stale
Copy link

stale bot commented Nov 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 10, 2021
@stale stale bot closed this as completed Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant