Bug 17009

Summary: Duplicating frameworks is unnecessary slow
Product: Koha Reporter: Jonathan Druart <jonathan.druart+koha>
Component: System AdministrationAssignee: Jonathan Druart <jonathan.druart+koha>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: frederic, gmcharlt, irma, julian.maurice, kyle, veron
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 16955    
Bug Blocks:    
Attachments: Bug 17009: Speed up the framework duplication
Bug 17009: Speed up the framework duplication
Bug 17009: Speed up the framework duplication
Bug 17009: Speed up the framework duplication

Description Jonathan Druart 2016-08-01 12:46:24 UTC
To duplicate frameworks, the code retrieve all the subfields, then execute 1 insert per subfield.
It's unnecessary slow, we can use the DBMS to do it.
Comment 1 Jonathan Druart 2016-08-01 12:48:31 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-08-02 08:49:45 UTC Comment hidden (obsolete)
Comment 3 Irma Birchall 2016-08-06 22:19:02 UTC
(In reply to Jonathan Druart from comment #2)
> Created attachment 53875 [details] [review] [review]
> Bug 17009: Speed up the framework duplication
> 
> To duplicate frameworks, the code retrieve all the subfields, then
> execute 1 insert per subfield.
> It's unnecessary slow, we can use the DBMS to do it.
> 
> Test plan:
> Create a new framework and duplicate the structure of another framework.

I applied the dependency 16995 then tried to apply this patch, it did not apply. 

Message: 
Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 16995 - Remove event attributes from two include files
tester@debian:~/kohaclone$ git bz apply 17009
Bug 17009 - Duplicating frameworks is unnecessary slow

53875 - Bug 17009: Speed up the framework duplication

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 17009: Speed up the framework duplication
fatal: sha1 information is lacking or useless (admin/marctagstructure.pl).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 17009: Speed up the framework duplication
The copy of the patch that failed is found in:
   /home/tester/kohaclone/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-17009-Speed-up-the-framework-duplication-FRLPWa.patch
Comment 4 Marc Véron 2016-08-07 20:03:03 UTC Comment hidden (obsolete)
Comment 5 Nick Clemens 2016-08-12 19:01:39 UTC
Created attachment 54398 [details] [review]
Bug 17009: Speed up the framework duplication

To duplicate frameworks, the code retrieve all the subfields, then
execute 1 insert per subfield.
It's unnecessary slow, we can use the DBMS to do it.

Test plan:
Create a new framework and duplicate the structure of another framework.

Signed-off-by: Marc <veron@veron.ch>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Kyle M Hall 2016-08-18 16:02:44 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 7 Frédéric Demians 2016-08-23 10:39:59 UTC
Pushed in 16.05. Will be in 16.05.03.
Comment 8 Julian Maurice 2016-08-24 10:44:53 UTC
Pushed to 3.22.x, will be in 3.22.10