statistics module
Update #7000
Failed: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: ALTER TABLE {accesslog} CHANGE `sid` `sid` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Browser session ID of user that visited page.'; Array ( ) in db_change_field() (line 2957 of /disk2/www/drupal7/includes/database/database.inc).
In D6 the sid column is varchar(64), the update process converts to varchar(128)
line 150 of statistics.install: the exact query is:
ALTER TABLE accesslog CHANGE `sid` `sid` VARCHAR(128) NOT NULL DEFAULT '';
The problem seems to be that in D6 there is an index accesslog_path_sid, accesslog_uid_sid and kid. These need to be dropped as part of the upgrade, before the sid column is increased.
Solution: see #23
ALTER TABLE accesslog DROP INDEX accesslog_path_sid;
ALTER TABLE accesslog DROP INDEX accesslog_uid_sid;
Comments
Comment #0.0
boran commentedtypo
Comment #1
boran commentedPatch attached
Comment #2
boran commented-
Comment #3
boran commentedinitial simple test to go with the above patch.
Testing of the test has not yet been done :-)
Update: please ignore the attachment, it is wrong
Comment #4
aspilicious commentedMarking this major if its indeed an upgrade path fail.
I can't open your patch in #1 and I don't understand what the test does.
Comment #5
boran commentedAttaching the patch again.
"git diff --no-prefix statistics.install" was used to generate it, source was 7.x git dev.
Agreed, this probably affect any upgrade where the statistics module is enabled.
The test: creates a sample D6 table with a few rows, so that the upgrade procedure can be tested. It should go in modules/simpletest/tests/upgrade.
Ideally the test would fail before applying the patch, and succeed after adding the patch.
However, be patient please, this is the first test I've written. For example, I cannot get simpletest to see this new test, see http://drupal.org/node/1261260.
Update: the test attached to the comment above is wrong, update coming..
Comment #6
xjmComment #8
boran commentedSee attached: update of the fix and the test.
a) statistics.install patch:
dropped 'no-prefix' flag (created patches as instructed in http://drupal.org/node/1054616), add comment number.
b) simple test for statistics: as the attachment in comment #3 did not have the correct files.
(I still have the practical problem http://drupal.org/node/1261260, not related to this module)
Comment #9
boran commentedComment #10
aspilicious commentedYour test doesn't work as the upgrade doesn't fail
Comment #11
boran commentedI dont quite understand.
a) the code patch, looking at the test bot:
Why is it applied against 8.x and not 7.x? 8.x does not have the relevant code needs to be fixed.
I'm using 7.x of course, since Im working on upgrading 6>7.
==> changed the issue version back to 7.x. Will the bot automatically restart against 7.x?
b) The test patch: it passed the bot, but I have as noted above the problem of getting simpletest to see changes to its upgrade directory. Have you actually installed the test patch and can you see it in simple test?
Comment #12
aspilicious commentedNo time to look into this now. Will look at it in the near future, if no ones else beats me.
You can press the retest button (placed behind the patch) when changing versions.
Yeah this is a 7.x issue srry for that
Comment #13
boran commented#8: statistics-upgrade-1261056-6.patch queued for re-testing.
Comment #14
webchickFixing tag.
Comment #15
catch#8: statistics-test-1261056-6.patch queued for re-testing.
Comment #16
boran commentedWebchick: why the "needs backport"? the patch is already for D7.
Comment #17
webchickDon't ask me why it was tagged, I just know it was using the wrong one. :)
Comment #18
xjmHm I think webchick needs a coffee :)
Something else confuses me though. Shouldn't the test-only patch in #8 be failing?
Comment #19
catchYeah that ought to fail if the bug is reproducible.
Comment #20
xjmLooks like the test needs work then.
Comment #21
marcingy commentedThe test does not add the index that is causing the problem. I am actually confused where the index was even added to the table
as the d6 indexes are
and drupal 5
and 4.7
The indexes in question do not look like indexes created by core unless it is from a version that pre-dates drupal 4.7
Comment #21.0
boran commentedattach patch
Comment #22
boran commentedThe plot thickens! zut.
Having gone though several of my sites, those indices are visible on some, not on others, so, its not a core issue. It must have been added by a contrib module.
So the above patch is not the solution, I'd suggest just adding to the summary of this issue, that if there error pops up, drop the indices and retry the upgrade?
(corrected according to #23)
Comment #23
emarchak commentedThe correct syntax to #22 should be
Comment #23.0
emarchak commentedadd solution
Comment #24
vOOd commentedIve just upgraded my drupal D6 to D7 and Im facing this issue, but I dont understand how to fix it with your solution (alter table etc..).
Could someone please explain me step by step how to solve this problem. thanks
Comment #25
vOOd commentedOk I managed to execute those 2 lines with phpmyadmin and it now updates successfully.
Comment #26
xjmIf
update.phpfails with this error:update.php.Comment #27
kylebrowning commented#22 worked for me.
Comment #28
Virgil commentedThank you xjm! #26 nailed it.
Comment #29
don@robertson.net.nz commentedCheck to make sure your MySQL database is Innodb and not MyIsam - have a look at http://highervisibilitywebsites.com/convert-your-mysql-database-myisam-i...
Comment #29.0
don@robertson.net.nz commentedUpdate summary
Comment #30
AlternatiefIdee commentedI have this problem that looks like above but say it's on line 3020, is the solution then still the same ?
for me this looks not simple I never tried to work with MySQL database before.
so how do I have to do this ?
Update #7000
• Failed: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: ALTER TABLE {accesslog} CHANGE `sid` `sid` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Browser session ID of user that visited page.'; Array ( ) in db_change_field() (line 3020 of /domains/websitename/DEFAULT/includes/database/database.inc).