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

branch main pkg/source/file/watch.go:321, your have drop the function of Pre-allocation offset #654

Open
pwm1992 opened this issue Dec 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@pwm1992
Copy link

pwm1992 commented Dec 12, 2023

What version of Loggie?

main

Expected Behavior

currrent code

`		// Pre-allocation offset
		if e.job.task.config.ReadFromTail {
			existAckOffset = fileSize
			w.preAllocationOffset(existAckOffset, job)
		}
		// set ack offset
		job.NextOffset(existAckOffset)

An earlier version v1.4.1

`
		}
		// Pre-allocation offset
		if existAckOffset == 0 {
			if w.config.ReadFromTail {
				existAckOffset = fileSize
			}
			w.preAllocationOffset(existAckOffset, job)
		}
		// set ack offset
		job.NextOffset(existAckOffset)
		// set line number

you just ignore the new files in pipeline

Actual Behavior

the sqlite db not create the first register for the new file
and then, the ack of this file will not access by this ack.go --> ach.ackChan

like this the ack.go ach.jobAckChains will not container the new file jobWatchUid.

`
		case ss := <-ach.appendChan:
			for _, s := range ss {
				jobWatchUid := s.WatchUid()
				if chain, ok := ach.jobAckChains[jobWatchUid]; ok {
					chain.Append(s)
				} else {
					// new ack chain
					create := false
					for _, task := range ach.ackTasks {
						if task.isContain(s) {
							create = true
							ackChain := task.NewAckChain(jobWatchUid)
							ach.jobAckChains[ackChain.Key()] = ackChain
							ackChain.Append(s)
							break
						}
					}
					if !create {
						log.Debug("append state of source has stopped: %+v", s)
					}
				}
			}
		case ss := <-ach.ackChan:
			for _, s := range ss {
				jobWatchUid := s.WatchUid()
				if chain, ok := ach.jobAckChains[jobWatchUid]; ok {
					chain.Ack(s)
				} else {
					log.Debug("ack state of source has stopped: %+v", s)
				}
			}

Steps to Reproduce the Problem

@pwm1992 pwm1992 added the bug Something isn't working label Dec 12, 2023
@pwm1992 pwm1992 changed the title branch main pkg/source/file/watch.go, drop the funtion of Pre-allocation offset branch main pkg/source/file/watch.go:321, your have drop the funtion of Pre-allocation offset Dec 12, 2023
@pwm1992 pwm1992 changed the title branch main pkg/source/file/watch.go:321, your have drop the funtion of Pre-allocation offset branch main pkg/source/file/watch.go:321, your have drop the function of Pre-allocation offset Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant