This discussion is archived
3 Replies Latest reply: Feb 1, 2012 11:58 AM by Oracle, Sandra Whitman RSS

DB blocks writes after I run XQueries with inequality tests

GeoffShuetrim Newbie
Currently Being Moderated
I am using Oracle Berkeley XML Database version 5.3.16.
I am using it on a 64 bit Linux platform (Ubuntu 11.10).
I am using the Java API to interact with the database and am using the Oracle Sun Java JDK 1.6.0.26.

I am running Xqueries like:

for $child in collection('test.dbxml")/eg:root/eg:child where (xs:double($child/@value) gt xs:double(0.0)) return $child

Note the critical gt operator. I can use it or the > operator and the findings described below continue apply.

I have found that after running this query the database "locks up" under certain conditions. By "locks up", I mean that the database does not allow me to add any new XML resources to the data container. Instead it just hangs, looking like it is waiting for a deadlock to be resolved.

The database hangs when inserting XML resources into the container, regardless of whether the query returns any results or not.

It hangs, regardless of whether I use the xs:double functions in the query or not.

It hangs, regardless of of whether I have indexes on the attributes whose values are involved in the inequality tests.

A pair of JUnit 4 unit tests is provided below.

Insights as to how to get queries with inequality tests to finish cleanly without leaving behind any locks etc would be very helpful.

Regards

Geoff Shuetrim

{code}


import java.io.File;
import java.util.HashSet;
import java.util.Set;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.db.LockStats;
import com.sleepycat.dbxml.XmlContainer;
import com.sleepycat.dbxml.XmlContainerConfig;
import com.sleepycat.dbxml.XmlDocument;
import com.sleepycat.dbxml.XmlDocumentConfig;
import com.sleepycat.dbxml.XmlException;
import com.sleepycat.dbxml.XmlIndexSpecification;
import com.sleepycat.dbxml.XmlManager;
import com.sleepycat.dbxml.XmlManagerConfig;
import com.sleepycat.dbxml.XmlQueryContext;
import com.sleepycat.dbxml.XmlQueryExpression;
import com.sleepycat.dbxml.XmlResults;
import com.sleepycat.dbxml.XmlUpdateContext;
import com.sleepycat.dbxml.XmlValue;

public class OracleBerkeleyXMLDatabaseInequalityQueryTests {

     private String xml = "<?xml version='1.0' encoding='UTF-8'?>" +
               "<eg:root xmlns:eg='http://example.com/'>" +
               "<eg:child value='3.0'/>" +
               "</eg:root>";
     
     private String databaseFolder = "/home/geoff/Documents/temp/dbxml";
     private String containerName = "test.dbxml";
     
     private SimpleStore store;
     
@Before
public void setUp() {
          store = new SimpleStore(databaseFolder,containerName);
}

@After
public void tearDown() {
try {
     System.out.println("Deleting the data store.");
store.delete();
} catch (Exception e) {
e.printStackTrace();
Assert.fail("The store could not be deleted.");
}
}

@Test
public void testGreaterThanQueryWithNoResults_BlocksLaterWrites() {
try {
          Assert.assertEquals(0, store.size());
          store.persist(xml, "document_1");
          Assert.assertEquals(1, store.size());
          String query = "for $child in collection('"+containerName+"')/eg:root/eg:child where (xs:double($child/@value) gt xs:double(0.0)) return $child";
          Set<String> result = store.queryForDocumentNames(query);
               for (String name: result) {
                    System.out.println("Retrieved " + name);
               }
               Assert.assertEquals(1,result.size());
               LockStats stats = store.dataManager.getEnvironment().getLockStats(null);
               System.out.println("max lockers = " + stats.getMaxLockers());
               System.out.println("# lockers = " + stats.getNumLockers());
               System.out.println("max locks = " + stats.getMaxLocks());
               System.out.println("# locks = " + stats.getNumLocks());
               System.out.println("# obj waits = " + stats.getObjsWait());
               System.out.println("# txn timeouts = " + stats.getNumTxnTimeouts());
               System.out.println("# deadlocks = " + stats.getNumDeadlocks());
          store.persist(xml, "document_2");
               
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}

private class SimpleStore {
     
     private String locationName;
     private String containerName;
          private Environment environment;
          public XmlManager dataManager;
          public XmlContainer dataContainer;
          
     public SimpleStore(String location, String container) {
     super();
     initialize(location,container);
     }
     
     protected void finalize() {
     try {
          dataContainer.sync();
     close();
     } catch (Exception e) {
          e.printStackTrace();
     }
     }
     
     private void initialize(String location, String container) {
     this.locationName = location;
     this.containerName = container;
     initializeContainer();
     }
     
          private void initializeEnvironment() {
     try {
     EnvironmentConfig environmentConfiguration = new EnvironmentConfig();
     environmentConfiguration.setThreaded(true);
     environmentConfiguration.setAllowCreate(true); // If the environment does not exist, create it.
     environmentConfiguration.setInitializeLocking(true); // Turn on the locking subsystem.
     environmentConfiguration.setErrorStream(System.err); // Capture error information in more detail.
     environmentConfiguration.setInitializeCache(true);
     environmentConfiguration.setCacheSize(1024 * 1024 * 500);
     environmentConfiguration.setInitializeLogging(true); // Turn off the logging subsystem.
     environmentConfiguration.setTransactional(true); // Turn on the transactional subsystem.
     environment = new Environment(new File(locationName), environmentConfiguration);
     environment.trickleCacheWrite(20);
     } catch (Exception e) {
          e.printStackTrace();
     }     
          }
          
          private void initializeManager() {
          if (environment == null) initializeEnvironment();
     try {
     XmlManagerConfig managerConfiguration = new XmlManagerConfig();
     managerConfiguration.setAdoptEnvironment(true);
     managerConfiguration.setAllowExternalAccess(true);
     dataManager = new XmlManager(environment, managerConfiguration);
     } catch (Exception e) {
          e.printStackTrace();
     }     
          }
          
     private void initializeContainer() {
     if (dataManager == null) initializeManager();
     try {
     if (dataManager.existsContainer(containerName) != 0) {
     dataContainer = dataManager.openContainer(containerName);
     } else {
     createContainer();
     }
     } catch (Exception e) {
          e.printStackTrace();
     }     
     }
     
     private void createContainer() {
     if (dataManager == null) initializeManager();
     try {
     XmlContainerConfig config = new XmlContainerConfig();
     config.setStatisticsEnabled(XmlContainerConfig.On);
     dataContainer = dataManager.createContainer(containerName,config);
     initializeIndexes();
     } catch (Exception e) {
          e.printStackTrace();
     }     
     }
     
     private void initializeIndexes() {
     XmlIndexSpecification xmlIndexSpecification = null;
     try {
     xmlIndexSpecification = dataContainer.getIndexSpecification();
     xmlIndexSpecification.setAutoIndexing(true);
     xmlIndexSpecification.replaceDefaultIndex("node-element-presence");
     xmlIndexSpecification.addIndex("","id", "node-attribute-equality-string");
     xmlIndexSpecification.addIndex("","value", "edge-attribute-equality-double");
     XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
     dataContainer.setIndexSpecification(xmlIndexSpecification,xmlUpdateContext);
     } catch (Exception e) {
          e.printStackTrace();
     } finally {
     if (xmlIndexSpecification != null) xmlIndexSpecification.delete();
     }
     }
     
     public synchronized void close() {
          closeContainer();
          closeManager();
          }
     
          private void closeContainer() {
               try {
          if (dataContainer == null) return;
               if (dataManager == null) initializeManager();
               dataContainer.sync();
          dataContainer.delete();
          dataContainer = null;
     } catch (Exception e) {
          e.printStackTrace();
               }
          }
          
     private void closeManager() {
     if (dataManager == null) return;
     dataManager.delete();
     }     
          
     private void deleteContainer() {
     if (dataManager == null) initializeManager();
     closeContainer();
     try {
     if (dataManager.existsContainer(containerName) != 0) {
     dataManager.removeContainer(containerName);
     }
     } catch (Exception e) {
          e.printStackTrace();
     }
     }     
          
     public synchronized void delete() {
          deleteContainer();
          closeManager();
          }
     
     public synchronized void empty() {
     deleteContainer();
     createContainer();
     }
          
     public int size() {
     try {
     return this.dataContainer.getNumDocuments();
     } catch (Exception e) {
          e.printStackTrace();
          return 0;
     }
     }
     
     public synchronized boolean hasDocument(String id) {
          try {
          dataContainer.getDocument(id);
                    return true;
     } catch (XmlException e) {
     return false;
     }
          }
          
     synchronized public void persist(String xml, String id) {
     if (hasDocument(id)) removeDocument(id);
     try {
          XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
          XmlDocumentConfig documentConfiguration = new XmlDocumentConfig();
          documentConfiguration.setWellFormedOnly(true);
          dataContainer.putDocument(id.toString(), xml, xmlUpdateContext, null);
     } catch (Exception e) {
          e.printStackTrace();
               }
     }
     
     public synchronized void removeDocument(String name) {
     try {
     XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
          dataContainer.deleteDocument(name,xmlUpdateContext);
     } catch (Exception e) {
          e.printStackTrace();
     }
          }
     
     public synchronized Set<String> queryForDocumentNames(String query) {
     Set<String> names = new HashSet<String>();
     XmlResults xmlResults = null;
     XmlValue xmlValue;
     try {
     xmlResults = runQuery(query);
     xmlValue = xmlResults.next();
     while (xmlValue != null) {
     XmlDocument doc = xmlValue.asDocument();
     String name = doc.getName();
     if (! name.equals("")) names.add(name);
     xmlValue = xmlResults.next();
     }
     } catch (Exception e) {
          e.printStackTrace();
     } finally {
     if (xmlResults != null) {
          xmlResults.delete();
          System.out.println("Deleted the query results object.");
     }
     }
     return names;
     }     
     
          private XmlResults runQuery(String myQuery) {
     XmlQueryExpression xmlQueryExpression = null;
     XmlResults xmlResults = null;
     XmlQueryContext xmlQueryContext = null;
     try {
     xmlQueryContext = createQueryContext();
     xmlQueryContext.setReturnType(XmlQueryContext.Lazy);
     xmlQueryContext.setEvaluationType(XmlQueryContext.Lazy);
     xmlQueryExpression = dataManager.prepare(myQuery,xmlQueryContext);
     xmlResults = xmlQueryExpression.execute(xmlQueryContext);
     } catch (Exception e) {
          e.printStackTrace();
     } finally {
     if (xmlQueryExpression != null) xmlQueryExpression.delete();
     }
     return xmlResults;
     }     
     
          private XmlQueryContext createQueryContext() {
     XmlQueryContext xmlQueryContext = null;
               try {
          xmlQueryContext = dataManager.createQueryContext();
          xmlQueryContext.setReturnType(XmlQueryContext.LiveValues);
          xmlQueryContext.setNamespace("eg", "http://example.com/");
     } catch (Exception e) {
          e.printStackTrace();
               }
     return xmlQueryContext;
          }
     
     }

}


{code}
  • 1. Re: DB blocks writes after I run XQueries with inequality tests
    Bogdan Coman Journeyer
    Currently Being Moderated
    Hi Geoff,

    Did you progress with this issue?

    It's not clear to me, is your application a single threaded program? Or is the code you uploaded the entire test program?

    I don't see you using any transactions. This may be the issue.
    Enabling Transactions - http://docs.oracle.com/cd/E17276_01/html/gsg_xml_txn/java/enabletxn.html
    Transaction Basics - http://docs.oracle.com/cd/E17276_01/html/gsg_xml_txn/java/usingtxns.html

    Once you use transactions, you'd be able to resolve the deadlocks as explained at:
    Resolving Deadlocks - http://docs.oracle.com/cd/E17276_01/html/gsg_xml_txn/java/lockingsubsystem.html#deadlockresolve

    If you are interested to go even further and learn about how the deadlocks can be debugged, you can visit:
    Deadlock debugging - http://docs.oracle.com/cd/E17076_02/html/programmer_reference/lock_deaddbg.html

    Bogdan Coman
  • 2. Re: DB blocks writes after I run XQueries with inequality tests
    GeoffShuetrim Newbie
    Currently Being Moderated
    Bogdan,

    Sorry for the slow reply. It has taken me a long time to get a stable login to the Oracle forums (Chromium is working better for me than Firefox which was crashing the whole forum every time I tried to log in). In answer to your question, the code I uploaded is the entire test program. The program is run using JUnit 4, which I guess spawns a thread to run the method marked with the @Test annotation. That said, there is only one unit test so only the one thread is creating, accessing and then deleting the test database.

    I have modified the code to use transactions, as you suggested, adding them for all data write and read operations. They make no difference at all to the behaviour where the test locks up when trying to write the second document to the data store after having run an XQuery involving a where clause with a gt or ge operator in it.

    I will see where I get with the debugging of the deadlocking. Hopefully that is what is driving the observed behaviour.

    Regards

    Geoff Shuetrim

    Revised test code follows:
    package net.galexy.fieldguide.store.framework.tests;
    
    import java.io.File;
    import java.util.HashSet;
    import java.util.Set;
    
    import org.junit.After;
    import org.junit.Assert;
    import org.junit.Before;
    import org.junit.Test;
    
    import com.sleepycat.db.Environment;
    import com.sleepycat.db.EnvironmentConfig;
    import com.sleepycat.db.LockStats;
    import com.sleepycat.dbxml.XmlContainer;
    import com.sleepycat.dbxml.XmlContainerConfig;
    import com.sleepycat.dbxml.XmlDocument;
    import com.sleepycat.dbxml.XmlDocumentConfig;
    import com.sleepycat.dbxml.XmlException;
    import com.sleepycat.dbxml.XmlIndexSpecification;
    import com.sleepycat.dbxml.XmlManager;
    import com.sleepycat.dbxml.XmlManagerConfig;
    import com.sleepycat.dbxml.XmlQueryContext;
    import com.sleepycat.dbxml.XmlQueryExpression;
    import com.sleepycat.dbxml.XmlResults;
    import com.sleepycat.dbxml.XmlTransaction;
    import com.sleepycat.dbxml.XmlUpdateContext;
    import com.sleepycat.dbxml.XmlValue;
    
    /**
     * Checks what constitutes a valid document name in 
     * the Berkeley XML database.
     * @author geoff
     */
    public class OracleBerkeleyXMLDatabaseInequalityQueryTests {
    
         private String xml = "<?xml version='1.0' encoding='UTF-8'?>" +
                   "<eg:root xmlns:eg='http://example.com/'>" +
                   "<eg:child value='3.0'/>" +
                   "</eg:root>";
         
         private String databaseFolder = "/home/geoff/Documents/temp/dbxml";
         private String containerName = "test.dbxml";
         
         private SimpleStore store;
         
        @Before
        public void setUp() {
              store = new SimpleStore(databaseFolder,containerName);
        }
    
        @After
        public void tearDown() {
            try {
                 System.out.println("Deleting the data store.");
                store.delete();
            } catch (Exception e) {
                e.printStackTrace();
                Assert.fail("The store could not be deleted.");
            }
        }
    
        @Test
        public void testGreaterThanQueryWithNoResults_BlocksLaterWrites() {
            try {
                  Assert.assertEquals(0, store.size());
                  store.persist(xml, "document_1");
                  Assert.assertEquals(1, store.size());
                  String query = "for $child in collection('"+containerName+"')/eg:root/eg:child where (xs:double($child/@value) ge xs:double(3.0)) return $child";
                  Set<String> result = store.queryForDocumentNames(query);
                   for (String name: result) {
                        System.out.println("Retrieved " + name);
                   }
                   Assert.assertEquals(1,result.size());
                   LockStats stats = store.dataManager.getEnvironment().getLockStats(null);
                   System.out.println("max lockers = " + stats.getMaxLockers());
                   System.out.println("# lockers = " + stats.getNumLockers());
                   System.out.println("max locks = " + stats.getMaxLocks());
                   System.out.println("# locks = " + stats.getNumLocks());
                   System.out.println("# obj waits = " + stats.getObjsWait());
                   System.out.println("# txn timeouts = " + stats.getNumTxnTimeouts());
                   System.out.println("# deadlocks = " + stats.getNumDeadlocks());
                  store.persist(xml, "document_2");
                   
            } catch (Exception e) {
                e.printStackTrace();
                Assert.fail();
            }
        }    
        
        private class SimpleStore {
         
             private String locationName;
             private String containerName;
              private Environment environment;
              public XmlManager dataManager;
              public XmlContainer dataContainer;
              
             public SimpleStore(String location, String container) {
                 super();
                 initialize(location,container);
             }
                 
             protected void finalize() {
                 try {
                      dataContainer.sync();
                     close();
                 } catch (Exception e) {
                      e.printStackTrace();
                 }
             }
         
             private void initialize(String location, String container) {        
                 this.locationName = location;
                 this.containerName = container;
                 initializeContainer();
             }
                 
              private void initializeEnvironment() {
                 try {
                     EnvironmentConfig environmentConfiguration = new EnvironmentConfig();
                     environmentConfiguration.setThreaded(true);
                     environmentConfiguration.setAllowCreate(true);         // If the environment does not exist, create it.
                     environmentConfiguration.setInitializeLocking(true);   // Turn on the locking subsystem.
                     environmentConfiguration.setErrorStream(System.err);   // Capture error information in more detail.
                     environmentConfiguration.setInitializeCache(true);
                     environmentConfiguration.setCacheSize(1024 * 1024 * 500);
                     environmentConfiguration.setInitializeLogging(true);   // Turn off the logging subsystem.
                     environmentConfiguration.setTransactional(true);       // Turn on the transactional subsystem.
                     environment = new Environment(new File(locationName), environmentConfiguration);
                     environment.trickleCacheWrite(20);
                 } catch (Exception e) {
                      e.printStackTrace();
                 }         
              }
              
              private void initializeManager() {
                  if (environment == null) initializeEnvironment();
                 try {
                     XmlManagerConfig managerConfiguration = new XmlManagerConfig();
                     managerConfiguration.setAdoptEnvironment(true);
                     managerConfiguration.setAllowExternalAccess(true);
                     dataManager = new XmlManager(environment, managerConfiguration);
                 } catch (Exception e) {
                      e.printStackTrace();
                 }         
              }
              
             private void initializeContainer() {
                 if (dataManager == null) initializeManager();
                 try {
                     if (dataManager.existsContainer(containerName) != 0) {
                         dataContainer = dataManager.openContainer(containerName);
                     } else {
                         createContainer();
                     }
                 } catch (Exception e) {
                      e.printStackTrace();
                 }         
             }
             
             private void createContainer() {
                 if (dataManager == null) initializeManager();
                 try {
                     XmlContainerConfig config = new XmlContainerConfig();
                     config.setStatisticsEnabled(XmlContainerConfig.On);
                     config.setTransactional(true);
                     dataContainer = dataManager.createContainer(containerName,config);
                     initializeIndexes();
                 } catch (Exception e) {
                      e.printStackTrace();
                 }         
             }
         
             private void initializeIndexes() {
                 XmlIndexSpecification xmlIndexSpecification = null;
                 XmlTransaction txn = null;
                  try {
                      txn = dataManager.createTransaction();
                     xmlIndexSpecification = dataContainer.getIndexSpecification();
                     xmlIndexSpecification.setAutoIndexing(true);
                     xmlIndexSpecification.replaceDefaultIndex("node-element-presence");
                     xmlIndexSpecification.addIndex("","id", "node-attribute-equality-string");
                     xmlIndexSpecification.addIndex("","value", "edge-attribute-equality-double");
                     XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
                     dataContainer.setIndexSpecification(txn,xmlIndexSpecification,xmlUpdateContext);
                     txn.commit();
                 } catch (Exception e) {
                      e.printStackTrace();
                       try {
                            if (txn != null) txn.abort();
                       } catch (XmlException x) {
                            x.printStackTrace();
                       }
                 } finally {
                     if (xmlIndexSpecification != null) xmlIndexSpecification.delete();
                 }
             }
             
             public synchronized void close() {
                  closeContainer();
                  closeManager();
              }
         
              private void closeContainer() {
                   try {
                      if (dataContainer == null) return;
                       if (dataManager == null) initializeManager();
                       dataContainer.sync();
                      dataContainer.delete();
                      dataContainer = null;
                 } catch (Exception e) {
                      e.printStackTrace();
                   }
              }
              
             private void closeManager() {
                 if (dataManager == null) return;
                 dataManager.delete();
             }     
              
             private void deleteContainer() {
                 if (dataManager == null) initializeManager();
                 closeContainer();
                 try {
                     if (dataManager.existsContainer(containerName) != 0) {
                         dataManager.removeContainer(containerName);
                     }
                 } catch (Exception e) {
                      e.printStackTrace();
                 }
             }     
              
             public synchronized void delete() {
                  deleteContainer();
                  closeManager();
              }
             
             public synchronized void empty() {
                 deleteContainer();
                 createContainer();
             }    
                  
             public int size() {
                 XmlTransaction txn = null;
                  try {
                      txn = dataManager.createTransaction();
                     int result = this.dataContainer.getNumDocuments(txn);
                     txn.commit();
                     return result;
                 } catch (Exception e) {
                      e.printStackTrace();
                       try {
                            if (txn != null) txn.abort();
                       } catch (XmlException x) {
                            x.printStackTrace();
                       }
                      return 0;
                 }
             }    
             
             public synchronized boolean hasDocument(String id) {
                 XmlTransaction txn = null;
                  try {
                      txn = dataManager.createTransaction();
                      dataContainer.getDocument(txn, id);
                      txn.commit();
                        return true;
                 } catch (XmlException e) {
                       try {
                            if (txn != null) txn.abort();
                       } catch (XmlException x) {
                            x.printStackTrace();
                       }
                     return false;
                 }
              }
              
             synchronized public void persist(String xml, String id) {
                 if (hasDocument(id)) removeDocument(id);
                 XmlTransaction txn = null;
                 try {
                      txn = dataManager.createTransaction();
                      XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
                      XmlDocumentConfig documentConfiguration = new XmlDocumentConfig();
                      documentConfiguration.setWellFormedOnly(true);
                      dataContainer.putDocument(txn, id.toString(), xml, xmlUpdateContext, null);
                      txn.commit();
                 } catch (Exception e) {
                      e.printStackTrace();
                       try {
                            if (txn != null) txn.abort();
                       } catch (XmlException x) {
                            x.printStackTrace();
                       }
                   }
             }    
         
              public synchronized void removeDocument(String name) {
                 try {
                      XmlUpdateContext xmlUpdateContext = dataManager.createUpdateContext();
                      dataContainer.deleteDocument(name,xmlUpdateContext);
                 } catch (Exception e) {
                      e.printStackTrace();
                 }
              }
         
             public synchronized Set<String> queryForDocumentNames(String query) {
                 Set<String> names = new HashSet<String>();
                 XmlResults xmlResults = null;
                 XmlValue xmlValue;
                 Results results = null;
                 try {
                     results = runQuery(query);
                     xmlResults = results.getResults();
                     xmlValue = xmlResults.next();
                     while (xmlValue != null) {
                         XmlDocument doc = xmlValue.asDocument();
                         String name = doc.getName();
                         if (! name.equals("")) names.add(name);
                         xmlValue = xmlResults.next();
                     }
                     results.getTxn().commit();
                 } catch (Exception e) {
                       e.printStackTrace();
                       try {
                            if (results != null) results.getTxn().abort();
                       } catch (XmlException x) {
                            x.printStackTrace();
                       }
                 } finally {
                     if (xmlResults != null) {
                          xmlResults.delete();
                          System.out.println("Deleted the query results object.");
                     }
                 }
                 return names;
             }     
         
              private Results runQuery(String myQuery) {
                   
                 XmlQueryExpression xmlQueryExpression = null;
                 XmlResults xmlResults = null;       
                 XmlQueryContext xmlQueryContext = null;
                 XmlTransaction txn = null;
                 try {
                        txn = dataManager.createTransaction();
                     xmlQueryContext = createQueryContext();
                     xmlQueryContext.setReturnType(XmlQueryContext.Lazy);
                     xmlQueryContext.setEvaluationType(XmlQueryContext.Lazy);
                     xmlQueryExpression = dataManager.prepare(myQuery,xmlQueryContext);
                     xmlResults = xmlQueryExpression.execute(txn, xmlQueryContext);
                 } catch (Exception e) {
                       e.printStackTrace();
                 } finally {
                     if (xmlQueryExpression != null) xmlQueryExpression.delete();
                 }
                 return new Results(txn,xmlResults);
             }     
         
              private XmlQueryContext createQueryContext() {
                 XmlQueryContext xmlQueryContext = null;
                   try {
                      xmlQueryContext = dataManager.createQueryContext();
                      xmlQueryContext.setReturnType(XmlQueryContext.LiveValues);
                      xmlQueryContext.setNamespace("eg", "http://example.com/");
                 } catch (Exception e) {
                       e.printStackTrace();
                   } 
                 return xmlQueryContext;
              }
             
         }
        
        private class Results {
             private XmlTransaction txn;
             private XmlResults results;
              public XmlTransaction getTxn() {
                   return txn;
              }
              public XmlResults getResults() {
                   return results;
              }
              public Results(XmlTransaction txn, XmlResults results) {
                   super();
                   this.txn = txn;
                   this.results = results;
              }
        }
        
    }
    Edited by: Geoff Shuetrim on Dec 22, 2011 12:16 PM
  • 3. Re: DB blocks writes after I run XQueries with inequality tests
    Oracle, Sandra Whitman Journeyer
    Currently Being Moderated
    Hello,

    Before I try your test, Berkeley DB XML is currently at version 2.5.16. The release contains the
    Berkeley DB library. Which version of Berkeley DB XML are you running and which version of
    Berkeley DB Core is the BDB XML product making use of?

    Thanks,
    Sandra

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points