Skip to content

The primary connection is sometimes used for reads #202

Description

@nwagu

I ran into a situation where writes are blocked because a long read was being done in the primary connection. Looking at the code, I saw that when the 9 read connections are all in use, the primary connection will be used for the next read if it's available.

// Try to acquire a connection.
SQLiteConnection connection = null;
if (!wantPrimaryConnection) {
    connection = tryAcquireNonPrimaryConnectionLocked(
        sql, connectionFlags); // might throw
}
if (connection == null) {
    connection = tryAcquirePrimaryConnectionLocked(connectionFlags); // might throw
}
if (connection != null) {
    return connection;
}

This might cause an expensive query to block writes to the db. Is this the expected behavior?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions