rana / ora

An Oracle database driver in Go.
MIT License
272 stars 66 forks source link

Query Result NOT Identical to Records In DB #244

Open guoshenkuang opened 6 years ago

guoshenkuang commented 6 years ago

we found that when query using multiple go routine, the query result is not identical to that in database.

reproduction environment:

  1. we have a table hs_his.his_ofdeliver, with 4 columns, FUND_ACCOUNT NOT NULL VARCHAR2(18),FUND_CODE NOT NULL VARCHAR2(6), BUSINESS_FLAG NOT NULL NUMBER(10), MONEY_TYPE NOT NULL VARCHAR2(3)
  2. insert 4 records into hs_his.his_ofdeliver, ('14900666', '270004', '143', '0'), ('1868091', '270004', '143', '0'),('1898964', '270004', '143', '0'),('14900397', '270004', '143', '0'),
  3. run the code in attachment, we expect that the query result should be identical to records in db, but actually not.

sample output: image main.go.txt

tgulacsi commented 6 years ago

No idea. Have you tried with the race detector? What if you limit the number of goroutines to 1?

guoshenkuang commented 6 years ago

we have try these three cases: 1) ora version v4.1.15, 64 go routines, errors are detected in a few seconds 2) ora version v4.1.15, 1 go routine, the first error is detected in about 10 min 3) ora version v4.1.9, 64 go routines, no errors are detected in 2 hours

tgulacsi commented 6 years ago

I'll try to create a reproducer, but if you use only database/sql, you could easily try my other driver, gopkg.in/goracle.v2 .

tgulacsi commented 6 years ago

70733b7 has a reproducer

go test -race -run=244

But couldn't find a solution yet. gopkg.in/goracle.v2 does not have this error (with the same test).