Repository navigation
fix(adapter): map engine table-limit errors to Limit - #1077
Conversation
MySQL raises 1118 (row size too large) against InnoDB's 8126-byte inline row ceiling, well below the 65535 bytes the width pre-check counts, so a wide table of varchar columns reaches the engine and comes back as a raw PDOException. Callers that classify failures by exception type (the Appwrite databases worker treats Schema as a rejection of the request) cannot tell it apart from an outage, so the job was retried until its delivery budget ran out. Map ER_TOO_BIG_ROWSIZE, ER_TOO_MANY_FIELDS, ER_TOO_MANY_KEYS, ER_TOO_MANY_KEY_PARTS and ER_TOO_BIG_FIELDLENGTH on MariaDB/MySQL, and 54011 (too many columns) on Postgres, to Limit. These are matched on the engine errno alone because the SQLSTATE differs between them (1117 is HY000, the rest 42000). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code review
The MariaDB/MySQL adapters now map selected engine schema-limit error codes to Walkthrough (3)
Reviewed Tip Comment |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|

What
Maps the engine errors for a table definition past an engine limit to
Limit(aSchemaexception):ER_TOO_BIG_ROWSIZEER_TOO_MANY_FIELDSER_TOO_MANY_KEYSER_TOO_MANY_KEY_PARTSER_TOO_BIG_FIELDLENGTHWhy
On staging, a table with ~120 varchar columns hit
SQLSTATE[42000] 1118 Row size too large ... is 8126. InnoDB's inline row ceiling (8126 bytes) is far below the 65535 bytesDatabase::createAttribute()'s width check counts against, so the DDL reaches the engine, andprocessException()returned the rawPDOException. The Appwrite databases worker treatsSchemaexceptions as a rejection of the customer's request (mark the columnfailed, ACK the job), but a rawPDOExceptionlooks like an outage, so each job was retried 5 times over ~22 minutes of NATS backoff. 16 of them held everymaxAckPendingslot on the consumer, and other projects' columns on that pool stayedprocessingfor 30+ minutes.The MariaDB-family codes are matched on errno alone because their SQLSTATEs differ (1117 is
HY000, the rest42000).Tests
EngineErrorMappingTest::testTableDefinitionPastAnEngineLimitIsALimit: 11 cases (5 codes × MariaDB/MySQL + Postgres 54011). All 11 fail without the adapter change. The existing "other 54000 stays raw" fixture used the 1600-column message, which Postgres actually raises as 54011, so it now uses a real 54000 (row is too big).🤖 Generated with Claude Code
Summary by CodeRabbit