akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
951 stars 516 forks source link

New command for clearing versioning table #3908

Closed alexandrzhulev closed 8 years ago

alexandrzhulev commented 8 years ago

Hello, I found that after clearing products from the system - the database still holds data about products (attributes, groups, etc) in pim_versioning_version table. So, this table increases in size all the time. To my opinion there should be some mechanism to clear this table - for example by console command (like existing pim:versioning:refresh). What do you think about this?

Regards, Alexandr.

nidup commented 8 years ago

Hi @alexandrzhulev

Thank you for this valuable feedback, we have an improvement in our product backlog related to this cleanup task but not highly prioritized, so we'll not release it soon. I'm 100% agree with the introduction of a new command.

A new pim:versioning:cleanup command should rely on a project configuration, for instance, to remove all versions older than 60 days. We should also take care to keep the very last version for each object because we have a cache system relying on this.

BTW, we welcome contribution and trying to enhance our community support and tools to make it easy, could you be interested to contribute and write this command? I would be glad to work with you to ensure the merge of this contribution.

Let me know if you're interested, if yes, you can already read and sign our contributor license agreement http://www.akeneo.com/contributor-license-agreement/

Thanks!

alexandrzhulev commented 8 years ago

Hello @nidup

A new pim:versioning:cleanup command should rely on a project configuration, for instance, to remove all versions older than 60 days. We should also take care to keep the very last version for each object because we have a cache system relying on this.

I'll work on this. If there would be question for clarification - I'll contact you. I have already looked at this a little bit - think it'll be complicated but I'll try.

Regards, Alexandr

nidup commented 8 years ago

Hi @alexandrzhulev Great news! Don't hesitate to push a very first draft of the command without conf, etc It will be easier to discuss on some code, i will be happy to help :)

nidup commented 8 years ago

Hi @alexandrzhulev Did you had time to move on this topic? I ask because we recently re-discussed about this feature with our product owner :smile:

alexandrzhulev commented 8 years ago

Hi @nidup Sorry, but for now I haven't time to work on this. In general our idea is to create a command which would receive two input parameters :

nidup commented 8 years ago

Hi @alexandrzhulev

FYI, for one of our project, @rybus who is tech consultant introduced this utility https://github.com/akeneo-labs/DevToolboxBundle/blob/history/purge/Command/HistoryPurgeCommand.php

I also re-discussed with one of our Product Owner, the expected behavior of the purge is the following,

PIM-5681
As Peter, I would like to purge my product history in order to decrease my database volume
The rules for the purge is:
Keep the 1st version of the entity (creation of the entity)
Keep the last version of the entity
Do not purge the published version of a product (Enterprise Edition only)
Purge the other versions since x days (or x months) defined in a parameter
Keep n versions defined in a parameter
The rules are configured with 2 parameters (no screen configuration), these parameters can be combined.
The purge is done by a cron job.
The restaure action can be done on all the versions kept.  (Enterprise Edition only)
Impacts on display: 10 last versions today
SamirBoulil commented 8 years ago

Hello @alexandrzhulev !

As @nidup explained you, we developed a command to purge the versions in the PIM and it's available on master (see command pim:versioning:purge). You can read the core of the code here.

It is built to be extensible and I plan to write a cookbook on this theme soon.

Feel free to reach out to me about the code or any issue you might encounter !