[MarkLogic Dev General] Issue with dls:document version delete

Abhishek53 S abhishek53.s at tcs.com
Tue Aug 28 23:53:20 PDT 2012


Hi Santhosh.

In our case we want to rollback our content to its previous version. We 
have content replicating across two repositories. Once the new version of 
document is created inside Marklogic a separate request is made to another 
transactional repository to update certain metadata information for that 
content. In case of any exception in the metadata repository the latest 
version of the document in Marklogic which already committed needs to be 
rolled back to oits previous state.

 dls:document-version-delete is used to the purpose for deleting latest 
version from Marklogic repository in order to rollback content to the 
previous version. But After deleting the content it is not getting version 
next time onwards.

By the way What is meant by "dls:document-version-delete overrides 
retention policies"?

Thanks for your response...

Abhishek Srivastav
Systems Engineer
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: abhishek53.s at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



From:
"Rajasekaran, Santhosh" <Santhosh.Rajasekaran at hmhpub.com>
To:
MarkLogic Developer Discussion <general at developer.marklogic.com>
Cc:
Saptarshi Das <saptarshi.das at tcs.com>, Pawan Saha <pawan.saha at tcs.com>
Date:
08/29/2012 11:59 AM
Subject:
Re: [MarkLogic Dev General] Issue with dls:document version delete
Sent by:
general-bounces at developer.marklogic.com



Hi Abhishek,
 
Deleting the latest version means it is almost equal to deleting the 
document from the databse in normal case. In your case as you have deleted 
the document already, so it could not update or create new version in step 
7. So, you can try to delete the earlier versions instead of last(), then 
hopefully your step 7 will wrok fine as you have the latest version.
 
Note: In step 6, you are passing the 3rd argument as fn:false() , this 
means it will not reatin event he document's property.
 
dls:document-checkout-update-checkin($templateURI,$content,"update",fn:true()) 

 
here $templateURI - is the uri of the document to be updated, as you have 
deleted the document in step 6, it can't find the document with the given 
URI to update.
 
The documentation for "dls:document-version-delete" says that this 
function overrides any configured retention policies and should be used 
with care.
 
So if you want to delete the older versions, before doing step 6 , perform 
step7 and then delete the older versions.
 
Hope this helps.
 
Thanks & Regards,
Santhosh
 
From: general-bounces at developer.marklogic.com 
[general-bounces at developer.marklogic.com] On Behalf Of Abhishek53 S 
[abhishek53.s at tcs.com]
Sent: Tuesday, August 28, 2012 11:17 AM
To: MarkLogic Developer Discussion
Cc: Saptarshi Das; Pawan Saha
Subject: [MarkLogic Dev General] Issue with dls:document version delete


Hi All, 

We are having issue with dls:document-version-delete API. Once the latest 
version of the document is deleted, we are not able to create next version 
using dls:document-checkout-update-checkin. 

Here is the sequence of steps performed over xlsx (binary content) 
Step 1: 
let $content := BINARY_CONTENT 
Step 2: 
let $templateURI := URI 
Step 3: 
(:Insert manageable document inside ML:) 
dls:document-insert-and-manage($templateURI,fn:false(),$content,()) 
Step 4: 
(:Creating multiple Version:) 
for $a in [1 to 13] 
return 
xdmp:eval(" 
import module namespace dls = 'http://marklogic.com/xdmp/dls' at 
'/MarkLogic/dls.xqy'; 
dls:document-checkout-update-checkin( URI ,doc(URI),'update',fn:true())", 
(), 
<options xmlns="xdmp:eval"> 
<database>{xdmp:database("db-name")}</database> 
</options> 
) 
(:Till now we are fine:) 
Step 5: 
let $latestVersion := 
fn:data(dls:document-history($templateURI)//dls:version-id)[last()] 
Step 6: 
(:Delete latest version:) 
dls:document-version-delete($templateURI,$latestVersion,fn:false()) 
Step 7: 
(:Ideally next version should be created by this step:) 
dls:document-checkout-update-checkin($templateURI,$content,"update",fn:true()) 

(:No versions are getting created:) 
The retention rule is created to maintained all version of document 
Let me know in case this is an known issue or we are missing any step. 

Thanks in advance 

Regards
Abhishek Srivastav
Systems Engineer
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: abhishek53.s at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you
_______________________________________________
General mailing list
General at developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120829/7228a153/attachment-0001.html 


More information about the General mailing list