Problem/Motivation

The upgrade from 8.2 to 8.3 is supposed to created revision_user and revision_created fields on the block_content_field_revision table (via block_content_update_8003()). After the update however, with dynamic_entity_reference enabled, there are only _int versions of those fields:

mysql> describe block_content_field_revision;
+-------------------------------+------------------+------+-----+---------+-------+
| Field                         | Type             | Null | Key | Default | Extra |
+-------------------------------+------------------+------+-----+---------+-------+
| id                            | int(10) unsigned | NO   | MUL | NULL    |       |
| revision_id                   | int(10) unsigned | NO   | PRI | NULL    |       |
| langcode                      | varchar(12)      | NO   | PRI | NULL    |       |
| info                          | varchar(255)     | YES  |     | NULL    |       |
| changed                       | int(11)          | YES  |     | NULL    |       |
| revision_translation_affected | tinyint(4)       | YES  |     | NULL    |       |
| default_langcode              | tinyint(4)       | NO   |     | NULL    |       |
| revision_created_int          | int(10) unsigned | YES  |     | NULL    |       |
| revision_user_int             | int(10) unsigned | YES  |     | NULL    |       |
+-------------------------------+------------------+------+-----+---------+-------+

Those _int fields are most likely coming from this module, but I have no idea a) why it doesn't create the normal fields too, and b) why it's doing so for a non-entity-reference field (the revision_created field).

There's this possibly related core issue too: #2865702: Revert schema version when update process failed..

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#6 2895963-06.patch938 bytesjhedstrom
#5 2895963-05.patch938 bytesjhedstrom
#4 2895963-04.patch907 bytesjhedstrom

Comments

jhedstrom created an issue. See original summary.

jhedstrom’s picture

Issue summary: View changes

Oddly, this update hook was in 8.2, so now I'm not sure why/when this issue occurred. Will update as I find things.

jhedstrom’s picture

The renaming of these fields from revision_user to revision_user_int (and the created one too) occurs during system_update_8400(), which attempts to 'Move revision metadata fields to the revision table'.

jhedstrom’s picture

Title: Possible bug with upgrading from 8.2 to 8.3 and block_content » The _int handling is applied to all revision fields during system_update_8400()
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new907 bytes

Okay, I've tracked the issue down. The logic in FieldStorageSubscriber::handleEntityType() is currently thinking that revision_user and revision_created are DER fields when triggered by the code in system_update_8400(). This causes revision_user_int and revision_created_int and the corresponding triggers to be added to revision tables that then subsequently have revision_user and revision_created removed.

This leads to a now-invalid trigger sitting on those tables, which leads to the errors reported over in #2865702: Revert schema version when update process failed..

I have no idea why this issue doesn't happen under normal conditions, and only appears during that update hook.

jhedstrom’s picture

StatusFileSize
new938 bytes

Oops, wrong version of the patch.

jhedstrom’s picture

StatusFileSize
new938 bytes

Gah, coding standard error.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks legit.

  • jibran committed b5e4fc2 on 8.x-2.x authored by jhedstrom
    Issue #2895963 by jhedstrom: The _int handling is applied to all...
jibran’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, for the patch. Committed to 8.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.