fun cleanIndex( mutator: RowMutator, doType: DataObjectType, listToCleanRef: SoftReference<IndexCleanupList?> ) { val listToClean: IndexCleanupList = listToCleanRef.get() if (listToClean == null) { _log.warn( "clean up list for {} has been recycled by GC, skip it", doType.getClass().getName() ) return } val cleanList: Map<String, List<Column<CompositeColumnName>>> = listToClean.getColumnsToClean() val entryIt: Iterator<Map.Entry<String, List<Column<CompositeColumnName>>>> = cleanList.entries.iterator() val dependentFields: MutableMap<String, ColumnField> = HashMap() while (entryIt.hasNext()) { val (rowKey, cols) = entryIt.next() for (i in cols.indices) { val column: Column<CompositeColumnName> = cols[i] val field: ColumnField = doType.getColumnField(column.getName().getOne()) field.removeColumn(rowKey, column, mutator, listToClean.getAllColumns(rowKey)) for (depField in field.getDependentFields()) { dependentFields[depField.getName()] = depField } } for (depField in dependentFields.values) { depField.removeIndex( rowKey, null, mutator, listToClean.getAllColumns(rowKey), listToClean.getObject(rowKey) ) } } removeIndexOfInactiveObjects(mutator, doType, listToClean as IndexCleanupList, true) mutator.executeIndexFirst() }
Clean out old column / index entries synchronously