<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi James,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">I've put some notes/code here:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fjesusbagpuss%2Fee27acd24a5d0e3fa3d29ef0075d921b&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=9bbKmt1stISa0mrYlRwTc9BRJcRAOSkLYnPKIxgZCGc%3D&amp;reserved=0" originalSrc="https://gist.github.com/jesusbagpuss/ee27acd24a5d0e3fa3d29ef0075d921b" shash="CnSd24H9QFWEWVZWrRSDw19kGhTDx/7oQ9pi5v9plgnuKwLpoyzCdToCZvf84MiF9uYN89CizGx3Kv4P4sGOg/ufP2iYozHVTRZ0YKZSKnhk1R/fzl5tVZBdBSc7DfpSzOZf3c2vkq+WnKFfpp/kNw62cqVbJPTlgkVAlR51KPg=">https://gist.github.com/jesusbagpuss/ee27acd24a5d0e3fa3d29ef0075d921b</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">let me know if it doesn't make sense.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">From my comments in the code (might be useful knowledge for others):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">EPrints' default behaviour is to remove the 'pos' during a document clone *only* when the doc is being cloned to the same parent.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
<b>On Behalf Of </b>James Kerwin via Eprints-tech<br>
<b>Sent:</b> 16 May 2019 12:22<br>
<b>To:</b> John Salter &lt;J.Salter@leeds.ac.uk&gt;<br>
<b>Cc:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> Re: [EP-tech] EPrints/Elements Merge Problems<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">He David and John,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">I've taken a look at the&nbsp;symplectic_merge and&nbsp;symplectic_pids table, and using by budding skills of divination I couldn't find anything out of sorts in there - so far as I can tell. Although in trying to fix this with multiple re-deposits
 this one record has a load of different EPrints IDs.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">It appears to be as John said. I've managed to clean the record up by fiddling with the document and file tables and moving some files around. Everything appears to be working...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">John, thank you for the piece of SQL. It appears this is isn't a huge problem, but there are other instances that I'm now at least aware of. I'll put a ticket in with Symplectic. If you do have a solution it would be brilliant, but out
 of principle I think Symplectic should provide the solution to their customers. Capitalists shouldn't be depending on an open source group to fix their code. Anyway, I don't want to get too political...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you both for your help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">James<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal">On Thu, May 16, 2019 at 9:49 AM John Salter &lt;<a href="mailto:J.Salter@leeds.ac.uk">J.Salter@leeds.ac.uk</a>&gt; wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Hi James,<br>
Yes - and I've submitted a bug report to Symplectic - with a fix for their connector - which they've never rolled out *sigh*.<br>
<br>
When two items are merged, and initially they both have documents in folder '01', all these then get put into the 'surviving EPrint's '01' directory.<br>
Worse still, if both items have a file of the same name e.g. Doc1.pdf (but they are different files), one of them will overwrite the other - and you have data-loss :o|<br>
<br>
You can see how many things are affected by this with the following query:<br>
SELECT&nbsp; &nbsp;eprintid, pos, count(*) as c FROM&nbsp; &nbsp;document GROUP BY&nbsp; &nbsp;eprintid, pos HAVING c &gt; 1;<br>
<br>
The issue is in Symplectic/RepoProcess/MergeManager.pm - and a call to:<br>
&nbsp; &nbsp; &nbsp; &nbsp; my $new_doc = $doc-&gt;clone($target);<br>
This clone doesn't reset the 'pos' - so you get the results reported.<br>
<br>
I'll put a gist together with the changes needed to resolve this.<br>
<br>
Feel free to log it as a ticket with Symplectic...<br>
<br>
Cheers,<br>
John<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk" target="_blank">eprints-tech-bounces@ecs.soton.ac.uk</a> [mailto:<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk" target="_blank">eprints-tech-bounces@ecs.soton.ac.uk</a>] On Behalf Of Newman
 D.R. via Eprints-tech<br>
