Last modified: 2014-01-31 21:24:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39921, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37921 - Can't install FlaggedRevs extension with SQLite
Can't install FlaggedRevs extension with SQLite
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
FlaggedRevs (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Aaron Schulz
: schema-change
Depends on:
Blocks: sqlite
  Show dependency treegraph
 
Reported: 2012-06-25 00:20 UTC by Dereckson
Modified: 2014-01-31 21:24 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Removing this fixes the problem. (6.17 KB, patch)
2012-07-29 18:19 UTC, Brandon Sky
Details

Description Dereckson 2012-06-25 00:20:07 UTC
Creating flaggedrevs table...A database query syntax error has occurred.

The last attempted database query was:
"CREATE INDEX page_time ON flaggedrevs (fr_page_id,fr_rev_timestamp)
"
from within function "DatabaseBase::sourceFile( /var/wwwroot/dereckson.be/mediawiki/extensions/FlaggedRevs/backend/schema/mysql/FlaggedRevs.sql )".
Database returned error "1: index page_time already exists"


See also https://bugzilla.wikimedia.org/show_bug.cgi?id=31696
Comment 1 Aaron Schulz 2012-06-25 00:42:06 UTC
I think sqlite sees the page_time index on the logging table and barfs...

Many of our indexes due no have prefixes, as MySQL doesn't have this problem (INDEX name uniqueness is sensibly done per-table rather than per-db). Why are you installing FlaggedRevs with sqlite?  I suppose you could prefix the indexes with "fr_", though if code eventually has a FORCE statement it may explode...

I'm not sure if this is worth renaming the INDEXes over (unless it's done in a huge batch with all the core tables too).
Comment 2 Aaron Schulz 2012-06-25 00:42:50 UTC
* Many of our indexes do not have prefixes
Comment 3 Dereckson 2012-06-25 09:02:40 UTC
[ Why are you installing FlaggedRevs with sqlite? ]

Short answer. To ensure compliance of our extensions with SQLite.

Normal answer. I've no scenario where I need a SQLite working wiki installation with FlaggedRevs. My plan were each time I've to work on an extension, I would try it on my test SQLite wiki, so I can also improve compatibility with this SQL engine.

[ Indexes issue ]

The core tables indexes and +- 60 extensions already work fine on SQLite. In thix context, I think it would be interesting to improve this compatibility extension by extension.

