File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2970,9 +2970,16 @@ export async function updateColumnType(
29702970 requestId : string
29712971) : Promise < TableDefinition > {
29722972 return withLockedTable ( data . tableId , async ( table , trx ) => {
2973- await setTableTxTimeouts ( trx , {
2974- statementMs : scaledStatementTimeoutMs ( table . rowCount ?? 0 , { baseMs : 60_000 , perRowMs : 2 } ) ,
2973+ // Scale both statement and idle timeouts to row count: the compatibility
2974+ // check below iterates every row in Node between the row SELECT and the
2975+ // schema UPDATE, leaving the transaction idle for that gap. The default 5s
2976+ // `idle_in_transaction_session_timeout` would abort a valid type change on
2977+ // a large table.
2978+ const timeoutMs = scaledStatementTimeoutMs ( table . rowCount ?? 0 , {
2979+ baseMs : 60_000 ,
2980+ perRowMs : 2 ,
29752981 } )
2982+ await setTableTxTimeouts ( trx , { statementMs : timeoutMs , idleMs : timeoutMs } )
29762983
29772984 if ( ! ( COLUMN_TYPES as readonly string [ ] ) . includes ( data . newType ) ) {
29782985 throw new Error (
You can’t perform that action at this time.
0 commit comments