Sent: 16 May 2019 09:28<br>
To: <a href="mailto:eprints-tech@ecs.soton.ac.uk" target="_blank">eprints-tech@ecs.soton.ac.uk</a>; James Kerwin &lt;<a href="mailto:jkerwin2101@gmail.com" target="_blank">jkerwin2101@gmail.com</a>&gt;<br>
Subject: Re: [EP-tech] EPrints/Elements Merge Problems<br>
<br>
Hi James,<br>
<br>
Based on some experience with this it can be due to the symplectic_pids<br>
table in EPrints getting out of sync.&nbsp; I have in the past had to make<br>
manual corrections to fix this.&nbsp; It has never been clear to me what<br>
caused the issue, as I only have access to the EPrints side.<br>
<br>
I would take a look in this EPrints database table.&nbsp; It has three IDs<br>
two from Symplectic and one from EPrints.&nbsp; A record with no outstanding<br>
merge issues should have the same two Symplectic IDs and the associated<br>
EPrint ID.&nbsp; Sometimes I have not even been able to find the record I<br>
need in this table based on a lookup against either the EPrint or<br>
Symplectic ID.&nbsp; Tell me what you find and I maybe able to advise<br>
further or confirm whether this is or is not the issue you are<br>
experiencing.<br>
<br>
Regards<br>
<br>
David Newman<br>
<br>
On Thu, 2019-05-16 at 09:18 &#43;0100, James Kerwin via Eprints-tech wrote:<br>
&gt; Hi All,<br>
&gt;<br>
&gt; This may be a question for the Symplectic list, but on the off-chance<br>
&gt; anybody has experienced similar problems... Has anybody had trouble<br>
&gt; with merging records in Elements and the result in EPrints being a<br>
&gt; complete mess?<br>
&gt;<br>
&gt; A record was merged recently and the results in EPrints are two<br>
&gt; documents in the same folder on the server (where the file download<br>
&gt; link points two).<br>
&gt;<br>
&gt; For example, there is usually one file per bottom level directory:<br>
&gt;<br>
&gt; Dir 01 = file1.pdf<br>
&gt; Dir 02 = file2.pdf<br>
&gt;<br>
&gt; and so on.<br>
&gt;<br>
&gt; I'm getting:<br>
&gt;<br>
&gt; Dir 01 = file1.pdf, file2.pdf<br>
&gt; Dir02 = file3.pdf<br>
&gt;<br>
&gt; Also the files showing Elements seem to be duplicating themselves and<br>
&gt; keeps changing to &quot;deposit incomplete&quot; Always one more of the<br>
&gt; duplicated file in Elements than is appearing in EPrints.<br>
&gt;<br>
&gt; I know I can tidy this up in EPrints, but I'd like to stop it<br>
&gt; happening altogether.<br>
&gt;<br>
&gt; Thanks,<br>
&gt; James<br>
&gt; *** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-" target="_blank">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-</a><br>
&gt; tech<br>
&gt; *** Archive: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=abhBdXkmIv9A1HG51r75ESol8sIhMQEoyF1hbS5IHrI%3D&amp;reserved=0" originalSrc="http://www.eprints.org/tech.php/" shash="TP/APivL85bqfzvA5YpU2KenLNtKwOOSygPrEsQApZfxwNPH0Cg1iFSXN99IFxrRFIQq3VcyxlqlXSciz0lbKG2J2fMWsvVJ9Xa+R+yvjXy5qLJTruGp9tiy+0JEXrwdtTqDYoz5XLTe31Jif9aDpZXPq1+zahrIAbcPt+OHRVA=" target="_blank">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;amp;data=01%7C01%7C%7Cd53022b90d27459e88c208d6d9d878a3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=k9RapSd7ddVo7%2BFhlqhADhT53Ra9%2FRwHWaXhLonT5aM%3D&amp;amp;reserved=0</a><br>
&gt; *** EPrints community wiki: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=vj2DPDW1mobFDM6FQbe9oxF9C8EwlJSC%2FabkS%2BqIuZY%3D&amp;reserved=0" originalSrc="http://wiki.eprints.org/" shash="vR+0WOZpvQFYUEIJjvFHh1LDQgyCYprcj28CBMFVGu2xVdKkbQVNsLUzo26W0v4haJaDJL7bqM0ThaK2YuyV7I++LFK9pSN6vLRyNh3a+m1w6dH4qHRPbGwMTd2cXAxy+fZiFQjwYXS5lqUVAHvGhxls15i9Ipg8w83cO9Aj6YQ=" target="_blank">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;amp;data=01%7C01%7C%7Cd53022b90d27459e88c208d6d9d878a3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=6vHCSlBvgz9sv3jZGhvsmwKJn4all8tCD2bc44fuxpo%3D&amp;amp;reserved=0</a><br>
&gt; *** EPrints developers Forum: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=QVu7cqkEOUsRujw4tR5kcBwvv2jOFwYXU8RmppYDFao%3D&amp;reserved=0" originalSrc="http://forum.eprints.org/" shash="xYPW/xlS/S/T9Gwf27FvaOuVigmuOKIVNtR7SxVav2NiLnvl4ouI0y/PSfy8q5/LjxSYNB0O7Bqut+oDAahI/oYYablrsUJqCpssxfFqU+VsokSBO6LdGqPO8SZpxrbzqEjp1/nQ9uyW8AVP5TN7bIWH62bCOYukRbXukYM7duM=" target="_blank">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;amp;data=01%7C01%7C%7Cd53022b90d27459e88c208d6d9d878a3%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;amp;sdata=RaBQEyELw4X71EVgu7B9nnSm090fFQFEc%2FBO9mQaK%2Fk%3D&amp;amp;reserved=0</a><br>
<br>
*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" target="_blank">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=abhBdXkmIv9A1HG51r75ESol8sIhMQEoyF1hbS5IHrI%3D&amp;reserved=0" originalSrc="http://www.eprints.org/tech.php/" shash="TP/APivL85bqfzvA5YpU2KenLNtKwOOSygPrEsQApZfxwNPH0Cg1iFSXN99IFxrRFIQq3VcyxlqlXSciz0lbKG2J2fMWsvVJ9Xa+R+yvjXy5qLJTruGp9tiy+0JEXrwdtTqDYoz5XLTe31Jif9aDpZXPq1+zahrIAbcPt+OHRVA=" target="_blank">
http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=vj2DPDW1mobFDM6FQbe9oxF9C8EwlJSC%2FabkS%2BqIuZY%3D&amp;reserved=0" originalSrc="http://wiki.eprints.org/" shash="vR+0WOZpvQFYUEIJjvFHh1LDQgyCYprcj28CBMFVGu2xVdKkbQVNsLUzo26W0v4haJaDJL7bqM0ThaK2YuyV7I++LFK9pSN6vLRyNh3a+m1w6dH4qHRPbGwMTd2cXAxy+fZiFQjwYXS5lqUVAHvGhxls15i9Ipg8w83cO9Aj6YQ=" target="_blank">
http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Cad931c87c81d4de86d1408d6d9f468eb%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=QVu7cqkEOUsRujw4tR5kcBwvv2jOFwYXU8RmppYDFao%3D&amp;reserved=0" originalSrc="http://forum.eprints.org/" shash="xYPW/xlS/S/T9Gwf27FvaOuVigmuOKIVNtR7SxVav2NiLnvl4ouI0y/PSfy8q5/LjxSYNB0O7Bqut+oDAahI/oYYablrsUJqCpssxfFqU+VsokSBO6LdGqPO8SZpxrbzqEjp1/nQ9uyW8AVP5TN7bIWH62bCOYukRbXukYM7duM=" target="_blank">
http://forum.eprints.org/</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>