Strabon

changeset 39:9c76014791c3

Fixed issue with MonetDB during store.
author Babis Nikolaou <charnik@di.uoa.gr>
date Mon Mar 05 20:26:53 2012 +0200 (2012-03-05)
parents 20d879e39a63
children 788b5325ef9e
files generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TransTableManager.java generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleTableManager.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TransTableManager.java	Sun Mar 04 00:46:25 2012 +0200
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TransTableManager.java	Mon Mar 05 20:26:53 2012 +0200
     1.3 @@ -238,13 +238,14 @@
     1.4  	protected String getZeroBigInt() {
     1.5  		return "0";
     1.6  	}
     1.7 -
     1.8 +	
     1.9  	protected TransactionTable getTable(Number pred)
    1.10  	throws SQLException
    1.11  	{
    1.12  		synchronized (tables) {
    1.13  			TransactionTable table = tables.get(pred);
    1.14  			if (table == null) {
    1.15 +				triples.flushManagers();// charnik's addition (see flushManagers() method for details)
    1.16  				TripleTable predicate = triples.getPredicateTable(pred);
    1.17  				Number key = pred;
    1.18  				if (predicate.isPredColumnPresent()) {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleTableManager.java	Sun Mar 04 00:46:25 2012 +0200
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleTableManager.java	Mon Mar 05 20:26:53 2012 +0200
     2.3 @@ -472,4 +472,32 @@
     2.4  	{
     2.5  		return hashes;
     2.6  	}
     2.7 +	
     2.8 +	/**
     2.9 +	 * @author charnik
    2.10 +	 * This method should be used only for flushing prepared statements 
    2.11 +	 * related to hash values. Introduced to avoid exceptions in MonetDB
    2.12 +	 * when a new predicate has to be inserted and the underlying relational
    2.13 +	 * table does not exist. In such a case, the prepared statement for the
    2.14 +	 * creation of the table was making MonetDB to release all prepared statements
    2.15 +	 * that have already been created but not executed.
    2.16 +	 * 
    2.17 +	 * FIXME: Should it throw those exceptions? 
    2.18 +	 */
    2.19 +	public void flushManagers() {
    2.20 +		try {
    2.21 +			hashes.flush();
    2.22 +			uris.flush();
    2.23 +			literals.flush();
    2.24 +			bnodes.flush();
    2.25 +			
    2.26 +		} catch (SQLException e) {
    2.27 +			// TODO Auto-generated catch block
    2.28 +			e.printStackTrace();
    2.29 +		} catch (InterruptedException e) {
    2.30 +			// TODO Auto-generated catch block
    2.31 +			e.printStackTrace();
    2.32 +		}
    2.33 +		
    2.34 +	}
    2.35  }