Class DeleteNotExistsV3Executor
java.lang.Object
org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor
org.alfresco.repo.domain.schema.script.DeleteNotExistsV3Executor
- All Implemented Interfaces:
StatementExecutor
Same logic as DeleteNotExistsExecutor with the following changes:
- filters the queries by unique values
- eager close of result sets
- we store all the ids in memory and process them from there - the secondary ids are stored in a unique list without
duplicate values.
- we only cross 2 sets (the potential ids to delete from the primary table with the set of all secondary ids in that
range) removing all elements from the second set from the first set
- every {pauseAndRecoverBatchSize} rows deleted we close all prepared statements and close the connection and sleep
for {pauseAndRecoverTime} milliseconds. This is necessary to allow the DBMS to perform the background tasks without
load from ACS. When we do not do this and if we are performing millions of deletes, the connection eventually gets
aborted.
- Author:
- Eva Vasques
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final Stringstatic final StringFields inherited from class org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor
batchSize, connection, deleteBatchSize, deletedCount, globalProperties, PROPERTY_BATCH_SIZE, PROPERTY_DELETE_BATCH_SIZE, PROPERTY_READ_ONLY, PROPERTY_TIMEOUT_SECONDS, readOnly, startTime -
Constructor Summary
ConstructorsConstructorDescriptionDeleteNotExistsV3Executor(Dialect dialect, Connection connection, String sql, int line, File scriptFile, Properties globalProperties, DataSource dataSource) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseQuietly(Connection connection) protected StringcreatePreparedSelectStatement(String tableName, String columnName, String whereClause) voidexecute()protected voidprotected voidprocess(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses, Long skipToId) protected LongprocessPrimaryTableResultSet(PreparedStatement primaryPrepStmt, PreparedStatement[] secondaryPrepStmts, PreparedStatement deletePrepStmt, Set<Long> deleteIds, String primaryTableName, String primaryColumnName, Pair<String, String>[] tableColumn) Methods inherited from class org.alfresco.repo.domain.schema.script.DeleteNotExistsExecutor
checkProperties, closeQuietly, closeQuietly, closeQuietly, closeQuietly, createPreparedDeleteStatement, deleteFromPrimaryTable, getColumnValueById, getSecondaryIds, getSecondaryResultSets, isLess, isTimeoutExceeded
-
Field Details
-
PROPERTY_PAUSE_AND_RECOVER_BATCHSIZE
- See Also:
-
PROPERTY_PAUSE_AND_RECOVER_TIME
- See Also:
-
DEFAULT_PAUSE_AND_RECOVER_BATCHSIZE
public static final long DEFAULT_PAUSE_AND_RECOVER_BATCHSIZE- See Also:
-
DEFAULT_PAUSE_AND_RECOVER_TIME
public static final long DEFAULT_PAUSE_AND_RECOVER_TIME- See Also:
-
-
Constructor Details
-
DeleteNotExistsV3Executor
public DeleteNotExistsV3Executor(Dialect dialect, Connection connection, String sql, int line, File scriptFile, Properties globalProperties, DataSource dataSource)
-
-
Method Details
-
execute
- Specified by:
executein interfaceStatementExecutor- Overrides:
executein classDeleteNotExistsExecutor- Throws:
Exception
-
process
protected void process(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses) throws SQLException- Overrides:
processin classDeleteNotExistsExecutor- Throws:
SQLException
-
process
protected void process(Pair<String, String>[] tableColumn, Long[] tableUpperLimits, String[] optionalWhereClauses, Long skipToId) throws SQLException- Overrides:
processin classDeleteNotExistsExecutor- Throws:
SQLException
-
createPreparedSelectStatement
protected String createPreparedSelectStatement(String tableName, String columnName, String whereClause) - Overrides:
createPreparedSelectStatementin classDeleteNotExistsExecutor
-
processPrimaryTableResultSet
protected Long processPrimaryTableResultSet(PreparedStatement primaryPrepStmt, PreparedStatement[] secondaryPrepStmts, PreparedStatement deletePrepStmt, Set<Long> deleteIds, String primaryTableName, String primaryColumnName, Pair<String, String>[] tableColumn) throws SQLException- Overrides:
processPrimaryTableResultSetin classDeleteNotExistsExecutor- Throws:
SQLException
-
closeQuietly
-