1. Set the default txn size limit to 1G
2. Reduce memory footprint during insert for the large txn
3. Recycle the session buffer memory to avoid leak
4. Set rate limit to avoid 2PC prewrite overloads the TiKV
5. Start ttlManager for the large txn
* consecutive id
* add AllocN interface func for util/kvencoder/allocator.go
* fix allocN test
* fix allocN tests
* fix allocN test 1
* fix allocN test 2
* fix allocN test 3
* fix allocN test 4
* fix cache
* add auto consecutive increment id in insert executor
* add auto consecutive increment id comment in insert executor
* try fix test case
* fix session_test.TestAutoIncrementID autoid overflow
* fix session_test.TestAutoIncrementID unsighed autoid overflow
* fix autoid usigned computing overflow
* fix conflict with suli's PR
* fix index out of range
* merge similar function
* delete fillRowLazy
* fix commment
* fix bug of rebase
* fix auto.go maxUint64 will be allocated
* fix maxInt64 autoid allocated
* fix batch rowIdx update
* add maxUint64 and maxInt64 limit in allocN
* reconstruct the autoid lazy alloc
* fix format
* remove commnet
* use new kind of logutil.logger(ctx) instead of logutil.BgLogger()
* combine alloc() and allocN together
* remove cache of hasValue
* remove cache of hasValue
* remove cache of hasValue
* remove cache of hasValue
* add test : autoID can find in retryInfo
* add test : autoID can find in retryInfo
* extract retry logic
* extract retry logic
* Update executor/insert_common.go
Co-Authored-By: bb7133 <bb7133@gmail.com>
* Update executor/insert_common.go
Co-Authored-By: bb7133 <bb7133@gmail.com>
* fix comment
* fix comment
* fix comment
* fix comment
* fix comment
* return min and max instead of slice in alloc autoid
* return min and max instead of slice in alloc autoid
* return min and max instead of slice in alloc autoid
* add comment for alloc N
Introduce a base() method to get the baseExecutor, so we don't need to add
method from baseExecutor to the Executor interface any more
Before:
```
type Executor interface {
Open(context.Context) error
Next(ctx context.Context, req *chunk.RecordBatch) error
Close() error
Schema() *expression.Schema
retTypes() []*types.FieldType
newFirstChunk() *chunk.Chunk
}
```
After:
```
type Executor interface {
base() *baseExecutor
Open(context.Context) error
Next(ctx context.Context, req *chunk.RecordBatch) error
Close() error
Schema() *expression.Schema
}
```
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.