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

[Write a Log Package] segment_test.go Received unexpected error: open C:/Users/{user}/AppData/Local/Temp/segment-test2541372956/16.store: The system cannot find the path specified. #33

Open
wtran29 opened this issue Jan 17, 2024 · 0 comments

Comments

@wtran29
Copy link

wtran29 commented Jan 17, 2024

I looked into this directory and found the segment-test2541372956 file that is located in the temp folder. However, I do not understand why the directory is joined with the base offset 16.store to the path on page 38:

was the intention to store 16.store file in a folder called segment-test?

func newSegment(dir string, baseOffset uint64, c Config) (*segment, error) {
	s := &segment{
		baseOffset: baseOffset,
		config:     c,
	}
	var err error
	storeFile, err := os.OpenFile(
		path.Join(dir, fmt.Sprintf("%d%s", baseOffset, ".store")),
		os.O_RDWR|os.O_CREATE|os.O_APPEND,
		0644,
	)
	if err != nil {
		return nil, err
	}
	if s.store, err = newStore(storeFile); err != nil {
		return nil, err
	}
	indexFile, err := os.OpenFile(
		path.Join(dir, fmt.Sprintf("%d%s", baseOffset, ".index")),
		os.O_RDWR|os.O_CREATE,
		0644,
	)
	if err != nil {
		return nil, err
	}
	if s.index, err = newIndex(indexFile, c); err != nil {
		return nil, err
	}
	if off, _, err := s.index.Read(-1); err != nil {
		s.nextOffset = baseOffset
	} else {
		s.nextOffset = baseOffset + uint64(off) + 1
	}
	return s, nil
}

when trying to run the test, I am getting:

=== RUN   TestSegment
    segment_test.go:26:
                Error Trace:    C:/Projects/proglog/internal/log/segment_test.go:26
                Error:          Received unexpected error:
                                open C:/Users/willi/AppData/Local/Temp/segment-test3951777488/16.store: The system 
cannot find the path specified.
                Test:           TestSegment
--- FAIL: TestSegment (0.00s)
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

No branches or pull requests

1 participant