-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yearly archives running nonstop, archive tables growing #17603
Comments
Yep, I'll upgrade. I wanted to hold off on upgrading until I had stopped the table growth. Just to help with my understanding, can you confirm: The automatic purging of invalidated archives doesn't happen until the archive in question completes, correct? And I assume this probably also applies to a manual purging. Those tables aren't going to shrink if there's not a completed archive for the same site and period. Also, will the upgrade to 4.3 help with the GROUP_CONCAT errors, or will I need to change my.conf to help these purges? |
The purging process deletes archives that are older than the newest ones. The newest ones do not get deleted, and the newest one has to be marked as complete to be considered the newest.
It should help with it, the code will try and set the session |
Update:
But I still have millions of duplicate rows in the archive tables associated with the 2020-01 yearly archives:
Attempting to purge still dies:
mariadb group_concat_max_len:
|
@mkindred Does the count of duplicates stay the same after running the purge command? Or better, does the count of total rows in the archive table decrease at all? |
The duplicate rows remain the same after each purge. The total row counts for matomo_archive_blob_2020_01 and matomo_archive_numeric_2020_01 seem to fluctuate up a bit, then back down to 12.2M rows. |
@mkindred I guess there are just far too many duplicate archives for the current code to handle... Would you be able to apply this patch: https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives?expand=1 then try and purge again? |
Apologies for dropping out for a bit. Work and life got busy. I have updated to 4.4.1, and I've applied the patch from https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives?expand=1 There is no change. I still have millions of duplicate rows, and when I run Is there any sort of diagnostic output I can send to help troubleshoot? |
@mkindred did the amount of duplicate rows lower after running the command? EDIT: also what exact warnings do you see? |
No, the duplicate rows seem to have remained the same:
The errors during
|
@mkindred on this line: https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives?expand=1#diff-732c8b0c81b3c11bec111dfb48dbb289e3b2232428d012dd94cad00634c35d61R119 can you add:
Then run the purge and see what shows up? |
Attached is the output of the purge command after adding that line. |
@mkindred ok, that's very confusing. Would you be able to add another log here: https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives?expand=1#diff-732c8b0c81b3c11bec111dfb48dbb289e3b2232428d012dd94cad00634c35d61L83
and run the command again? |
It takes 30 minutes to run the purge all. Should I add a parameter to narrow that down to a timeframe? ETA: I am going to run |
Output of |
@mkindred Ok, that provides some context. Can you run the following queries?
I've also updated the branch with another change: https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives#diff-732c8b0c81b3c11bec111dfb48dbb289e3b2232428d012dd94cad00634c35d61R105-R112 . Can you make this change and run the purge again on a single month? |
@diosmosis I reverted back to 4.4.1 and applied https://github.com/matomo-org/matomo/compare/large-amount-of-purgable-archives.patch sql queries: sql_query_output.txt Purge log |
@mkindred From the data I think you're being affected by the after effects of a couple bugs fixed in 4.3. Can you answer these questions:
|
I can't recall ever using funnels, except to test them out when I first installed Piwik. The issues (unending archive processes and growing archive tables) began shortly after I created a couple custom reports (one of which involved goals, if memory serves) and then subsequently invalidated reports for a timeframe of 6 months (approx 10-2020 through 04-2021). The archive processes began running normally (and the tables stopped growing) only after I deleted the two custom reports. Yes, I still have all raw data from 09-2019 forward. And I'm currently running my purge tests on a local docker instance. |
Side note: I stopped automatic deletion of raw data after I accidentally invalidated reports for a time period that included a time without raw data... obviously leaving a big hole in my reports. Luckily I was able to piece it back together from various backups, but it made me cautious to delete raw data. |
@mkindred ok, the easiest fix would be to just delete/truncate the archive tables, invalidate the dates, archive again, then check the reports, eg:
This could be done on your test instance first, then, after a backup is made of the extremely large database (just in case), done on production. If for some reason the tables can't be deleted (for example, because you don't have raw data there), then it's a bit more complicated, but still do-able. |
@diosmosis Makes sense, but I have a couple questions before I do that. Setting aside what actions might have triggered this issue, do you think it's fair to say that the biggest hindrance to reducing the bloat has been the sheer number of duplicate rows? Since I have raw data for all of 2020 and 2021, I'm considering removing all archive tables from 2020 and 2021 and invalidating --dates=2020-01-01,2021-08-06 just to get everything back to normal. Do you see a problem with doing this? Should I remove the patch(es) before invalidating and archiving? |
Short answer "yes". Long answer, there are two issues at play:
It might be a good idea to test the process first on one month, just since re-archiving everything would take a while, but if you have the raw data, it shouldn't be an issue. Archive data is just computed from raw data so in most cases it's meant to be deletable.
It's not strictly necessary, but probably a good idea. I'll be creating an official change that will get reviewed next week. |
@diosmosis Thanks for all your help. I was able to delete, invalidate, and archive for 2020, and then also for 2020-2021 on my local instance. Now I'll test on a staging site prior to trying the same on production. |
This does involve the custom reports plugin, but the issue is during archiving, so I'm not sure if the culprit is custom reports, goals, or core.
Expected Behavior
Archiving processes run from hourly cron should complete.
Current Behavior
I have had several archive processes that start at each cron archive run (hourly), but never complete. They ran for hundreds of hours or until I killed the process manually. Since this first started happening, my archive tables have been growing to be quite large and full of duplicates.
The two archive processes in question were yearly archives for custom reports, 2020-01. Assuming that the requestedReport parameter in the archive command corresponds to the custom report ID, it seems that both of the custom reports in question are fairly new. My guess is that I created the new custom reports and then invalidated six months of archives, which would overlap into 2020. At that point, I'm guessing that the 2020 yearly archives would run again. But I don't understand why they wouldn't complete.
Possible Solution
To stop the archive tables from growing and prevent the server from running out of resources, I deleted the two custom reports in question. That seems to have solved the initial problem.
Steps to Reproduce (for Bugs)
I'm not sure that this is easily reproducible. I want to try to wrangle all the archive tables back down to manageable levels before I attempt it. But here is what I remember of my process.
Your Environment
Matomo settings
FWIW site 1 gets 500k pageviews / year, and site 2 gets 2.5 million pageviews / year.
Questions
Do my steps to reproduce above point to an obvious error in my process? Ideally I'd like to create the custom reports and invalidate archives again, but I don't want to risk having the same thing happen.
Now that I've deleted the custom reports and things are running OK, I have very large archive tables:
I seem to have millions of duplicate rows in these two tables. I ran the following to find duplicates:
... resulting in the following (truncated for brevity):
I've brought the code and dbase down into a local docker environment to test whether I can purge. But I'm running into lots of issues with group_concat errors (
GROUP_CONCAT cut off the query result, you may have to purge archives again
). Based on the number of duplicate rows above, I'm assuming that maybe this is trying to create an SQL statement involving 45,000 rows?Do I need to change my MySQL settings in order to allow the purging and optimizing to continue?
The text was updated successfully, but these errors were encountered: