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.
Some modules generate blocks based on some user input,
so it can really easy happen that the length exceeds 32. Then some workarounds have to happen to be still generate a unique delta.
So what about extending it to 64 chars, so there shouldn't be a problem.
Comment | File | Size | Author |
---|---|---|---|
#38 | extend_size_of_delta-1223772-38.patch | 1.58 KB | danquah |
#33 | extend_size_of_delta-1223772-33.patch | 1.58 KB | Anonymous (not verified) |
#11 | block-extend_the_size_of_block_delta_to_65-8.patch | 1.74 KB | asaal |
#8 | 1223772-block-delta-length-65.patch | 2.04 KB | brianV |
#1 | 1223772-block-delta-length-64.patch | 811 bytes | dawehner |
Comments
Comment #1
dawehnerThe maximum length of an index seems to be 1000 so that's not a problem
and http://forums.mysql.com/read.php?10,156585,156585#msg-156585
Comment #2
droplet CreditAttribution: droplet commentedno hook_update in D8
Comment #3
dawehnerOh can you enlighten me, why not?
One day there needs to be an update fro d7 to d8 and then you need it.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedFor Views, we actually need 65 -- we use a 32 byte + a - + a 32 byte which can lead to a 65 character delta.
Comment #5
droplet CreditAttribution: droplet commented@dereine,
It's not no hook_update function. Just no hook_update_N during development. I can't point you to a relative issue but someone had told me about it when I created a patch with hook_update. I think the upgrade path will be add into system module at some point of time.
Hope someone could give us more info and double confirm about it.
Comment #6
marcingy CreditAttribution: marcingy commentedUpdate hooks are most definently added during the development process. Sometime they move get dependencies added etc. At the moment there is no way to test the upgrade path though.
Comment #7
dawehnerLet's interpret the last comment as needs review.
Comment #8
brianV CreditAttribution: brianV commentedPatch updated to change the delta in block, block_rules, and block_language to 65 characters to accommodate the views block deltas.
I would suggest this gets committed, and update View's delta hashing to work with the 65 character delta in a followup issue.
Comment #10
asaal CreditAttribution: asaal commentedComment #11
asaal CreditAttribution: asaal commentedFixed patch and add 65 character length instead of 64 how described in comment #4
Needs review.
Comment #12
Hanspolo CreditAttribution: Hanspolo commentedIs it correct that block_node_type's delta has a length of 64?
Comment #13
asaal CreditAttribution: asaal commentedOops. Wrong character length in node "block_node_type" patch! Sorry.
Comment #14
asaal CreditAttribution: asaal commentedWrong file mode found .... ;(
Comment #15
Hanspolo CreditAttribution: Hanspolo commentedThe patch works and the database tables are correctly updated.
Comment #16
tim.plunkettThis will conflict with #1535868: Convert all blocks into plugins, and it also does not adjust the Views handling of 32 character block deltas.
Comment #17
brianV CreditAttribution: brianV commentedW.r.t the views handling, it doesn't break it. I think updating views is something that can be done in a follow-up issue.
Comment #18
mgifford@tim.plunkett This issue seems to have stalled for over a year.
I want to make sure this doesn't get forgotten.
The patch here seems pretty reasonable. Should it be marked postponed based on #1535868: Convert all blocks into plugins?
Just ran into this problem on D7 & was hoping it would be something on it's way to be backported...
Comment #19
tim.plunkettNo, that issue was committed in Janurary 2013, this is still needs work (not postponed).
Comment #20
mgifford14: block-extend_the_size_of_block_delta_to_65-8.patch queued for re-testing.
Comment #22
mgiffordThis applies fine in git, but ya "Cannot redeclare block_update_8005()" at the very least it needs an update to see that the functions aren't duplicated.
@tim.plunkett did you have other concerns from #16?
Comment #23
tim.plunkettOh. None of those database tables exist anymore...
So either close it or backport it, I guess.
Comment #24
mgiffordThis is no longer relevant for D8, so safe to try to bring into D7.
Comment #25
mgiffordBasically a re-roll.. I haven't tested it locally to see if it works yet.
Comment #27
alex.skrypnyk25: block-extend_the_size_of_block_delta_to_65-24.patch queued for re-testing.
Comment #29
mgiffordRan into Cannot redeclare node_update_7014() had to auto increment.
Comment #31
danquah CreditAttribution: danquah commentedI have encountered the same problem on a site that auto-generates some blocks and uses machine-names that can get up towards 64 chars.
I have updated the patch for D7 with the following:
The patch applies cleanly on a 7.x and as far as I have testet that both the hook_schema and hook_install works.
The big question now is how big a overhead it will be to drop and recreate the indexes and whether it is a good idea to force this on every drupal site out there "just" to get the delta to 65 chars?
Comment #32
mgiffordThe decisions look good.. Thanks for pushing ahead on this patch.
Applied nicely here http://s4a5ed0421a6bbf8.s3.simplytest.me/
We could do it on new installs only...
Not sure that forcing all 1 million Drupal sites to re-index is worth it.
Interesting challenge though.
Comment #33
Anonymous (not verified) CreditAttribution: Anonymous commentedRe-rolled against latest. 7.34 introduced a change to block.install.
Comment #34
dawehnerI think we should document why we use 65 chars though, it looks like a bug, if you don't know about it.
Comment #35
mgiffordBeen a while since @asaal touched this patch, so unasigning him.
Comment #36
dawehnerCompeting issue: #2182201: block_schema(): Change block.delta from varchar(32) to varchar(64)
Comment #37
dawehnerThere is a small mismatch here, to be honest. On the other hand I also don't get why we need 65 chars in the first place.
Comment #38
danquah CreditAttribution: danquah commentedI think we should just go with 64:
First off, it does seem that views is handling the limitation currently: http://cgit.drupalcode.org/views/tree/views.module#n663
Secondly the actual value we would need in order to support non-hashed view deltas is 193:
The keys being hashed above are generated here http://cgit.drupalcode.org/views/tree/plugins/views_plugin_display_block... and as mentioned in #4 the code does indeed concatenate two strings with a "-" so the size we need is [length of view->name] + 1 + [length of display->id]
But looking into the schema-definition for the tables that are storing the view names and display id's they seems that their lengths are 128 and 64 chars respectively
Views display:
http://cgit.drupalcode.org/views/tree/views.install#n179
Views view (initial schema hook and subsequent update)
http://cgit.drupalcode.org/views/tree/views.install#n89
http://cgit.drupalcode.org/views/tree/views.install#n615
(Name got bumped to 128 in https://www.drupal.org/node/1395430)
So, if we wanted to support non-md5 block names for views we would have to go to 128+64+1 = 193 char (or probably just all the way to 256 to avoid wird values).
Personally I thing we should just go with 64, updated patch attached for the sake of completeness.
Comment #39
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedYeah, 65 is kind of random - 64 makes more sense.
Don't we also need to drop and recreate the unique key on the 'block' table (since it contains 'delta' too?).
And what about the 'block_node_type' table provided by the node module - don't we need to update that one too?
Comment #40
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedAdding a related issue which I closed as a duplicate of this one.