-
Notifications
You must be signed in to change notification settings - Fork 451
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
Limited data loss at settings tables when migrating from a version smaller than 3.3.0 #10249
Limited data loss at settings tables when migrating from a version smaller than 3.3.0 #10249
Comments
Looks like the surface of this issue isn't big. The The setting entities which remain, and barely make use of Common for all applications
OJS specific
OMP specific
OPS specific
|
The following MySQL query will generate another query that might be suitable to detect the cases where a data loss happened. Execute it, copy all the rows of the response (they will be SQL commands), remove the trailing SELECT CONCAT('SELECT ', QUOTE(TABLE_NAME), ', setting_name, setting_value, COUNT(0) FROM ', TABLE_NAME, ' WHERE ', COLUMN_NAME, ' = ', QUOTE('object'), ' GROUP BY setting_name, setting_value HAVING COUNT(0) > 1 UNION ALL ')
FROM information_schema.COLUMNS x
WHERE COLUMN_NAME = 'setting_type'
AND TABLE_NAME NOT IN (
'review_form_element_settings', 'plugin_settings',
'site_settings', 'announcement_settings', 'author_settings', 'publication_galley_settings', 'journal_settings', 'press_settings', 'server_settings', 'email_templates_settings', 'publication_settings', 'submission_settings'
)
AND EXISTS (SELECT 0 FROM information_schema.COLUMNS y WHERE y.TABLE_NAME = x.TABLE_NAME AND y.TABLE_SCHEMA = x.TABLE_SCHEMA AND y.COLUMN_NAME = 'setting_name') If you have many OJS/OPS/OMP databases on the same server, add |
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
@asmecher, check if you agree with the fixes: |
@jonasraoni, thanks, I added a couple comments on the OJS PR. |
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
…-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
…-data-loss-on-settings##
…-data-loss-on-settings##
…ix-data-loss-on-settings #10249 Added migration to recover from data loss on the pr…
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
(cherry picked from commit f09741c)
(cherry picked from commit 80670e3)
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
…0249-fix-data-loss-on-settings##
…-data-loss-on-settings##
…-data-loss-on-settings##
…-data-loss-on-settings##
…t-transaction-isolation##
…t-transaction-isolation##
(cherry picked from commit 2622ef6)
(cherry picked from commit 207c6e4)
(cherry picked from commit 17b51e3)
(cherry picked from commit f09741c)
Describe the bug
The resolution of the issue #9487 created a critical issue for users upgrading from an older application (< 3.3.0).
The line is attempting to grab the foreign key (e.g. submission_id, genre_id, etc), by assuming that the first column will always contain the field:
https://github.com/pkp/ojs/blob/8517ea2ddd6a88ed713067b81824a2495549df45/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php#L165
But after the update below, the expectation was broken:
https://github.com/pkp/ojs/blame/8517ea2ddd6a88ed713067b81824a2495549df45/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php#L114
The result is that the
update
clause will use thesetting_name
as key instead of theid
, this will make all settings with the samesetting_name
to share the same value.It's better to not trust in the order of columns and use a proper field name, as users might also change the order.
EDIT: After some analysis, I'd say the surface area is limited to the
profileImage
of users. External plugins are out of the analysis, but I'd guess few of them make use of suchobject
field.As the profile image ends with the user id, it's possible to recover the images with a migration, by searching for a file that follows the name pattern
profileImage-{$userID}.ext
.What application are you using?
OJS 3.3
The text was updated successfully, but these errors were encountered: