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.
My guess is this is not supposed to happen:
WD php: Duplicate entry 'server_localhost' for key 2
query: INSERT INTO hosting_context (nid, name) VALUES (2, 'server_localhost') in /var/hostmaster/hostmaster-0.4-alpha8+services/profiles/hostmaster/modules/hosting/hosting.module on line 777.
I see this in the hostmaster-migrate, more precisely during the deploy, which happens during provision-migrate of the frontend.
There's code in that function to check for already existing entries, so this shouldn't happen:
function hosting_context_register($nid, $name) {
// Check first to see if this nid exists in the system. If so, update its name
$result = db_query("SELECT nid FROM {hosting_context} WHERE nid=%d", $nid);
if ($obj = db_fetch_object($result)) {
db_query("UPDATE {hosting_context} SET name = '%s' WHERE nid = %d", $name, $nid);
}
else {
// It's a new item
db_query("INSERT INTO {hosting_context} (nid, name) VALUES (%d, '%s')", $nid, $name);
}
}
.. unfortunately, there's a unique key on the name column (?!) which makes this fail.
Comments
Comment #1
anarcat CreditAttribution: anarcat commentedI suspect the problem is related to the fact that i'm trying to upgrade a system that has everything local: mysql and apache are on the same server.
Comment #2
adrian CreditAttribution: adrian commentednames are meant to be unique.
the one db_server NODE should have been summarily deleted, and it's service merged into the web server node.
Comment #3
anarcat CreditAttribution: anarcat commentedi fixed this by avoiding setting the service twice. Instead of two broken assumptions, we now only have one... If we need to fix the localhost server, we need to do it in just one place.
This may break upgrades for multiserver setups.
Comment #4
adrian CreditAttribution: adrian commentedwe no longer rename the title of the server that way, it is now defaulted to 'php_uname("n")'.
this is only the primary web server mind you. We also set the context name of the server to '@server_master' now, so this wont be able to happen anymore.