What would be the drawbacks to rename indexes? They are used only internally by database aren't they?
Comment 4 Aaron Schulz 2012-06-26 01:38:38 UTC
(In reply to comment #3)
> [ Why are you installing FlaggedRevs with sqlite? ]
> 
> Short answer. To ensure compliance of our extensions with SQLite.
> 
> Normal answer. I've no scenario where I need a SQLite working wiki installation
> with FlaggedRevs. My plan were each time I've to work on an extension, I would
> try it on my test SQLite wiki, so I can also improve compatibility with this
> SQL engine.
> 
> [ Indexes issue ]
> 
> The core tables indexes and +- 60 extensions already work fine on SQLite. In
> thix context, I think it would be interesting to improve this compatibility
> extension by extension.
> 
> What would be the drawbacks to rename indexes? They are used only internally by
> database aren't they?

If you renamed them, then FORCE INDEX code in extensions will break on existing installs. On WMF, this is slightly tedious, since these tables have millions of rows. Though it's no where near as tedious as it was before percona OSC.
Comment 5 Max Semenik 2012-06-26 18:14:13 UTC
I support creating a separate SQL file for SQLite. More tedious, but saves us the pointless live schema change at WMF.
Comment 6 Aaron Schulz 2012-06-27 00:54:40 UTC
(In reply to comment #5)
> I support creating a separate SQL file for SQLite. More tedious, but saves us
> the pointless live schema change at WMF.

You can overload the indexName() function for the sqlite one to map regular index names to prefixed ones so that FORCEs always work.
Comment 7 Dereckson 2012-06-27 08:44:08 UTC
No, this is not a good solution:

(1) this is not coherent - most other extensions and most other indexes in your extension have already a prefix ;

(2) nothing would give us the warranty some extension doesn't use <the prefix the method would choose><the index>.
Comment 8 Aaron Schulz 2012-06-27 08:51:03 UTC
CC' Asher. I'm ok with prefixing the flaggedrevs and flaggedrevs_tracking indexes if he doesn't mind running the change in the background.
Comment 9 Aaron Schulz 2012-07-20 02:35:42 UTC
(In reply to comment #7)
> No, this is not a good solution:
> 
> (1) this is not coherent - most other extensions and most other indexes in your
> extension have already a prefix ;
> 
> (2) nothing would give us the warranty some extension doesn't use <the prefix
> the method would choose><the index>.

Can you make a gerrit patch and cc asher?
Comment 10 Dereckson 2012-07-20 10:41:57 UTC
Yes, of course.

My two first July weeks were a little busy, but now I've some time to prepare that as soon as I will have emptied my MediaWiki/Wikimedia backlog.

Estimate delivery time: Wed July 25th.
Comment 11 Brandon Sky 2012-07-29 18:19:31 UTC
Created attachment 10901 [details]
Removing this fixes the problem.

Removing this line of code fixes the problem.
Comment 12 Aaron Schulz 2012-09-10 04:25:26 UTC
(In reply to comment #10)
> Yes, of course.
> 
> My two first July weeks were a little busy, but now I've some time to prepare
> that as soon as I will have emptied my MediaWiki/Wikimedia backlog.
> 
> Estimate delivery time: Wed July 25th.

Any progress on this?
Comment 13 Alex Monk 2012-10-17 00:21:48 UTC
Dereckson?
Comment 14 Andre Klapper 2012-12-12 15:12:32 UTC
Dereckson: Are you working on this, or shall this bug be reassigned to default assignee again?
Comment 15 Dereckson 2012-12-18 00:21:12 UTC
Comment on attachment 10901 [details]
Removing this fixes the problem.

Patch solution isn't acceptable: indexes are there for performance reason.

Generally speaking, remove/comment lines generating errors or warnings to "make stuff works" could have dramatic consequence.

For example, a Debian maintainer commented a line in OpenSSH which generated a compilation warning. That'd lead to a major security hole on every Debian servers:

http://www.debian.org/security/key-rollover/
Comment 16 Dereckson 2012-12-18 01:09:11 UTC
Sorry for the delay.

I'm planning to facilitate bug like this resolution to add in core (class DatabaseUpdater) some methods to drop or rename an index: Gerrit change #39169.
Comment 17 Dereckson 2012-12-24 04:33:25 UTC
Here we are.

Gerrit change #40297.
Comment 18 Andre Klapper 2013-02-11 14:58:12 UTC
Patch needs rework according to Gerrit...
Comment 19 Daniel Friesen 2013-10-02 00:41:11 UTC
(In reply to comment #4)
> If you renamed them, then FORCE INDEX code in extensions will break on
> existing
> installs. On WMF, this is slightly tedious, since these tables have millions
> of
> rows. Though it's no where near as tedious as it was before percona OSC.

Another idea I can think of is to rename everything to properly prefixed versions. Then introduce a hook into the FORCE INDEX stuff. That way environments that don't want to rename tables can use the hook to rewrite index names to their old names that are in use.
Comment 20 Gerrit Notification Bot 2014-01-30 20:44:00 UTC
Change 110451 had a related patch set uploaded by Aaron Schulz:
Added missing prefix to some indexes

https://gerrit.wikimedia.org/r/110451
Comment 21 Gerrit Notification Bot 2014-01-30 22:51:33 UTC
Change 110451 merged by Chad:
Added missing prefix to some indexes

https://gerrit.wikimedia.org/r/110451

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links