stag7824 opened a new pull request, #14723:
URL: https://github.com/apache/cloudstack/pull/14723

   ### Description
   
   Fixes #14715
   
   `registerTemplate` and `registerIso` declare `url` with `length = 2048`, and 
`VMTemplateVO` maps the column with `length = 2048`, but `vm_template.url` 
itself is `VARCHAR(1024)`: #8675 widened it from 255 to 1024 in 
`schema-41900to41910.sql`, and nothing changed it since. A URL of 1025 to 2048 
characters therefore passes the API's length check and then fails when the 
template row is written. S3 presigned URLs signed with temporary credentials 
are usually in that range because of the `X-Amz-Security-Token`.
   
   This widens the column to 2048 in `schema-42210to42220.sql`, with the same 
statement shape and column comment as the 4.19.1 change, so the column matches 
the API parameter and the VO, and the sibling URL columns that were widened to 
2048 before (for example `template_store_ref.download_url` in 
`schema-42200to42210.sql`).
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [x] Minor
   
   ### How Has This Been Tested?
   
   On MySQL 8.0.46 (default `sql_mode`, including `STRICT_TRANS_TABLES`), with 
`vm_template.url` as it is after 4.19.1 and a 1701-character presigned-style 
URL:
   
   ```
   before:  ERROR 1406 (22001) at line 1: Data too long for column 'url' at row 
1
   after:   inserted, LENGTH(url) = 1701, column is varchar(2048) with its 
comment kept
   ```
   
   The statement was applied twice to check that rerunning it is harmless, and 
a view selecting `url` kept working.
   
   To check the change can't hit MySQL's row size limit during upgrade, I also 
applied it to the full `vm_template` definition: the `create-schema.sql` table 
in `utf8` plus every column added to it by later upgrade scripts (40 columns). 
The `ALTER` succeeded.
   
   I haven't run a full management server upgrade with it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to