In testing out the new D6 DB dump migration script (migrate-dump-d6.sh), I did the following: I created the D6 site as outlined in the instructions then made a single change - I added a "page specific visibility setting" to the "Powered by Drupal" block (admin/build/block/configure/system/0). I then ran the migrate-dump-d6.sh script and expected to see only the Blocks.php and d6.gz files modified.

Instead, the following files were modified:

        modified:   core/modules/migrate_drupal/src/Tests/Table/Blocks.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/Filters.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/History.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/Permission.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/System.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/TermHierarchy.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/Users.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/UsersRoles.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/Variable.php
        modified:   core/modules/migrate_drupal/src/Tests/Table/VocabularyNodeTypes.php
        modified:   core/modules/migrate_drupal/src/Tests/d6.gz

Looking at the diffs (attached, except the d6.gz diff), it seems like there were a bunch of additions. Is this correct?

Thanks,
-mike

Comments

ultimike’s picture

StatusFileSize
new2.71 KB

Some additional testing...

I just dropped the D6 DB, reimported and then immediately ran the migrate-dump-d6.sh script. There were still changes, but as far as I can tell, they are just rearrangements of the table exports. I've attached the diff.

-mike

ultimike’s picture

Next, I made the same "page specific visibility setting" change I made in the original issue above, and this changed two additional table dump files: the blocks.php file (which is the one I expected to be modified) and the variables.php file. The latter was the addition of two default values related to the "Powered by Drupal" block.

So, other than rearrangements, I think it is working. Should I include the rearranged tables as part of any patches moving forward? Seems like that could be a lot of whack-a-mole.

-mike

ultimike’s picture

StatusFileSize
new381.79 KB

After chatting with Benjy about this, I went ahead and added "order by" clauses on three tables to help stem the issues of rearranging. Patch attached.

I'm now wondering if this is going to start happening with other tables and if we should just use an "order by" on all tables?

-mike

benjy’s picture

We need to update migrate-dump-d6.sh to add an order by primary key to the exported data. I think we should be able to calculate the primary keys automatically from the schema data we already have.

After we've committed the updated table files everyone will have the same results while exporting the Table's in the future.

benjy’s picture

Title: Migrate tests - D6 dump file generation issues(?) » Migrate Dump export needs to have a consistent order
quietone’s picture

Assigned: Unassigned » quietone

I've been working on this, enjoying it too, and am about half way done. I hope it is OK that I've assigned it to myself.

benjy’s picture

@quietone, what's your approach? I was hoping to calculate the primary keys automatically based on the available schema data?

quietone’s picture

StatusFileSize
new1.06 KB

@benjy, I was working off your suggestion in #4 and used this to get the primary keys.

 $query = "SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS`
  WHERE (`TABLE_SCHEMA` = 'd6_migrate') AND (`TABLE_NAME` = '{$table}') AND (`COLUMN_KEY` = 'PRI')
  ORDER BY COLUMN_NAME";
benjy’s picture

That seams reasonable, the only thing I did think was that the data may already exist in $row ?:

  while(($row = $query->fetchAssoc()) !== FALSE) {
    $field_name = $row['Field'];
quietone’s picture

Yes, but I don't see how that helps. Using 'key' from a row as you suggest would mean that the code would have to do extra sorting. Why not let the db do that? Or, I'm just plain missing something?

Note that my patch only changes the $values output, which is where the differences are in d6_dump_no_changes.diff. I presume $fields should be as well?

benjy’s picture

Took another look, I see what you mean. Yes, I like this approach.

Did we have a patch with the newly generated dumps? Hopefully it's not too much of a radical change.

quietone’s picture

Status: Active » Needs review
StatusFileSize
new470.02 KB

Yes, here it is. 12 dump files changed.

I'm getting AJAX errors when trying to run the tests, so I'll see what the testbot finds while I investigate.

Status: Needs review » Needs work

The last submitted patch, 12: 2416111-12.patch, failed testing.

Status: Needs work » Needs review

benjy queued 12: 2416111-12.patch for re-testing.

The last submitted patch, 3: 2416111-3.patch, failed testing.

The last submitted patch, 1: d6_dump_no_changes.diff, failed testing.

The last submitted patch, 8: migrate-dump-d6.sh-7.patch, failed testing.

The last submitted patch, d6_dump.diff, failed testing.

Status: Needs review » Needs work

The last submitted patch, 12: 2416111-12.patch, failed testing.

quietone’s picture

Right, increased the PHP memory limit and tests pass locally. Is the testbot sick today?

Honestly, suggestions?

benjy’s picture

Yes, I think testbot is just having issues.

quietone’s picture

Status: Needs work » Needs review

test again

quietone queued 12: 2416111-12.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 12: 2416111-12.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new471.67 KB

Try again

Status: Needs review » Needs work

The last submitted patch, 25: 2416111-25.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new429.16 KB
new429.16 KB

And again

quietone’s picture

ultimike’s picture

@quietone - I just tried downloading and applying the patch and I couldn't - but only because of the binary d6.gz file embedded in the patch.

Would you mind re-rolling using git diff --full-index --binary > 2416111-x.patch?

Regardless, I think the patch looks good, but I think core committers will have a hard time applying it as-is.

Looking forward to this patch getting in, as it will save all of us some time when we have to add new tests!

Thanks,
-mike

quietone’s picture

StatusFileSize
new429.68 KB

Sure. Here it is.

chx’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new521.87 KB

Sorry that's still not a binary dump :/ but this is :) Otherwise no change.

To roll this, you need core/modules/migrate_drupal/src/Tests/.gitattributes to contain *.gz -diff.

quietone’s picture

@chx, thanks. As they say, you learn something new every day. But I think you meant *.gz -binary?

ultimike’s picture

It should look like

d6.gz -text -diff

@quietone - is your local D8 at HEAD? This has already been committed, see core/modules/migrate_drupal/src/Tests/.gitattributes

-mike

quietone’s picture

Yes, I work from HEAD.

core/modules/migrate_drupal/src/Tests/.gitattributes does not exist, nor do I see one on GitHub.

Yes, *.gz -text -diff works with git diff --full-index --binary. Seems like I'm a lazy typist and was using "git diff" and thus needed different .gitattributes file to get a patch that matched chx's.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new521.19 KB

Done

chx’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs reroll

Let's try again.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Migrate is not frozen in beta. Committed e975bb1 and pushed to 8.0.x. Thanks!

  • alexpott committed e975bb1 on
    Issue #2416111 by quietone, ultimike, chx: Migrate Dump export needs to...

Status: Fixed » Closed (fixed)

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

quietone’s picture

Assigned: quietone » Unassigned