![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I am implementing a Master using BDB ReplicationManager. In this class I'm opening a few tables using env.openDatabase() call. However when I try to open a table which allows duplicate records, I am getting IllegalArgumentException. If I comment this line in the below code snippet, everything works fine. As long as I use this line, I always get the above exception. dbconf.setSortedDuplicates(true); I don't know if I'm missing something. Any help is much appreciated. Code Snippet: private void initDatabase(String tableName) { Database database = null; if( cLog.isDebugEnabled() ) cLog.debug("about create database config for [" + tableName + "]"); DatabaseConfig dbconf = new DatabaseConfig(); // Set page size small so page allocation is cheap. dbconf.setPageSize(512); dbconf.setType(DatabaseType.BTREE); if (dbenv.getIsMaster()) { dbconf.setAllowCreate(true); } dbconf.setTransactional(true); dbconf.setSortedDuplicates(true); try { database = dbenv.openDatabase(null, tableName, null, dbconf); databasesMap.put(tableName, database); } catch (java.io.FileNotFoundException e) { cLog.warn( "[" + tableName + "] database is not available.", e); if (database != null) { try { database.close(true); } catch (DatabaseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } database = null; } try { Thread.sleep(someinterval); //TODO ?? } catch (InterruptedException ie) { } //return; } catch (DatabaseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } Many thanks inadvance, Prasad |
![]() |
| Thread Tools | |
| Display Modes | |
| |