New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL >= 5.7.5 breaks Piwik <= 2.15.0 #9131
Comments
Thx for the report! |
We need to add Mysql 5.7 support in our Long Term Support release, added to 2.15.1: #6642 |
Presumably, the generated label is usable for debugging, especially in those edge cases where a lock blocks for a long time, then the server goes away, and some dba needs to clean it up. (At least, it might work on innodb tables.) My md5() workaround clobbers the utility of such code. That code is here:
The problem is this: the code is completely MySQL-specific. Acquiring a "named" table lock is MySQL specific, (as is the need for table locks, in general), so to abstract from the db-engine, you'd need to push the name-generation down a level, into the Db-handler code itself. I'm not here today to preach the glorious benefits of using postgresql over mysql, so let's assume it will remain mysql-specific for the near future. So while we're still talking MySQL-specific code, and since it's MySQL that forces us now to restrict this call to 64 characters, let's shorten it in a reasonable but mysql-specific way. Let me suggest: (1) use hex-encoded archiveID, (2) abbreviate the module prefix name. The archiveID for that table type (see
Is this enough to expedite progress, or should I generate an actual patch? |
My PHP isn't that great, but maybe instead of relying on sprintf's precision, it makes more sense to do something like:
in order to make sure the lock identifies the most distinctive part of the table name. |
Marked as duplicate of #6642 - edit: keeping this one open as well as it is more clear |
@tsteur thank you for addressing this. Your patch does appear to solve the problem very thoroughly. I don't want to sound presumptuous in addressing the following point on coding style: The fix in |
and also see #9395 |
tyvm |
A friendly write-up is here.
From the MySQL Documentation:
The typical string generated by Piwik for this purposes is 65 characters in length. It typically looks like this:
The
get_lock()
function is invoked from two functions withincore/db.php
. The two functions aregetDbLock
andreleaseDbLock
. For purposes of expediency on our systems, I wrapped the string used by these functions into a call tomd5()
, guaranteeing 32 characters at most, and almost ensuring uniqueness. I hope the devs come up with something better.These two functions are in turn invoked via
acquireArchiveTableLock
andreleaseArchiveTableLock
, both inDataAccess/Model.php
.The text was updated successfully, but these errors were encountered: