Merge lp:~zorba-coders/zorba/unregister-delete-or-destroy into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10750
Merged at revision: 10910
Proposed branch: lp:~zorba-coders/zorba/unregister-delete-or-destroy
Merge into: lp:zorba
Diff against target: 201 lines (+85/-5)
6 files modified
src/store/naive/node_items.cpp (+38/-2)
src/store/naive/node_items.h (+6/-0)
src/store/naive/pul_primitives.cpp (+3/-0)
src/store/naive/simple_store.cpp (+29/-1)
src/store/naive/simple_store.h (+3/-1)
src/store/naive/store.h (+6/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/unregister-delete-or-destroy
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Matthias Brantner Approve
Review via email: mp+100814@code.launchpad.net

Commit message

Differentiating between two reasons why references are unregistered.

Description of the change

Differentiating between two reasons why references are unregistered.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

No approved revision specified.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/unregister-delete-or-destroy into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job unregister-delete-or-destroy-2012-04-04T16-12-59.472Z
  is finished. The final status was:

  71 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/unregister-delete-or-destroy into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job unregister-delete-or-destroy-2012-06-20T16-08-59.225Z
  is finished. The final status was:

  87 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job unregister-delete-or-destroy-2012-06-21T09-46-00.606Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 2 Pending.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

This doesn't make sense to me at all!

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Needs Fixing
Revision history for this message
Ghislain Fourny (gislenius) wrote :

Thanks Markos, the function is now virtual ;-)

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job unregister-delete-or-destroy-2012-07-03T09-39-05.169Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 2 Needs Fixing.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job unregister-delete-or-destroy-2012-07-03T15-05-59.471Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp 2012-06-29 18:19:56 +0000
+++ src/store/naive/node_items.cpp 2012-07-03 09:40:26 +0000
@@ -144,7 +144,7 @@
144/*******************************************************************************144/*******************************************************************************
145145
146********************************************************************************/146********************************************************************************/
147void XmlTree::free()147void XmlTree::destroy() throw()
148{148{
149 // std::cout << "Deleting Xml Tree: " << this << std::endl;149 // std::cout << "Deleting Xml Tree: " << this << std::endl;
150150
@@ -171,6 +171,15 @@
171}171}
172172
173173
174/*******************************************************************************
175
176********************************************************************************/
177void XmlTree::free()
178{
179 destroy();
180}
181
182
174#ifndef EMBEDED_TYPE183#ifndef EMBEDED_TYPE
175184
176/*******************************************************************************185/*******************************************************************************
@@ -880,11 +889,21 @@
880#endif889#endif
881890
882 if (haveReference())891 if (haveReference())
883 GET_STORE().unregisterNode(this);892 GET_STORE().unregisterReferenceToUnusedNode(this);
884893
885 delete this;894 delete this;
886}895}
887896
897/*******************************************************************************
898
899********************************************************************************/
900void XmlNode::unregisterReferencesToDeletedSubtree()
901{
902 if (haveReference())
903 GET_STORE().unregisterReferenceToDeletedNode(this);
904}
905
906
888907
889/////////////////////////////////////////////////////////////////////////////////908/////////////////////////////////////////////////////////////////////////////////
890// //909// //
@@ -1723,6 +1742,23 @@
1723}1742}
17241743
17251744
1745/*******************************************************************************
1746
1747********************************************************************************/
1748void InternalNode::unregisterReferencesToDeletedSubtree()
1749{
1750 std::for_each(
1751 childrenBegin(), childrenEnd(),
1752 std::mem_fun(&XmlNode::unregisterReferencesToDeletedSubtree));
1753
1754 std::for_each(
1755 attrsBegin(), attrsEnd(),
1756 std::mem_fun(&XmlNode::unregisterReferencesToDeletedSubtree));
1757
1758 XmlNode::unregisterReferencesToDeletedSubtree();
1759}
1760
1761
1726/////////////////////////////////////////////////////////////////////////////////1762/////////////////////////////////////////////////////////////////////////////////
1727// //1763// //
1728// class DocumentNode //1764// class DocumentNode //
17291765
=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h 2012-06-29 18:19:56 +0000
+++ src/store/naive/node_items.h 2012-07-03 09:40:26 +0000
@@ -189,6 +189,8 @@
189189
190 void free();190 void free();
191191
192 void destroy() throw();
193
192 long getRefCount() const { return theRefCount; }194 long getRefCount() const { return theRefCount; }
193195
194 long& getRefCount() { return theRefCount; }196 long& getRefCount() { return theRefCount; }
@@ -545,6 +547,8 @@
545547
546 bool isConnectorNode() const { return (theFlags & IsConnectorNode) != 0; }548 bool isConnectorNode() const { return (theFlags & IsConnectorNode) != 0; }
547549
550 virtual void unregisterReferencesToDeletedSubtree();
551
548#ifndef ZORBA_NO_FULL_TEXT552#ifndef ZORBA_NO_FULL_TEXT
549 FTTokenIterator_t getTokens( 553 FTTokenIterator_t getTokens(
550 TokenizerProvider const&,554 TokenizerProvider const&,
@@ -831,6 +835,8 @@
831835
832 void finalizeNode();836 void finalizeNode();
833837
838 virtual void unregisterReferencesToDeletedSubtree();
839
834protected:840protected:
835 csize findChild(const XmlNode* child) const;841 csize findChild(const XmlNode* child) const;
836842
837843
=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp 2012-06-28 04:14:03 +0000
+++ src/store/naive/pul_primitives.cpp 2012-07-03 09:40:26 +0000
@@ -163,6 +163,9 @@
163 {163 {
164 theParent->deleteChild(*this);164 theParent->deleteChild(*this);
165 }165 }
166
167 static_cast<zorba::simplestore::XmlNode*>(theTarget.getp())
168 ->unregisterReferencesToDeletedSubtree();
166}169}
167170
168171
169172
=== modified file 'src/store/naive/simple_store.cpp'
--- src/store/naive/simple_store.cpp 2012-06-28 21:54:08 +0000
+++ src/store/naive/simple_store.cpp 2012-07-03 09:40:26 +0000
@@ -363,7 +363,7 @@
363 @param node XDM node363 @param node XDM node
364 @return whether the node was registered or not.364 @return whether the node was registered or not.
365********************************************************************************/365********************************************************************************/
366bool SimpleStore::unregisterNode(XmlNode* node)366bool SimpleStore::unregisterReferenceToUnusedNode(XmlNode* node)
367{367{
368 if (!node->haveReference())368 if (!node->haveReference())
369 return false;369 return false;
@@ -386,6 +386,34 @@
386 }386 }
387}387}
388388
389/*******************************************************************************
390 Does nothing in the simple store.
391
392 @param node XDM node
393 @return whether the node was registered or not.
394********************************************************************************/
395bool SimpleStore::unregisterReferenceToDeletedNode(XmlNode* node)
396{
397 // Does nothing, since there is no persistency layer. A deleted node can still
398 // be retrieved with a reference, so its reference may not be removed from the
399 // cache.
400 // Merely returns true if entry found, false otherwise.
401
402 if (!node->haveReference())
403 return false;
404
405 NodeRefMap::iterator resIt;
406
407 if ((resIt = theNodeToReferencesMap.find(node)) != theNodeToReferencesMap.end())
408 {
409 return true;
410 }
411 else
412 {
413 return false;
414 }
415}
416
389417
390#ifdef ZORBA_WITH_JSON418#ifdef ZORBA_WITH_JSON
391/*******************************************************************************419/*******************************************************************************
392420
=== modified file 'src/store/naive/simple_store.h'
--- src/store/naive/simple_store.h 2012-06-28 21:54:08 +0000
+++ src/store/naive/simple_store.h 2012-07-03 09:40:26 +0000
@@ -98,7 +98,9 @@
9898
99 void destroyTreeIdGeneratorFactory(TreeIdGeneratorFactory* g) const;99 void destroyTreeIdGeneratorFactory(TreeIdGeneratorFactory* g) const;
100100
101 bool unregisterNode(XmlNode* node);101 bool unregisterReferenceToUnusedNode(XmlNode* node);
102
103 bool unregisterReferenceToDeletedNode(XmlNode* node);
102104
103 //105 //
104 // Store api methods106 // Store api methods
105107
=== modified file 'src/store/naive/store.h'
--- src/store/naive/store.h 2012-06-28 04:14:03 +0000
+++ src/store/naive/store.h 2012-07-03 09:40:26 +0000
@@ -418,7 +418,12 @@
418418
419 virtual bool getNodeByReference(store::Item_t& result, const zstring& ref) = 0;419 virtual bool getNodeByReference(store::Item_t& result, const zstring& ref) = 0;
420420
421 virtual bool unregisterNode(XmlNode* node) = 0;421 // Unregisters a reference to an unused node (upon its destruction in
422 // the memory).
423 virtual bool unregisterReferenceToUnusedNode(XmlNode* node) = 0;
424
425 // Unregisters a reference to a node that was deleted (by XQUF).
426 virtual bool unregisterReferenceToDeletedNode(XmlNode* node) = 0;
422427
423/*----------------------- Temp Sequence Management ---------------------------*/428/*----------------------- Temp Sequence Management ---------------------------*/
424public:429public:

Subscribers

People subscribed via source and target branches