Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here's the original post: http://drupal.org/node/49110
The problem is, there is a limit to 127 blocks. This may not be a big problem, but if a user creates and deletes many blocks, the auto-increment will not reset. So once there are 127 blocks, no more blocks can be created.
The problem is the 'bid' field in the 'boxes' table. It needs to be changed from tinyint to smallint, which would make the smallest index be 32767 (or maybe 9999 since the digit limit is currently 4).
This should be changed in all versions (4.5, 4.6, 4.7).
Comment | File | Size | Author |
---|---|---|---|
#21 | tinyint_0.patch | 1.8 KB | m3avrck |
#19 | tinyint.patch | 1.81 KB | chx |
#9 | fix_bid_aid_5x_1.txt | 1.67 KB | pwolanin |
Comments
Comment #1
handelaar CreditAttribution: handelaar commentedBizarre edge cases and 'critical' are two parts of the Venn diagram which don't intersect.
Resetting to normal
Comment #2
Steve Simms CreditAttribution: Steve Simms commented127 user-defined blocks doesn't seem that far-fetched, particularly for a large site and/or an older one.
This is only a problem with the MySQL schema, in any case. PostgreSQL's serials are integers, so they have a much higher limit.
I don't have MySQL available, so I'd feel very uncomfortable submitting a patch for this (moreso for the update than the schema), but looking through the schema, the boxes bid has the smallest auto_increment limit of all the tables, as a tinyint. The vast majority of the tables use int(10) as their auto_incrementing primary keys, except for one (filter_formats) that has int(4), and another (watchdog) that has int(5).
So, I'd suggest changing it to one of those three. I imagine any of them would be large enough for even the largest sites, though the int(10) would be safest and most consistent with the rest of the schema.
Comment #3
Steve Simms CreditAttribution: Steve Simms commentedComment #4
magico CreditAttribution: magico commentedProbably all tinyint should be changed. Or check all auto_increment fields to be changed to "int" or "smallint".
Comment #5
pwolanin CreditAttribution: pwolanin commentedThis seems silly- saving a few bytes of disk space by using tinyint is not going to be of benefit. Also, what if I want an autogenerated, custom block per page? (not a good idea, I'm sure, for performance- but feasible). So, it seems to me like bid should be the same as nid.
Comment #6
coreb CreditAttribution: coreb commentedComment #7
pwolanin CreditAttribution: pwolanin commentedproblem exists is 5.x too- should be fixed in HEAD first. Patch to follow (requires system update...).
What about the "custom" field in the blocks table?
Comment #8
bradlis7 CreditAttribution: bradlis7 commentedFixing title
Comment #9
pwolanin CreditAttribution: pwolanin commentedOk, something funny is going on, since there is already a system update that would change `bid` to an INT for any update from 4.7:
So, at the moment the updated schema won't match the schema of a fresh install.
Proposed solution: the numbers in parens should be removed (per updated code style) and the 5.x schema fixed so that `bid` and `aid` are INT for any fresh 5.x install under mysql (patch attached).
Comment #10
dopry CreditAttribution: dopry commentedint is used in other mysql column definitions.
we haven't released 5 so no worries updating the update_N function.
fixes an obvious error.
Comment #11
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. We might want to backport this to Drupal 4.7. I leave that up to Gerhard to decide.
Comment #12
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedWhat we could do is to only put it into database.*.mysql files. I don't think having a db update is neccessary.
Comment #13
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedI've reconsidered: I'd like a patch for 4.7. How will this affect the 4->5 upgrade path, though?
Comment #14
pwolanin CreditAttribution: pwolanin commentedWill mysql/postgresql throw an error if the ALTER TABLE does not change anything?
Seems fine for mysql (4.1.18) to run it multiple times:
Comment #15
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedyeah, I guess the upgrade path won't be affected
Comment #16
BioALIEN CreditAttribution: BioALIEN commentedJust for the record. So this patch is already comitted to 5.x but is now in the process of being comitted to the 4.7 branch also?
Comment #17
bradlis7 CreditAttribution: bradlis7 commentedYes, it's fixed in 5.0.
Comment #18
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedneeds a 4.7 patch
Comment #19
chx CreditAttribution: chx commentedComment #20
Zen CreditAttribution: Zen commentedNo backticks in your queries please.
-K
Comment #21
m3avrck CreditAttribution: m3avrck commentedbackticks removed, should be good.
Comment #22
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedthe mysdql 4.0 part was missing. I added that and committed.
Comment #23
(not verified) CreditAttribution: commented