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

Multiple sqlitex.Pools giving off by 1 values #110

Open
delaneyj opened this issue Dec 31, 2020 · 2 comments
Open

Multiple sqlitex.Pools giving off by 1 values #110

delaneyj opened this issue Dec 31, 2020 · 2 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@delaneyj
Copy link

delaneyj commented Dec 31, 2020

Using sonyflake IDs and getting odd behavior

image

Most of the time its the correct value however I'm getting a ton of off by 1 values
image

When doing something like AggregateID:= stmt.GetInt64("agg_id"). These values all well within 64 bits so not sure what the issue could be. Any thoughts on what I could be doing wrong?

If I call it explicitly via

stmt2 := db.Prep("select * from events where agg_id=132345566607552512;")
	for {
		has, err := stmt2.Step()
		if err != nil {
			log.Fatal(err)
		}
		if !has {
			break
		}
		log.Print(stmt2.GetInt64("agg_id"), stmt2.GetInt64("version"))
	}

EDIT: also oddly I'm getting off by one the other direction as well. 132361724597481473 in sqlite but coming through as 132361724597481472

EDIT2: So I changed ALL ids from int64 to string. Exact same issue! So I narrowed it down.

  1. Have 2 goroutines (A,B) with completely different pools and databases (A.sqlite & B.sqlite)
  2. Get errors
  3. Comment out either pool
  4. Works as expected.
  5. Enable both and delete previous databases
  6. Get errors
  7. A.sqlite contains what I'd expect the contents of B.sqlite to be, B.sqlite is empty!

So is having multiple pools of separate not supported in the same process?

@delaneyj delaneyj changed the title GetInt64() giving off by 1 values Multiple sqlitex.Pools giving off by 1 values Jan 1, 2021
@delaneyj
Copy link
Author

Ping, any one else the similar behavior?

@AdamSLevy
Copy link
Collaborator

@delaneyj I can't debug this with the information you've provided. I need a complete minimal and reproducible code example please.

@AdamSLevy AdamSLevy added invalid This doesn't seem right question Further information is requested and removed invalid This doesn't seem right labels Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants