Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
database update system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Aug 2015 at 07:51 UTC
Updated:
12 Sep 2015 at 05:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
stefan.r commentedComment #3
jhedstromI'll dig into this.
Comment #4
jhedstromThis still uses the gzipped version, with the same fixes from Gabor. The unzipped version is 5M. I could go either way on leaving them zipped or not.
The failures look like legitimate schema mismatches. The first exception is in regards to adding an index that already exists (perhaps automated entity schema update related).
The 2nd exception is something I have no idea about (but did previously see it in an H2H issue where it wasn't resolved).
Comment #6
jhedstromThe fatals on the last test run were because there are many more classes extending
UpdatePathTestBase.I've dug into the index exception that is thrown in
UpdatePathTestBaseFilledTestand it is because thetaxonomy_term_field_datatable has a stored schema that doesn't actually match what is in the database. Specifically, an index on thecontent_translation_uidfield. I haven't been able to track down the issue that added this index yet.Comment #7
jhedstromThis should fix the fatals.
Comment #8
jhedstromThat last patch missed some key logic where filled tests were only setting the base dump file, so the parent class needs to be called too.
Comment #11
jhedstromStill missing a few.
Comment #12
jhedstromThis should allow the test run to complete without fatal errors.
I opened #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated for the taxonomy index issue in #6.
Comment #14
stefan.r commentedRework looks nice! Now it's just fixing those tests :)
+++ b/core/modules/system/src/Tests/Update/UpdatePathWithBrokenRoutingFilledTest.php $this->databaseDumpFiles[0] = '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';Missing __DIR__
Comment #15
jhedstromIn local testing, the patch in #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated resolves nearly all of the exceptions in #12. The exception mentioned in #4 is still baffling, and I don't know why it doesn't happen on *all* of the tests using the filled db, only on some.
Comment #16
stefan.r commentedLet's try a combined patch of this + 2555259 + 2555275 + 2555665 + #14 just to see remaining test failures
Comment #18
stefan.r commentedSo 3 failures left:
SQLSTATE[HY000]: General error: failed to instantiate user-supplied statement class:in UpdatePathTestBaseFilledTestComment #19
stefan.r commentedThe first failure is caused by the update_order_test test module -- with that enabled the update hooks fail with:
Which we seem not to be having test coverage for.. I don't think we want the word "Failed" to show up on the update.php results page
For debugging the PDO failure locally (assuming it's reproducible) it may be worth putting a breakpoint in the database error handler that looks for this exact error message to see what is happening there...
Comment #20
stefan.r commentedThis is blocking some critical issues and per catch in #2554151: Test content/configuration in update database dump this should probably be a critical as well.
Comment #21
catchYep.
Comment #22
catchComment #24
jhedstromI'm going to try to diagnose the pdo exception.
Comment #26
jhedstromThe exception is only thrown from
UpdatePathTestBase::testUpdateHookN()(when using the filled database). The actual exception is thrown fromDatabaseBackend::ensureBinExists()whenSchema::tableExists()is called.Attached is a backtrace of the exception (it appears to be fast chained backend related, and I haven't tested w/o APC enabled).
Also here is a reroll of #16 since #2555259: Add config schema for image_convert image effect and #2555275: Fix missing schema for URI widget were fixed. It contains the patch from #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated still.
Comment #27
jhedstromHere's a txt version of the backtrace since the HTML one is a bit hard to read.
Comment #29
stefan.r commented@jhedstrom is currently looking at this -- likely 2 of the 3 remaining test failures are because of something being wrong in the teardown as it's always the second test method on the class that fails. Haven't pinpointed what goes wrong exactly as file directory, database tables, statics, are all gone.
Comment #30
berdirHave to give up for tonight.
Here's what I found so far:
* The problem is that we execute queries on a destroyed DB connection.
* destroyed means that destroy() was called and the statement class was reset
* Somehow, that old connection is still injected *somewhere* and the second test method then tries to use the same database connection
* You can confirm this by commenting out the setAttribute() in Connection and/or a debug(spl_object_hash($this->connection)); in DatabaseBackend::createTable(). The hash is the same for both runs.
* Commenting out that line makes the test path but obviously that is not the solution.
I haven't been able to figure out why that connection is still used and what service/object is carried over. Spent a lot of time debugging setUP()/building containers and we seem to initialize with a clean empty container.
Edit: The primary difference seems to be language.module/language outbound processing. As you can see in the backtrac,e it's the language url negotation that is loading config which then results in that exception.
Comment #31
catchIt'd be good to split out only the syntax error fix for the dump into a new issue so we can commit that asap - would make it easier to review patches here.
Comment #32
jhedstromI added #2558063: Fix syntax error in filled database dump and will post the updated db there shortly.
Comment #33
jhedstromThis approach disables language negotiation during the
runUpdates()method. If we go this way, we should probably add a follow-up to pursue the issue detailed in #30.Comment #34
jhedstromNote, the patch above still contains the fix from #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated, but I'm not sure what this is since the other issues mentioned in #16 have been committed.
Comment #36
fabianx commentedThe problem is here:
Resolution is to move that into the setUp() routine. Then it should work fine.
Comment #37
jhedstromI'll try to fix the remaining 2 fails. Thanks Fabianx for tracking that down!
Comment #38
jhedstromThe fail in
SqlContentEntityStorageSchemaIndexFilledTestis due to a subtle change to entity schemas that was introduced in #2498919: Node::isPublished() and Node::getOwnerId() are expensive. I already added an update hook for the change to head2head in #2550489: Upgrade path for 2498919, so I guess the easy fix there is to pull that into core?Still looking into the fail in
UpdatePathWithBrokenRoutingFilledTest, which seems to be different.Comment #39
jhedstromThis contains the fix found by Fabianx, and I added an assertion to runUpdates to make sure there are no failed updates.
Comment #40
catch@jhedstrom isn't there already a fix for #2498919: Node::isPublished() and Node::getOwnerId() are expensive in #2542748: Automatic entity updates can fail when there is existing content, leaving the site's schema in an unpredictable state?
Comment #41
jhedstrom@catch oh, you're right! That's great.
The remaining fail in
UpdatePathWithBrokenRoutingFilledTestis due to an assumption that the front page is accessible before running updates. FromUpdatePathWithBrokenRoutingTest::testWithBrokenRouting():the filled DB fails with this exception on the front page (before updates are run)
InvalidArgumentException: You must provide the context IDs in the @{service_id}:{unqualified_context_id} format. in Drupal\Core\Plugin\Context\LazyContextRepository->getRuntimeContexts() (line 76 of core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php).Comment #42
catchI think we can just ditch that line - the 500 assertion and the one after the updates have run are the important ones.
Given #40 I think we should not postpone #2542748: Automatic entity updates can fail when there is existing content, leaving the site's schema in an unpredictable state on this issue - will post to same effect there.
Comment #43
jhedstromThis removes the test of the homepage before running updates.
Comment #47
stefan.r commentedThis looks ready to me, just need to remove that URI bit and wait until #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated gets in.
Comment #48
gábor hojtsyPostponed on #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated.
Comment #49
stefan.r commentedJust taking out the 2 bits mentioned in #47 here so this should be green once #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated goes in.
Comment #50
gábor hojtsy#2555275: Fix missing schema for URI widget already resolved the URI schema. #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated is about to resolve the existing index problem. Rolling those two out of the patch.
Comment #51
gábor hojtsy@stefan.r: crossposted the same thing, sorry :D
Comment #52
stefan.r commentedComment #53
catchJust putting back to CNR so the tests can run.
Comment #54
stefan.r commentedThey will fail for now as #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated has not been committed yet :)
Comment #55
catchYes, but it'd be nice to see that that's the only fail, and that it's the same after #2542748: Automatic entity updates can fail when there is existing content, leaving the site's schema in an unpredictable state.
Comment #57
stefan.r commented#43 was green on a re-test after #2542748: Automatic entity updates can fail when there is existing content, leaving the site's schema in an unpredictable state had gone in so I think we're good
Comment #58
wim leers#57: Does that mean we should simply reupload #43?
Comment #59
gábor hojtsy@Wim Leers: no, the fix included in #43 for #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated is debated in that issue (its not the right fix, it only fixes for the extent of our tests), so trying to get that shoehorned in here would not work overall. :/ Since we have that issue for that part of the problem with attention from the right folks, it looks sane to try and resolve it there (even though there is no tests there yet, but the tests here apparently do not cover the whole spectrum of the situation either, hence the debate).
Comment #60
xjmDiscussed with @webchick, @catch, @alexpott, and @effulgentsia. This issue is critical because we cannot have confidence in our upgrade path for a release candidate if we are not testing it properly.
Also re-postponing on #2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated.
Comment #61
gábor hojtsy#2555665: When index is added for content_translation_uid, the corresponding stored schema definition is not updated landed, so unblocked now.
Comment #62
gábor hojtsyReuploading #49 so testbots have a chance to retest it in the new setup :)
Comment #64
gábor hojtsyALL of the fails seem to be missing config schema for some new D6 migrations. Haha. Do we want to track that as yet another critical for issue management? :)
Comment #65
gábor hojtsyIt is 90 instances of “migrate.migration.*:load failed with: missing schema" repeated all over and over. Discussing with @mikeryan.
Comment #66
mikeryanGabor alerted me to this, opened up an issue to fix the migration tests: #2559355: Migration tests reference defunct load plugins.
Comment #67
gábor hojtsySo migrate removed the load key from migrations since the dump was made. Migrate needs an update function for removing the load key from migrations in config.
Comment #68
mikeryanIssue for the migration update path at #2559381: Migrate needs core update path.
Comment #69
mikeryanHaving trouble with this locally, want to see how testbot handles the migrate update with this patch...
Comment #71
webchickThis may be a silly question, but why are we testing Migrate at all in the dump file, given core does not support it yet?
Comment #72
jhedstromThis contains the updated fix from #2559381: Migrate needs core update path. Uploading here to make sure it resolves the issue.
Comment #73
jhedstromMy understanding is that the filled tests represent something that could possibly be done (enable *every* module), so since core ships with migrate, it can be enabled, and might need update before it is officially supported.
Comment #74
webchickOk, that's probably fine for now as long as it's not holding anything up here for too long, but over in #2313651: [policy, no patch] Clarify policy on the inclusion of Migrate in Core for 8.0.0 we are discussing marking Migrate as "Experimental" and if that happens I think we maybe change the rule "Turn on all modules except the experimental ones."
Comment #75
catchI think it would be fine to not turn migrate on in the filled database dump too. Although we might still want tests and test coverage for migrate upgrade paths in core so it's a bit of a trade-off - that could be a major to add them back though at the moment.
Comment #76
jhedstromRe-uploading the patch from #62.
Comment #77
dawehnerFor a short moment I thought about something like
$this->baseDatabaseDumpor so, which would make it a bit easier to override,but meh, this would be out of scope here, I think.
Comment #79
webchickI braved a peek at this patch and surprisingly everything here looks straight-forward!
The one thing that stood out was this:
...but that's covered in #41/#42 above (the assertion is out of date since changing the way update.php runs in another patch). Therefore, let's get 'er done! :D
Committed and pushed to 8.0.x. Thanks!
(If I over-stepped my bounds here, feel free to revert, but this seemed like a pretty easy/important one.)