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

bugfix: rowcount doesn't work with select statements #2631

Merged
merged 1 commit into from Sep 28, 2018

Conversation

Projects
None yet
4 participants
@hackaugusto
Collaborator

hackaugusto commented Sep 28, 2018

From the python3's sqlite3 docs:

As required by the Python DB API Spec, the rowcount attribute “is -1 in
case no executeXX() has been performed on the cursor or the rowcount of
the last operation is not determinable by the interface”. This includes
SELECT statements because we cannot determine the number of rows a query
produced until all rows were fetched.

rowcount always returned -1, and the code to load the latest snapshot
assumed there was never a snapshot available, as a consequence all the
state changes where replaied on restarts

bugfix: rowcount doesn't work with select statements
From the python3's sqlite3 docs:

> As required by the Python DB API Spec, the rowcount attribute “is -1 in
> case no executeXX() has been performed on the cursor or the rowcount of
> the last operation is not determinable by the interface”. This includes
> SELECT statements because we cannot determine the number of rows a query
> produced until all rows were fetched.

rowcount always returned -1, and the code to load the latest snapshot
assumed there was never a snapshot available, as a consequence all the
state changes where replaied on restarts
@ulope

This comment has been minimized.

Collaborator

ulope commented Sep 28, 2018

Nice catch, that should probably make #2632 less of an issue.

@palango

Looks good. Should fix #2632

@ulope ulope merged commit 111c68e into raiden-network:master Sep 28, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@hackaugusto hackaugusto deleted the hackaugusto:bugfix_wal_replay branch Sep 28, 2018

ulope added a commit to ulope/raiden that referenced this pull request Sep 28, 2018

ulope added a commit that referenced this pull request Sep 28, 2018

@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Sep 30, 2018

Very nice catch. This explains a lot. But still from the way it's phrased it does not make sense why it would return -1?

The rowcount comes right after a cursor.execute(), no?

hackaugusto added a commit to hackaugusto/raiden that referenced this pull request Oct 5, 2018

hackaugusto added a commit to hackaugusto/raiden that referenced this pull request Oct 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment