Skip to content
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

Piwik Sequence table does not auto-update after changing DB prefix #9533

Open
quba opened this issue Jan 15, 2016 · 8 comments
Open

Piwik Sequence table does not auto-update after changing DB prefix #9533

quba opened this issue Jan 15, 2016 · 8 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@quba
Copy link
Contributor

quba commented Jan 15, 2016

Steps to reproduce:

  1. Change DB prefix
  2. Run archiving

In this case, Piwik will create new records in prefix_sequence table and, unfortunately, will start with 0.

There are two suggested solutions:

  1. Don't use prefixes in prefix_sequence table.
  2. While recreating records in the sequence table, set them to max(idarchive) from the corresponding table.

It's rather a critical issue. Currently the only way is to manually set the sequence records to max(idarchive) for each corresponding archive_numeric table.

@tsteur
Copy link
Member

tsteur commented Jan 17, 2016

  1. Without prefix is not really solution since one could have installed multiple piwiks in one database.

  2. When recreating records, do we know the original prefix? Which tool are you using for this? Or how do you change the prefix? Only in the config file?

@quba
Copy link
Contributor Author

quba commented Jan 17, 2016

  1. What is the issue with this approach? It should still be doable, as the prefix affects only table name, not records inside. And during the archiving process you should have access to the right config file which defines the prefix of archive tables.

  2. The original prefix is not important if you recreate records based on current archive tables. Selecting max(idarchive) should be really fast and there's no need to access previous record from the sequence table.

Why do we have to change prefix in some cases? Just to keep all our databases consistent (e.g. when we import existing database to Piwik Cloud). Would be nice to have a command/script to do the job. If there are issues with the sequence table, it may be really confising for the end users, as the archving process doesn't update the reports in this case.

@tsteur
Copy link
Member

tsteur commented Jan 17, 2016

  1. True! Sounds like simplest solution

  2. I'm still not sure what you mean by recreate records but 1) sounds like a good solution anyway :)

@quba
Copy link
Contributor Author

quba commented Jan 17, 2016

  1. To not start with 0 when there's no record for a given archive table in piwik_sequence, but instead check the the corresponding table.

@tsteur
Copy link
Member

tsteur commented Jan 17, 2016

I got that, what I don't get is how you change the prefix and recreate records. Like how do you do that step by step? Just to understand it better... I presume you basically import the tables into a database and then do a rename on the table names and that's it?

Anyway, still thinking 1) is best solution so doesn't really matter. We can simply save it without the prefix and also update existing records in the sequence table

@quba
Copy link
Contributor Author

quba commented Jan 18, 2016

@tsteur yes, our sys-admins were not aware that something may break after changing tables prefix and updating config file. Now the procedure is to update also records in the sequence table (change prefix).

@tsteur
Copy link
Member

tsteur commented Jan 18, 2016

OK got it. We should remove it, maybe better for Piwik 3.0 to not break anything. If something goes wrong, there could be serious problems

@mattab
Copy link
Member

mattab commented Mar 31, 2016

So the solution would be:

  • Don't use prefixes in prefix_sequence table.
  • Migrate data in prefix_sequence and remove any prefix there.

Assigning to LTS backlog.

@mattab mattab added Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. labels Mar 31, 2016
@mattab mattab added this to the 2.16.x (LTS) milestone Mar 31, 2016
@mattab mattab modified the milestones: 2.16.x (LTS), Mid term Aug 25, 2016
@mattab mattab removed the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants