|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
DOCUMENT_NOT_FOUND when trying to update document after creating it within same transaction
by Matt Magoffin-4
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Hello, I ran into an exception
errcode = DOCUMENT_NOT_FOUND during a transaction where previously in the transaction I have created an XmlDocument and stored it, and then later happen to try to update that document within the same transaction. The logic works as shown below. Basically within one transaction an XmlDocument is created as new with a xmlManager.putDocument() call, and then later in the transaction the same document is attempted to be changed with an xmlManager.getDocument()/xmlManager.updateDocument() pair of calls. Is this allowed? ----- XmlDocument xmlDoc = null; try { xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); } catch ( XmlException e ) { if ( e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND ) { xmlDoc = xmlManager.createDocument(); } else { throw e; } } ... if ( StringUtils.hasLength(xmlDoc.getName()) ) { xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, updateContext); } else { xmlDoc.setName(docId); xmlContainer.putDocument(holder.getTransaction(), xmlDoc, updateContext, docConfig); } ----- So the first time around the XmlDocument would have been ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
|
|
Re: DOCUMENT_NOT_FOUND when trying to update document after creating it within same transaction
by Matt Magoffin-4
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Actually, this happens even if updating a document committed already from
a previous transaction, too. Is the code pattern below improper in some way for updating an existing document during a transaction, i.e. String docId = ...; String xml = ...; XmlDocument xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); xmlDoc.setContent(xml); xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, null); > Hello, I ran into an exception > > errcode = DOCUMENT_NOT_FOUND > > during a transaction where previously in the transaction I have created an > XmlDocument and stored it, and then later happen to try to update that > document within the same transaction. The logic works as shown below. > Basically within one transaction an XmlDocument is created as new with a > xmlManager.putDocument() call, and then later in the transaction the same > document is attempted to be changed with an > xmlManager.getDocument()/xmlManager.updateDocument() pair of calls. Is > this allowed? > > ----- > XmlDocument xmlDoc = null; > try { > xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); > } catch ( XmlException e ) { > if ( e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND ) { > xmlDoc = xmlManager.createDocument(); > } else { > throw e; > } > } > > ... > > if ( StringUtils.hasLength(xmlDoc.getName()) ) { > xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, > updateContext); > } else { > xmlDoc.setName(docId); > xmlContainer.putDocument(holder.getTransaction(), xmlDoc, updateContext, > docConfig); > } > ----- > > So the first time around the XmlDocument would have been > > > ------------------------------------------ > To remove yourself from this list, send an > email to xml-unsubscribe@... > > ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
|
|
Re: DOCUMENT_NOT_FOUND when trying to update document after creating it within same transaction
by Matt Magoffin-4
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message I've been doing much testing on this, including completely deleting my DB
environment and starting over from scratch. This pattern of updating works for some updates for some time, then seems to fail. Looking through my own debug logs, I see in a given transaction many hundreds of successful getDocument()/updateDocument() pairs, and then suddenly the DOCUMENT_NOT_FOUND exception will occur, seemingly at random. I think I've run out of ideas at this point. -- m@ > Actually, this happens even if updating a document committed already from > a previous transaction, too. > > Is the code pattern below improper in some way for updating an existing > document during a transaction, i.e. > > String docId = ...; > String xml = ...; > XmlDocument xmlDoc = xmlContainer.getDocument(holder.getTransaction(), > docId); > xmlDoc.setContent(xml); > xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, null); > >> Hello, I ran into an exception >> >> errcode = DOCUMENT_NOT_FOUND >> >> during a transaction where previously in the transaction I have created >> an >> XmlDocument and stored it, and then later happen to try to update that >> document within the same transaction. The logic works as shown below. >> Basically within one transaction an XmlDocument is created as new with a >> xmlManager.putDocument() call, and then later in the transaction the >> same >> document is attempted to be changed with an >> xmlManager.getDocument()/xmlManager.updateDocument() pair of calls. Is >> this allowed? >> >> ----- >> XmlDocument xmlDoc = null; >> try { >> xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); >> } catch ( XmlException e ) { >> if ( e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND ) { >> xmlDoc = xmlManager.createDocument(); >> } else { >> throw e; >> } >> } >> >> ... >> >> if ( StringUtils.hasLength(xmlDoc.getName()) ) { >> xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, >> updateContext); >> } else { >> xmlDoc.setName(docId); >> xmlContainer.putDocument(holder.getTransaction(), xmlDoc, >> updateContext, >> docConfig); >> } >> ----- >> >> So the first time around the XmlDocument would have been >> >> >> ------------------------------------------ >> To remove yourself from this list, send an >> email to xml-unsubscribe@... >> >> > > > > ------------------------------------------ > To remove yourself from this list, send an > email to xml-unsubscribe@... > > ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
|
|
Re: DOCUMENT_NOT_FOUND when trying to update document after creating it within same transaction
by George Feinberg-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Matt,
Is the code too large to send? Missing pieces can provide important clues. A few things to look for include: 1. Avoid re-using XmlDocument objects without doing a delete() on the previous use. This should work, but it's safer to explicitly delete. 2. Make sure you are using the right transactions on all operations, including the reads. 3. Do you have concurrent threads performing operations? 4. Are you sure you are getting DOCUMENT_NOT_FOUND on the updateDocument() call, and not the getDocument() call? Check these things and see if anything changes. Regards, George On Aug 1, 2006, at 4:39 AM, Matt Magoffin wrote: > I've been doing much testing on this, including completely deleting > my DB > environment and starting over from scratch. This pattern of > updating works > for some updates for some time, then seems to fail. Looking through > my own > debug logs, I see in a given transaction many hundreds of successful > getDocument()/updateDocument() pairs, and then suddenly the > DOCUMENT_NOT_FOUND exception will occur, seemingly at random. > > I think I've run out of ideas at this point. > > -- m@ > >> Actually, this happens even if updating a document committed >> already from >> a previous transaction, too. >> >> Is the code pattern below improper in some way for updating an >> existing >> document during a transaction, i.e. >> >> String docId = ...; >> String xml = ...; >> XmlDocument xmlDoc = xmlContainer.getDocument(holder.getTransaction >> (), >> docId); >> xmlDoc.setContent(xml); >> xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, null); >> >>> Hello, I ran into an exception >>> >>> errcode = DOCUMENT_NOT_FOUND >>> >>> during a transaction where previously in the transaction I have >>> created >>> an >>> XmlDocument and stored it, and then later happen to try to update >>> that >>> document within the same transaction. The logic works as shown >>> below. >>> Basically within one transaction an XmlDocument is created as new >>> with a >>> xmlManager.putDocument() call, and then later in the transaction the >>> same >>> document is attempted to be changed with an >>> xmlManager.getDocument()/xmlManager.updateDocument() pair of >>> calls. Is >>> this allowed? >>> >>> ----- >>> XmlDocument xmlDoc = null; >>> try { >>> xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); >>> } catch ( XmlException e ) { >>> if ( e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND ) { >>> xmlDoc = xmlManager.createDocument(); >>> } else { >>> throw e; >>> } >>> } >>> >>> ... >>> >>> if ( StringUtils.hasLength(xmlDoc.getName()) ) { >>> xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, >>> updateContext); >>> } else { >>> xmlDoc.setName(docId); >>> xmlContainer.putDocument(holder.getTransaction(), xmlDoc, >>> updateContext, >>> docConfig); >>> } >>> ----- >>> >>> So the first time around the XmlDocument would have been >>> >>> >>> ------------------------------------------ >>> To remove yourself from this list, send an >>> email to xml-unsubscribe@... >>> >>> >> >> >> >> ------------------------------------------ >> To remove yourself from this list, send an >> email to xml-unsubscribe@... >> >> > > > > ------------------------------------------ > To remove yourself from this list, send an > email to xml-unsubscribe@... > ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
|
|
Re: DOCUMENT_NOT_FOUND when trying to update document after creating it within same transaction
by Matt Magoffin-4
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message The code is not too large, no, I will send you a copy of that. As per your
questions below: 1) Might be possible in the general context of the application, but not within the scope of this transaction as a new XmlDocument is created for each object stored in the database. 2) I have tried to find a situation where a transaction might not be used, and am fairly sure all operations occur within a transaction, including reads. 3) I do have concurrent threads in the application, but this seems to occur even with a single thread operating. 4) Yes, I have double-checked this, the error occurs after the getDocument() call, on the updateDocument() call. I will send you the code next. Thank you, m@ > Matt, > > Is the code too large to send? Missing pieces can provide > important clues. A few things to look for include: > 1. Avoid re-using XmlDocument objects without doing > a delete() on the previous use. This should work, but > it's safer to explicitly delete. > 2. Make sure you are using the right transactions on all operations, > including the reads. > 3. Do you have concurrent threads performing operations? > 4. Are you sure you are getting DOCUMENT_NOT_FOUND on > the updateDocument() call, and not the getDocument() call? > > Check these things and see if anything changes. > > Regards, > > George > > On Aug 1, 2006, at 4:39 AM, Matt Magoffin wrote: > >> I've been doing much testing on this, including completely deleting >> my DB >> environment and starting over from scratch. This pattern of >> updating works >> for some updates for some time, then seems to fail. Looking through >> my own >> debug logs, I see in a given transaction many hundreds of successful >> getDocument()/updateDocument() pairs, and then suddenly the >> DOCUMENT_NOT_FOUND exception will occur, seemingly at random. >> >> I think I've run out of ideas at this point. >> >> -- m@ >> >>> Actually, this happens even if updating a document committed >>> already from >>> a previous transaction, too. >>> >>> Is the code pattern below improper in some way for updating an >>> existing >>> document during a transaction, i.e. >>> >>> String docId = ...; >>> String xml = ...; >>> XmlDocument xmlDoc = xmlContainer.getDocument(holder.getTransaction >>> (), >>> docId); >>> xmlDoc.setContent(xml); >>> xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, null); >>> >>>> Hello, I ran into an exception >>>> >>>> errcode = DOCUMENT_NOT_FOUND >>>> >>>> during a transaction where previously in the transaction I have >>>> created >>>> an >>>> XmlDocument and stored it, and then later happen to try to update >>>> that >>>> document within the same transaction. The logic works as shown >>>> below. >>>> Basically within one transaction an XmlDocument is created as new >>>> with a >>>> xmlManager.putDocument() call, and then later in the transaction the >>>> same >>>> document is attempted to be changed with an >>>> xmlManager.getDocument()/xmlManager.updateDocument() pair of >>>> calls. Is >>>> this allowed? >>>> >>>> ----- >>>> XmlDocument xmlDoc = null; >>>> try { >>>> xmlDoc = xmlContainer.getDocument(holder.getTransaction(), docId); >>>> } catch ( XmlException e ) { >>>> if ( e.getErrorCode() == XmlException.DOCUMENT_NOT_FOUND ) { >>>> xmlDoc = xmlManager.createDocument(); >>>> } else { >>>> throw e; >>>> } >>>> } >>>> >>>> ... >>>> >>>> if ( StringUtils.hasLength(xmlDoc.getName()) ) { >>>> xmlContainer.updateDocument(holder.getTransaction(), xmlDoc, >>>> updateContext); >>>> } else { >>>> xmlDoc.setName(docId); >>>> xmlContainer.putDocument(holder.getTransaction(), xmlDoc, >>>> updateContext, >>>> docConfig); >>>> } >>>> ----- >>>> >>>> So the first time around the XmlDocument would have been >>>> >>>> >>>> ------------------------------------------ >>>> To remove yourself from this list, send an >>>> email to xml-unsubscribe@... >>>> >>>> >>> >>> >>> >>> ------------------------------------------ >>> To remove yourself from this list, send an >>> email to xml-unsubscribe@... >>> >>> >> >> >> >> ------------------------------------------ >> To remove yourself from this list, send an >> email to xml-unsubscribe@... >> > > > > ------------------------------------------ > To remove yourself from this list, send an > email to xml-unsubscribe@... > > ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
| Free embeddable forum powered by Nabble | Forum Help |