Ok. This is a simpler one then. See my today's answer to Jocelyn.
Don't use doc("$documents") to check if there is document in the
collection. Performance is very bad, database is locked, rollbacks, etc ...
BTW, according to your logs you use it twice in each transaction:
LOG 02/04/2013 12:28:59 (TRN omicshub pid=3220 sid=49 trid=49)
[tr_functions.cpp:on_user_statement_begin:102]: User query:
---
exists(document('$documents')/documents/collection[@name='proteins']/document[@name='BOOKMARK_48597973'])
LOG 02/04/2013 12:28:59 (TRN omicshub pid=3220 sid=49 trid=49)
[tr_functions.cpp:on_user_statement_begin:102]: User query:
---
exists(document('$documents')/documents/collection[@name='proteins']/document[@name='BOOKMARK_48597973'])
LOG 02/04/2013 12:28:59 (TRN omicshub pid=3220 sid=49 trid=49)
[tr_functions.cpp:on_user_statement_begin:102]: User query:
--- DROP document "BOOKMARK_48597973" in collection "proteins"
I understand, that in case of XML:DB API it may be hard (not possible?) to
completely avoid it. However, try to avoid replace and exists resource
operations. Instead use direct query like this for now:
exists(collection("col-name")[document-uri(.) eq "doc"])
Very soon we will commit doc-available("col", "doc") function.
On Wed, Apr 3, 2013 at 2:24 PM, Jose Sierra <jose.sie...@integromics.com>wrote:
> Hello Ivan.
>
> I am working with transactions. This is an example using my own wrapper:
>
> SednaWrapper.execute( new SednaHandler() {
> public void execute( final SednaWrapper wrapper ) throws Exception {
> if(wrapper.existsDocument("summary", oid))
> wrapper.deleteResource("summary", oid);
> }
> });
>
> The wrapper execute methos use transaction:
>
> public static void execute(final SednaHandler handler) throws
> Exception {
> synchronized( mutexTnx ) {
> long startTime = 0;
> if( logger.isDebugEnabled() ) {
> logger.debug( "Enter execute(SednaHandler) in
> SednaWrapper" );
> startTime = Calendar.getInstance().getTimeInMillis();
> }
> SednaWrapper.executeCode( new SednaHandler() {
> public void execute( final SednaWrapper wrapper ) throws
> Exception {
> TransactionService ts = null;
> try {
> ts = wrapper.startTransaction();
> handler.execute( wrapper );
> wrapper.commitTransaction( ts );
> } catch( XMLDBException e ) {
> // there is a special case in Sedna, where the
> server has killed the current transaction because is in conflict with
> another transaction,
> // and the current transaction "lost" in the
> resolution procedure. The rollback MUST not be called in this case.
> boolean isSednaDeadlockResolution = e.errorCode ==
> ErrorCodes.VENDOR_ERROR && e.vendorErrorCode == 0 && e.getMessage() != null
> && e.getMessage().contains( "SEDNA Message: ERROR SE4703" );
> if( !isSednaDeadlockResolution ) {
> try {
> wrapper.rollbackTransaction( ts );
> }
> catch( XMLDBException ignored ) {
> // safely ignored
> logger.error( "Exception: ", ignored );
> }
> }
> logger.error( "Exception: ", e );
> throw e;
> }
> catch( Exception t ) {
> try {
> wrapper.rollbackTransaction( ts );
> }
> catch( XMLDBException ignored ) {
> // safely ignored
> logger.error( "Exception: ", ignored );
> }
> logger.error( "Exception: ", t );
> throw t;
> }
> }
> } );
>
> if( logger.isDebugEnabled() ) {
> long endTime = Calendar.getInstance().getTimeInMillis();
> double timeInSeconds = (endTime - startTime) / 1000.0;
> logger.debug( "Exiting execute(SednaHandler) in
> SednaWrapper. Total time: " + timeInSeconds );
> }
> }
> }
>
> I will take a look to the list for discussions about upd_crt.
>
> Thanks and best regards.
> Jose Sierra
>
>
>
> On 03/04/2013 12:05, Ivan Shcheklein wrote:
>
> Hi Jose,
>
> I understand what's going in this case. Unfortunately, it's how Sedna
> works by design.
>
> Very simplified explanation. To provide ACID transactions Sedna uses
> snapshots (consider this as multiple copies of the database). All
> transactions work with the latests one. If Sedna determines (see upd_crt in
> docs) that the current snapshot has been updated enough, it starts
> checkpoint procedure - make the current snapshot stable (flash all changes
> to the disc) and start a new one (and make it current).
>
> Checkpoint procedure is the problem here. When Sedna wants to start it
> (and it may happen right in the middle of your big transaction with a lot
> of updates) it stops to accept any new transactions. It can be considered
> as a global lock.
>
> It can't be fixed easily. Unfortunately, I don't know if it can be fixed
> at all. As a workaround, you can try to avoid very long transactions which
> update significant portion of the database. For example, you can run every
> DROP as a transaction. You can also try to tune value of the upd_crt
> (search history of this list for discussions about upd_crt).
>
> Ivan Shcheklein,
> Sedna Team
>
>
> On Tue, Apr 2, 2013 at 2:44 PM, Jose Sierra
> <jose.sie...@integromics.com>wrote:
>
>> Hello Ivan.
>>
>> I have attached the logs with the problem.
>>
>> In the logs you can see several delete big files documents:
>>
>> --- DROP document "BOOKMARK_48597973" in collection "summary"
>> --- DROP document "BOOKMARK_48597973" in collection "features"
>> --- DROP document "BOOKMARK_48597973" in collection "peptides"
>> --- DROP document "BOOKMARK_48597973" in collection "proteins"
>>
>> When these deleting process are working i try to get some new queries
>> from differents collections, and the queries is not returned until the
>> deletion is finished.
>>
>> I hope these logs help you to calrify my doubt.
>>
>> Best regards.
>> Jose Sierra
>>
>>
>> On 07/03/2013 14:56, Ivan Shcheklein wrote:
>>
>> Jose, I can't reproduce your problem exactly. Can you send us event logs?
>>
>>
>> On Wed, Mar 6, 2013 at 8:51 PM, Jose Sierra
>> <jose.sie...@integromics.com>wrote:
>>
>>> Hello.
>>>
>>> I am working with sedna 3.5.161, storing the files in different
>>> collections. some of the files has a big size, and when i delete them,
>>> all the other queries/transactions are locked and they don“t run even if
>>> i am consulting/working with other collections. Now to delete i am using
>>> the drop document in collection sentence. Exists some other way more
>>> efficient to delete document or locking only the collection when i am
>>> deleting the resource instead all the database?
>>>
>>> Best regards.
>>> Jose Sierra
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>>> endpoint security space. For insight on selecting the right partner to
>>> tackle endpoint security challenges, access the full report.
>>> http://p.sf.net/sfu/symantec-dev2dev
>>> _______________________________________________
>>> Sedna-discussion mailing list
>>> Sedna-discussion@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>>>
>>
>>
>>
>
>
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion