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

Select queries are not instrumented correctly #3073

Closed
stefanosiano opened this issue Dec 1, 2023 · 0 comments · Fixed by #3604
Closed

Select queries are not instrumented correctly #3073

stefanosiano opened this issue Dec 1, 2023 · 0 comments · Fixed by #3604
Assignees
Labels
enhancement New feature or request Platform: Android Platform: Java Type: Bug Something isn't working

Comments

@stefanosiano
Copy link
Member

Description

In Android select queries return a Cursor, and the query is actually executed when the Cursor is read.
Our instrumentation wraps the query method, which is always fast.
Here is an example of a transaction with a slow query select * from storeitem where first_name regexp '.*.*.*.*1'. The Dao span is correct, but the db.sql.query span is 1ms long, which is wrong. The related profile gives some more insight.
This affects only select queries, as updates don't return a cursor.
We should wrap the cursor with a custom wrapper and override the correct methods.
Some challenges:

  • getCount() fills the data only the first time, so we should account for that
  • onMove() is not available in Cursor, but only in SQLiteCursor. But we get a Cursor and we should return a Cursor
  • accessing private fields in SQLiteCursor with reflection failed
@github-project-automation github-project-automation bot moved this to Needs Discussion in Mobile & Cross Platform SDK Dec 1, 2023
@stefanosiano stefanosiano added Type: Bug Something isn't working enhancement New feature or request labels Dec 1, 2023
@markushi markushi moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Dec 13, 2023
@stefanosiano stefanosiano moved this from Backlog to Todo in Mobile & Cross Platform SDK Mar 13, 2024
@stefanosiano stefanosiano self-assigned this Jul 25, 2024
@stefanosiano stefanosiano moved this from Todo to Needs Review in Mobile & Cross Platform SDK Jul 25, 2024
@github-project-automation github-project-automation bot moved this from Needs Review to Done in Mobile & Cross Platform SDK Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Android Platform: Java Type: Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant