google-code-export / sqljet

Automatically exported from code.google.com/p/sqljet
0 stars 1 forks source link

Assertion failure using getRowId on SqlJetIndexScopeCursor #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enable Java assertions.
2. Within read transaction, create cursor with scope(...)
3. Within same transaction, call cursor.getRowId()

What is the expected output? What do you see instead?

Expect to get the row id.  Instead assertion fails with following trace:

Exception in thread "main" java.lang.AssertionError
    at org.tmatesoft.sqljet.core.internal.btree.SqlJetBtree.enter(SqlJetBtree.java:174)
    at org.tmatesoft.sqljet.core.internal.btree.SqlJetBtreeCursor.enterCursor(SqlJetBtreeCursor.java:2613)
    at org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable.hasMoved(SqlJetBtreeTable.java:135)
    at org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeTable.eof(SqlJetBtreeTable.java:127)
    at org.tmatesoft.sqljet.core.internal.table.SqlJetIndexScopeCursor.getRowId(SqlJetIndexScopeCursor.java:236)

where the failing assertion is the following line:

/* We should already hold a lock on the database connection */
assert (p.db.getMutex().held());

Note that running with assertions disabled, the row id is returned.

What version of the product are you using? On what operating system?

1.0.3b914.

Original issue reported on code.google.com by cdemarc...@gmail.com on 17 Mar 2011 at 9:07

GoogleCodeExporter commented 9 years ago

Original comment by sergey.s...@gmail.com on 17 Mar 2011 at 9:17

GoogleCodeExporter commented 9 years ago
The same assertion failure occurs with cursor.getRowCount(), and likewise the 
method works if assertions are disabled.

Original comment by cdemarc...@gmail.com on 19 Mar 2011 at 4:14

GoogleCodeExporter commented 9 years ago
Could you please try the same code with SqlJet 1.0.4. 

You may download SqlJet 1.0.4 binaries at 
https://teamcity.svnkit.com/viewLog.html?buildId=12457&tab=artifacts&buildTypeId
=bt47

Original comment by kit...@gmail.com on 22 Mar 2011 at 5:09

GoogleCodeExporter commented 9 years ago
I've added a test to SqlJet trunk (IndexScopeTest.testNoAssertionOnGetRowId) 
which pass with Java assertions enabled. We'll see whether this issue 
reproducible in 1.0.x soon, when recent trunk changes are merged back to 1.0.x

Original comment by kit...@gmail.com on 22 Mar 2011 at 6:12

GoogleCodeExporter commented 9 years ago
Now test is merged to 1.0.x branch and pass there as well. I assume this issue 
was fixed between 1.0.3 and 1.0.4 versions of SVNKit. In case you still able to 
reproduce it, please provide a code sample or unit test. Thanks!

Original comment by kit...@gmail.com on 23 Mar 2011 at 2:07