From 5027ec6c79aab48340a7be4cba5b117386e9097b Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Thu, 22 Aug 2024 12:26:34 +0300 Subject: [PATCH] internal/xerrors changes --- internal/xerrors/retryable.go | 13 +++++++++++++ trace/query_gtrace.go | 31 +++++++++++++++++++++++++++++++ trace/table_gtrace.go | 25 +++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/internal/xerrors/retryable.go b/internal/xerrors/retryable.go index 5a5a7cd89..8f684d2ac 100644 --- a/internal/xerrors/retryable.go +++ b/internal/xerrors/retryable.go @@ -150,3 +150,16 @@ type unretryableError struct { func (e unretryableError) Unwrap() error { return e.error } + +func IsRetryableError(err error) bool { + if err == nil { + return true + } + + var e *retryableError + if errors.As(err, &e) { + return e != nil + } + + return false +} diff --git a/trace/query_gtrace.go b/trace/query_gtrace.go index 6793586a5..30f21e90f 100644 --- a/trace/query_gtrace.go +++ b/trace/query_gtrace.go @@ -1563,6 +1563,7 @@ func (t *Query) onResultClose(q QueryResultCloseStartInfo) func(info QueryResult } return res } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnNew(t *Query, c *context.Context, call call) func() { var p QueryNewStartInfo @@ -1574,6 +1575,7 @@ func QueryOnNew(t *Query, c *context.Context, call call) func() { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnClose(t *Query, c *context.Context, call call) func(error) { var p QueryCloseStartInfo @@ -1586,6 +1588,7 @@ func QueryOnClose(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolNew(t *Query, c *context.Context, call call) func(limit int) { var p QueryPoolNewStartInfo @@ -1598,6 +1601,7 @@ func QueryOnPoolNew(t *Query, c *context.Context, call call) func(limit int) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolClose(t *Query, c *context.Context, call call) func(error) { var p QueryPoolCloseStartInfo @@ -1610,6 +1614,7 @@ func QueryOnPoolClose(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolTry(t *Query, c *context.Context, call call) func(error) { var p QueryPoolTryStartInfo @@ -1622,6 +1627,7 @@ func QueryOnPoolTry(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolWith(t *Query, c *context.Context, call call) func(_ error, attempts int) { var p QueryPoolWithStartInfo @@ -1635,6 +1641,7 @@ func QueryOnPoolWith(t *Query, c *context.Context, call call) func(_ error, atte res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolPut(t *Query, c *context.Context, call call) func(error) { var p QueryPoolPutStartInfo @@ -1647,6 +1654,7 @@ func QueryOnPoolPut(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolGet(t *Query, c *context.Context, call call) func(error) { var p QueryPoolGetStartInfo @@ -1659,6 +1667,7 @@ func QueryOnPoolGet(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnPoolChange(t *Query, limit int, idle int) { var p QueryPoolChange @@ -1666,6 +1675,7 @@ func QueryOnPoolChange(t *Query, limit int, idle int) { p.Idle = idle t.onPoolChange(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnDo(t *Query, c *context.Context, call call) func(attempts int, _ error) { var p QueryDoStartInfo @@ -1679,6 +1689,7 @@ func QueryOnDo(t *Query, c *context.Context, call call) func(attempts int, _ err res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnDoTx(t *Query, c *context.Context, call call) func(attempts int, _ error) { var p QueryDoTxStartInfo @@ -1692,6 +1703,7 @@ func QueryOnDoTx(t *Query, c *context.Context, call call) func(attempts int, _ e res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnExec(t *Query, c *context.Context, call call, query string) func(error) { var p QueryExecStartInfo @@ -1705,6 +1717,7 @@ func QueryOnExec(t *Query, c *context.Context, call call, query string) func(err res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnQuery(t *Query, c *context.Context, call call, query string) func(error) { var p QueryQueryStartInfo @@ -1718,6 +1731,7 @@ func QueryOnQuery(t *Query, c *context.Context, call call, query string) func(er res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnQueryResultSet(t *Query, c *context.Context, call call, query string) func(error) { var p QueryQueryResultSetStartInfo @@ -1731,6 +1745,7 @@ func QueryOnQueryResultSet(t *Query, c *context.Context, call call, query string res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnQueryRow(t *Query, c *context.Context, call call, query string) func(error) { var p QueryQueryRowStartInfo @@ -1744,6 +1759,7 @@ func QueryOnQueryRow(t *Query, c *context.Context, call call, query string) func res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionCreate(t *Query, c *context.Context, call call) func(session sessionInfo, _ error) { var p QuerySessionCreateStartInfo @@ -1757,6 +1773,7 @@ func QueryOnSessionCreate(t *Query, c *context.Context, call call) func(session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionAttach(t *Query, c *context.Context, call call, session sessionInfo) func(error) { var p QuerySessionAttachStartInfo @@ -1770,6 +1787,7 @@ func QueryOnSessionAttach(t *Query, c *context.Context, call call, session sessi res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionDelete(t *Query, c *context.Context, call call, session sessionInfo) func(error) { var p QuerySessionDeleteStartInfo @@ -1783,6 +1801,7 @@ func QueryOnSessionDelete(t *Query, c *context.Context, call call, session sessi res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionExec(t *Query, c *context.Context, call call, session sessionInfo, query string) func(error) { var p QuerySessionExecStartInfo @@ -1797,6 +1816,7 @@ func QueryOnSessionExec(t *Query, c *context.Context, call call, session session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionQuery(t *Query, c *context.Context, call call, session sessionInfo, query string) func(error) { var p QuerySessionQueryStartInfo @@ -1811,6 +1831,7 @@ func QueryOnSessionQuery(t *Query, c *context.Context, call call, session sessio res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionQueryResultSet(t *Query, c *context.Context, call call, session sessionInfo, query string) func(error) { var p QuerySessionQueryResultSetStartInfo @@ -1825,6 +1846,7 @@ func QueryOnSessionQueryResultSet(t *Query, c *context.Context, call call, sessi res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionQueryRow(t *Query, c *context.Context, call call, session sessionInfo, query string) func(error) { var p QuerySessionQueryRowStartInfo @@ -1839,6 +1861,7 @@ func QueryOnSessionQueryRow(t *Query, c *context.Context, call call, session ses res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnSessionBegin(t *Query, c *context.Context, call call, session sessionInfo) func(_ error, tx txInfo) { var p QuerySessionBeginStartInfo @@ -1853,6 +1876,7 @@ func QueryOnSessionBegin(t *Query, c *context.Context, call call, session sessio res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnTxExec(t *Query, c *context.Context, call call, session sessionInfo, tx txInfo, query string) func(error) { var p QueryTxExecStartInfo @@ -1868,6 +1892,7 @@ func QueryOnTxExec(t *Query, c *context.Context, call call, session sessionInfo, res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnTxQuery(t *Query, c *context.Context, call call, session sessionInfo, tx txInfo, query string) func(error) { var p QueryTxQueryStartInfo @@ -1883,6 +1908,7 @@ func QueryOnTxQuery(t *Query, c *context.Context, call call, session sessionInfo res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnTxQueryResultSet(t *Query, c *context.Context, call call, tx txInfo, query string) func(error) { var p QueryTxQueryResultSetStartInfo @@ -1897,6 +1923,7 @@ func QueryOnTxQueryResultSet(t *Query, c *context.Context, call call, tx txInfo, res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnTxQueryRow(t *Query, c *context.Context, call call, tx txInfo, query string) func(error) { var p QueryTxQueryRowStartInfo @@ -1911,6 +1938,7 @@ func QueryOnTxQueryRow(t *Query, c *context.Context, call call, tx txInfo, query res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnResultNew(t *Query, c *context.Context, call call) func(error) { var p QueryResultNewStartInfo @@ -1923,6 +1951,7 @@ func QueryOnResultNew(t *Query, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnResultNextPart(t *Query, c *context.Context, call call) func(stats *Ydb_TableStats.QueryStats, _ error) { var p QueryResultNextPartStartInfo @@ -1936,6 +1965,7 @@ func QueryOnResultNextPart(t *Query, c *context.Context, call call) func(stats * res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnResultNextResultSet(t *Query, c *context.Context, call call) func(error) { var p QueryResultNextResultSetStartInfo @@ -1948,6 +1978,7 @@ func QueryOnResultNextResultSet(t *Query, c *context.Context, call call) func(er res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func QueryOnResultClose(t *Query, c *context.Context, call call) func(error) { var p QueryResultCloseStartInfo diff --git a/trace/table_gtrace.go b/trace/table_gtrace.go index d8908dfc8..7c4f4fe39 100644 --- a/trace/table_gtrace.go +++ b/trace/table_gtrace.go @@ -1213,6 +1213,7 @@ func (t *Table) onPoolWait(t1 TablePoolWaitStartInfo) func(TablePoolWaitDoneInfo } return res } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnInit(t *Table, c *context.Context, call call) func(limit int) { var p TableInitStartInfo @@ -1225,6 +1226,7 @@ func TableOnInit(t *Table, c *context.Context, call call) func(limit int) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnClose(t *Table, c *context.Context, call call) func(error) { var p TableCloseStartInfo @@ -1237,6 +1239,7 @@ func TableOnClose(t *Table, c *context.Context, call call) func(error) { res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnDo(t *Table, c *context.Context, call call, label string, idempotent bool, nestedCall bool) func(attempts int, _ error) { var p TableDoStartInfo @@ -1253,6 +1256,7 @@ func TableOnDo(t *Table, c *context.Context, call call, label string, idempotent res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnDoTx(t *Table, c *context.Context, call call, label string, idempotent bool, nestedCall bool) func(attempts int, _ error) { var p TableDoTxStartInfo @@ -1269,6 +1273,7 @@ func TableOnDoTx(t *Table, c *context.Context, call call, label string, idempote res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnCreateSession(t *Table, c *context.Context, call call) func(session sessionInfo, attempts int, _ error) { var p TableCreateSessionStartInfo @@ -1283,6 +1288,7 @@ func TableOnCreateSession(t *Table, c *context.Context, call call) func(session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionNew(t *Table, c *context.Context, call call) func(session sessionInfo, _ error) { var p TableSessionNewStartInfo @@ -1296,6 +1302,7 @@ func TableOnSessionNew(t *Table, c *context.Context, call call) func(session ses res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionDelete(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableSessionDeleteStartInfo @@ -1309,6 +1316,7 @@ func TableOnSessionDelete(t *Table, c *context.Context, call call, session sessi res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionKeepAlive(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableKeepAliveStartInfo @@ -1322,6 +1330,7 @@ func TableOnSessionKeepAlive(t *Table, c *context.Context, call call, session se res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionBulkUpsert(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableBulkUpsertStartInfo @@ -1335,6 +1344,7 @@ func TableOnSessionBulkUpsert(t *Table, c *context.Context, call call, session s res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryPrepare(t *Table, c *context.Context, call call, session sessionInfo, query string) func(result tableDataQuery, _ error) { var p TablePrepareDataQueryStartInfo @@ -1350,6 +1360,7 @@ func TableOnSessionQueryPrepare(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryExecute(t *Table, c *context.Context, call call, session sessionInfo, query tableDataQuery, parameters tableQueryParameters, keepInCache bool) func(tx txInfo, prepared bool, result tableResult, _ error) { var p TableExecuteDataQueryStartInfo @@ -1369,6 +1380,7 @@ func TableOnSessionQueryExecute(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryExplain(t *Table, c *context.Context, call call, session sessionInfo, query string) func(aST string, plan string, _ error) { var p TableExplainQueryStartInfo @@ -1385,6 +1397,7 @@ func TableOnSessionQueryExplain(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryStreamExecute(t *Table, c *context.Context, call call, session sessionInfo, query tableDataQuery, parameters tableQueryParameters) func(error) { var p TableSessionQueryStreamExecuteStartInfo @@ -1400,6 +1413,7 @@ func TableOnSessionQueryStreamExecute(t *Table, c *context.Context, call call, s res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnSessionQueryStreamRead(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TableSessionQueryStreamReadStartInfo @@ -1413,6 +1427,7 @@ func TableOnSessionQueryStreamRead(t *Table, c *context.Context, call call, sess res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxBegin(t *Table, c *context.Context, call call, session sessionInfo) func(tx txInfo, _ error) { var p TableTxBeginStartInfo @@ -1427,6 +1442,7 @@ func TableOnTxBegin(t *Table, c *context.Context, call call, session sessionInfo res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxExecute(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo, query tableDataQuery, parameters tableQueryParameters) func(result tableResult, _ error) { var p TableTransactionExecuteStartInfo @@ -1444,6 +1460,7 @@ func TableOnTxExecute(t *Table, c *context.Context, call call, session sessionIn res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxExecuteStatement(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo, statementQuery tableDataQuery, parameters tableQueryParameters) func(result tableResult, _ error) { var p TableTransactionExecuteStatementStartInfo @@ -1461,6 +1478,7 @@ func TableOnTxExecuteStatement(t *Table, c *context.Context, call call, session res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxCommit(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo) func(error) { var p TableTxCommitStartInfo @@ -1475,6 +1493,7 @@ func TableOnTxCommit(t *Table, c *context.Context, call call, session sessionInf res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnTxRollback(t *Table, c *context.Context, call call, session sessionInfo, tx txInfo) func(error) { var p TableTxRollbackStartInfo @@ -1489,6 +1508,7 @@ func TableOnTxRollback(t *Table, c *context.Context, call call, session sessionI res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolStateChange(t *Table, size int, event string) { var p TablePoolStateChangeInfo @@ -1496,18 +1516,21 @@ func TableOnPoolStateChange(t *Table, size int, event string) { p.Event = event t.onPoolStateChange(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolSessionAdd(t *Table, session sessionInfo) { var p TablePoolSessionAddInfo p.Session = session t.onPoolSessionAdd(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolSessionRemove(t *Table, session sessionInfo) { var p TablePoolSessionRemoveInfo p.Session = session t.onPoolSessionRemove(p) } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolPut(t *Table, c *context.Context, call call, session sessionInfo) func(error) { var p TablePoolPutStartInfo @@ -1521,6 +1544,7 @@ func TableOnPoolPut(t *Table, c *context.Context, call call, session sessionInfo res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolGet(t *Table, c *context.Context, call call) func(session sessionInfo, attempts int, _ error) { var p TablePoolGetStartInfo @@ -1535,6 +1559,7 @@ func TableOnPoolGet(t *Table, c *context.Context, call call) func(session sessio res(p) } } + // Internals: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#internals func TableOnPoolWait(t *Table, c *context.Context, call call) func(session sessionInfo, _ error) { var p TablePoolWaitStartInfo