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

Pipelined save()'s fail in RC2 #411

Closed
jseibert opened this Issue Mar 22, 2018 · 1 comment

Comments

2 participants
@jseibert
Copy link
Contributor

jseibert commented Mar 22, 2018

In reference to vapor/mysql#143, this appears to be a higher level issue where pipelined queries now work, but save()'s do not.

Full test code to reproduce the issue:

public func boot(_ app: Application) throws {
    _ = try app.withConnection(to: .mysql) { (db) -> Future<Void> in
        let cat1 = TransactionCategory(name: "Category 1")
        let cat2 = TransactionCategory(name: "Category 2")
        
        return [
            cat1.save(on: db),
            cat2.save(on: db)
        ].flatten(on: db).transform(to: Void())

    }.wait()
}

This fails with:

error(⚠️ MySQL Error: Prepare response has invalid status: 1
- id: MySQLError.prepareStatus

File: /Users/jseibert/api/.build/checkouts/mysql.git-1890032512239690518/Sources/MySQL/Protocol/MySQLComStmtPrepareOK.swift
 - func: init(bytes:)
 - line: 25
 - column: 133
)
@tanner0101

This comment has been minimized.

Copy link
Member

tanner0101 commented Mar 22, 2018

The specific issue with the invalid response is due to MySQL incorrectly handling query pipelining. See vapor/mysql#143 for that.

However, this issue did bring up another concern that Fluent needs to have its own concept of operation pipelining. Fluent must ensure a previous "operation" (or transaction maybe) is finished on a given connection before starting another one. This is because Fluent operations can span multiple db queries (such as an insert followed by a select).

@tanner0101 tanner0101 referenced this issue Mar 22, 2018

Merged

operation pipelining #413

1 of 1 task complete

@tanner0101 tanner0101 referenced this issue Mar 22, 2018

Merged

Pipeline 411 #86

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