This repository has been archived by the owner on Nov 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Race at tip #169
Labels
Comments
@cznic It looks like I forgot to add |
Thank you 👍 PS: I'm to blame, do you remember? ;-) |
haha! I remember! 😄 Still you noticed it. I think we should have CI (travis/drone) to automate this. So we can run with |
@cznic I have traced the issue back to 324177d that is because it is the last point where the below test case pass. It seems it can be triggered by this test case func TestWhereExists(t *testing.T) {
RegisterMemDriver()
db, err := sql.Open("ql-mem", "")
if err != nil {
t.Fatal(err)
}
defer db.Close()
tx, err := db.Begin()
if err != nil {
t.Fatal(err)
}
tx.Exec(`
BEGIN TRANSACTION;
CREATE TABLE t (i int);
CREATE TABLE s (i int);
INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1);
INSERT INTO t VALUES (2);
INSERT INTO t VALUES (3);
INSERT INTO t VALUES (4);
INSERT INTO t VALUES (5);
INSERT INTO s VALUES (2);
COMMIT;
`)
err = tx.Commit()
if err != nil {
t.Fatal(err)
}
s, err := db.Prepare(`
select * from t where exists (select * from s where i==$1);
`)
if err != nil {
t.Fatal(err)
}
defer s.Close()
var wg sync.WaitGroup
for i := 0; i < 5; i++ {
go func(id int, wait *sync.WaitGroup) {
var c int
err := s.QueryRow(id).Scan(&c)
if id == 2 {
if err != nil {
t.Error(err)
}
if id == 2 && c != 5 {
t.Errorf("expected %d got %d", id, c)
}
} else {
if err != sql.ErrNoRows {
t.Errorf("expected %v got %v", sql.ErrNoRows, err)
}
}
wait.Done()
}(i, &wg)
wg.Add(1)
}
wg.Wait()
} While II'm checking where might the map access happen. Can you please look into this test case just in case I missed something? I have a feeling this is related to #150` and the test case just uncovered it |
gernest
added a commit
to gernest/ql
that referenced
this issue
May 5, 2017
gernest
added a commit
to gernest/ql
that referenced
this issue
May 5, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
@gernest Please try if you can reproduce the race.
Using 26248ea
The text was updated successfully, but these errors were encountered: