You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2014/05/13 12:27:00 UTC
svn commit: r1594183 -
/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Author: kayyagari
Date: Tue May 13 10:27:00 2014
New Revision: 1594183
URL: http://svn.apache.org/r1594183
Log:
o fixed the deleteUnusedIndexFiles() method, this was deleting system index files (only happens in embedded mode)
o reverted the commit made in rev. 1594050
Modified:
directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1594183&r1=1594182&r2=1594183&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Tue May 13 10:27:00 2014
@@ -179,22 +179,6 @@ public class JdbmPartition extends Abstr
indexToBuild.add( index );
}
}
-
- // Don't forget to add the system indexes
- for ( String systemIndex : Store.SYS_INDEX_OIDS )
- {
- allIndices.add( systemIndex );
-
- // take the part after removing .db from the
- String name = systemIndex + JDBM_DB_FILE_EXTN;
-
- // if the name doesn't exist in the list of index DB files
- // this is a new index and we need to build it
- if ( !indexDbFileNameList.contains( name ) )
- {
- indexToBuild.add( systemIndices.get( systemIndex ) );
- }
- }
// Initialize the indexes
super.doInit();
@@ -344,22 +328,32 @@ public class JdbmPartition extends Abstr
/**
* Builds user defined indexes on a attributes by browsing all the entries present in master db
*
- * @param userIndexes then user defined indexes to create
+ * Note: if the given list of indices contains any system index that will be skipped.
+ *
+ * WARN: MUST be called after calling super.doInit()
+ *
+ * @param indices then selected indexes that need to be built
* @throws Exception in case of any problems while building the index
*/
- private void buildUserIndex( List<Index<?, String>> userIndexes ) throws Exception
+ private void buildUserIndex( List<Index<?, String>> indices ) throws Exception
{
Cursor<Tuple<String, Entry>> cursor = master.cursor();
cursor.beforeFirst();
while ( cursor.next() )
{
- for ( Index index : userIndexes )
+ for ( Index index : indices )
{
AttributeType atType = index.getAttribute();
String attributeOid = index.getAttribute().getOid();
+ if( systemIndices.get( attributeOid ) != null )
+ {
+ // skipping building of the system index
+ continue;
+ }
+
LOG.info( "building the index for attribute type {}", atType );
Tuple<String, Entry> tuple = cursor.get();
@@ -398,6 +392,12 @@ public class JdbmPartition extends Abstr
// take the part after removing .db from the
name = name.substring( 0, name.lastIndexOf( JDBM_DB_FILE_EXTN ) );
+ if( systemIndices.get( name ) != null )
+ {
+ // do not delete the system index file
+ continue;
+ }
+
// remove the file if not found in the list of names of indices
if ( !allIndices.contains( name ) )
{