Originally, `fail` is added to simplify error handling, avoiding large changes on
the Txn() interface API. But it turns out that `fail` becomes the root of many bugs.
So this commit remove the `fail` and make an API refactory.
* change Txn() function signature to Txn(active bool)
* ActivePendingTxn() is not used any more because Txn() does the work
* change executor builder getStartTS() uint64 to getStartTS() (uint64, error)
We import "github.com/pkg/errors" in the code, and actually put
the "github.com/pingcap/errors" there in the vendor path.
That's a dirty hack, and prevent the introduce of Go module.
kv.BypassLatch was introduced to handle the fake transaction confliction problem
in the old implementation. After redesign of the latch scheduler, it's not
needed any more.
Enable latch scheduler makes CI to run it, we can fix bugs and make this feature
more stable.
There is a small performance penalty, less than 5%, users are free to disable it.
The newly added label is `sql_type`, it has value: `general` and `internal`,
users can use this label to filter metrics they have interest.
Also, add keyword `[INTERNAL]` for restricted SQL printed in slow log for
convenient identification.
'load data' is not retryable when it meets conflicts, while latches may result in
false positive transaction conflicts. so enable latches will lead to 'load data'
abort abnormally, even there are no conflicts.
Implement server-side cursors by handling COM_STMT_FETCH command.
The client indicates that it wants to use cursor
by setting a flag in COM_STMT_EXECUTE
Please refer to https://dev.mysql.com/doc/internals/en/com-stmt-execute.html
Subsequently, the client acquires result rows repeatedly by COM_STMT_FETCH,
which will carry stmt-id and fetch size.
Please refer to https://dev.mysql.com/doc/internals/en/com-stmt-fetch.html
This commit only support forward-only, read-only cursor