Closed (fixed)
Project:
Domain
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Jan 2019 at 09:32 UTC
Updated:
20 Feb 2019 at 15:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
siva01 commentedComment #3
agentrickardComment #4
agentrickardSo you are doing a full site reinstall and then importing from config? That sounds like a duplicate config issue.
Check that you don't have duplicate items in the config (and that you are importing config from the correct directory.)
For re-install, you might also need to use the 'config_installer' profile. (https://www.drupal.org/project/config_installer/)
The D8 version doesn't auto-install a default domain anymore, so I don't think it's a module issue.
Comment #5
agentrickardNote also that a re-install is not an update, so the description of this issue is not correct.
Comment #6
siva01 commentedI found, where is is problem. For previous version is domain_id: 321980512. Site install script run drush cim three times. After first cim is domain changed domain_id: 3172555. If I run cim again, it will return update error.
We run update too, but just only on stage/production. So we need both version functional.
Comment #7
agentrickardWhich alpha versions are you upgrading from and to?
We had to change the logic for generated IDs a long time ago (Oct 2017), and there isn't much to do except (possibly) editing your config files and re-importing.
See Drupal\domain\Entity::createDomainId() for the logic. See also #2908236: Domain ID may vary between 32-bit and 64-bit versions of PHP
However, you'll then have to update the node access table, which uses this data.
Essentially, you'll need a custom update function for dealing with this problem, because alpha-to-alpha updates aren't supported.
Comment #8
siva01 commentedWe try update from 1.0.0-alpha9.
Comment #9
siva01 commentedWhat does mean "node access table". In table node_access isn't any domain related column/value. We have table node__field_domain_access, where is column field_domain_access_target_id, but it doesn't use domain_id, but domain machine name.
Comment #10
agentrickardYeah, that's going to catch the ID change. This code should work in an update hook:
I would do the following (while being able to restore from backup if this fails):
* Update the module
* Run database updates
* Export config
* In the UI, you will be prompted to rebuild node access. That process can take a while, and I don't know if it can be done via drush.
That should update the config so that it is created properly on a re-install.
Comment #11
agentrickardThinking through this issue, this patch might also fix it, though you would still be susceptible to the 32-bit / 64-bit issue.
Comment #12
siva01 commentedCode doesn't work. $domain->saveProperty('domain_id', $new_id); call presave() function, where is validation,if domain exist. And it exist. So if I run this script, I get same error described above.
Comment #13
siva01 commentedI try patch and seem it work, but there is missing bracket.
PS: patch was apply on outdated version, so there are unrelated changes. I can't delete it.
Comment #14
siva01 commentedAdding only missing bracket.
Comment #15
agentrickardThanks for the test. I think we should add that code with a note about why it's there -- essentially, to prevent updating a domain id from a config file.
Comment #16
mkolar commentedThanks @agentrickard this helped
Comment #18
agentrickardComment #19
michal.sec commentedHi @agentrickard,
is possible to release new version with this fix?
Thanks
Comment #20
agentrickardYes. I was trying to wait for https://www.drupal.org/project/domain/issues/3004243, but that's delayed.
It would be nice to get a review of #3025541: configFactory service invoking hooks early as well.