public class PostgreSQLIndexSynchronizer
extends java.lang.Object
| Constructor and Description |
|---|
PostgreSQLIndexSynchronizer(PostgreSQL _pg,
PostgreSQLMigrationContext _ctx) |
| Modifier and Type | Method and Description |
|---|---|
void |
determineHighestIndexNumber()
Fetches all existing tables and coordinates the underlying PostgreSQLIndex
to adjust its internal tracking of the highest used custom index number.
|
void |
dropAllIndexesForTable(java.lang.String tableName)
Drops all existing indices for a specific table.
|
void |
generateIndexes(SchemaI schema,
boolean nonDestructive)
Coordinates the generation, verification, and cleanup of indices across all
persistent entities in the schema.
|
void |
generateIndexesPost(boolean nonDestructive)
Executes pending index additions and removals sequentially.
|
java.util.Map<java.lang.String,PostgreSQLIndex> |
generatePostgreSQLIndexesForEntity(CBOEntity entity)
Generates the expected PostgreSQL indices for an entity based on its attributes
and cross-checks them against the currently existing indices in the database.
|
java.util.Map<java.lang.String,PostgreSQLIndex> |
getIndexesForTableJDBC(java.lang.String tableName)
Retrieves all existing indices for a given table from the pre-loaded
database catalog map (cached via
initAllExistingIndexesMapForAllEntities). |
java.lang.String |
getKey(CBOAttribute att)
Constructs a unique string key for an index to map definitions to physical tables.
|
void |
markSuperfluousIndexesForRemoval(java.util.Collection indexes)
Marks indices that exist in the database but are no longer defined in the schema
for deletion (unless strict mode is deactivated).
|
public PostgreSQLIndexSynchronizer(PostgreSQL _pg, PostgreSQLMigrationContext _ctx)
public void determineHighestIndexNumber()
public java.util.Map<java.lang.String,PostgreSQLIndex> generatePostgreSQLIndexesForEntity(CBOEntity entity)
Uses a 3-pass system (Determine definitions, Flag deletions, Flag creations) to avoid duplicate processing.
entity - The entity whose indices should be verified/generated.public java.lang.String getKey(CBOAttribute att)
PostgreSQLIndex#getKey.att - The attribute representing the indexed column.public void markSuperfluousIndexesForRemoval(java.util.Collection indexes)
indexes - The collection of obsolete indexes discovered during analysis.public void generateIndexes(SchemaI schema, boolean nonDestructive)
schema - The schema containing the definitions.nonDestructive - If true, destructive actions (dropping indexes) are bypassed.public void generateIndexesPost(boolean nonDestructive)
CRITICAL CONCURRENCY WARNING:
job.setSequential(1) MUST remain set to 1! The getConn() method returns
the defaultConnection, which is NOT thread-safe for concurrent DDL changes.
If parallel index updates are ever enabled, each thread MUST obtain an isolated,
fresh connection from the pool.
nonDestructive - If true, no index modifications are executed.public void dropAllIndexesForTable(java.lang.String tableName)
tableName - The table whose indexes should be purged.public java.util.Map<java.lang.String,PostgreSQLIndex> getIndexesForTableJDBC(java.lang.String tableName)
initAllExistingIndexesMapForAllEntities).tableName - The table name.Copyright © 2000-2026 OAshi S.à r.l. All Rights Reserved.