DataGrip Schema Synchronization Missing Exclusive Metadata Lock Option
0 reputation · 07 Nov 2021, 08:41 UTC
DataGrip's Schema Synchronization wizard generates SQL scripts that can run inside a transaction and leverage online DDL hints such as ALGORITHM=INPLACE for MySQL or CONCURRENTLY for PostgreSQL. This enables structural changes with minimal blocking for read and write workloads.
However, the tool does not automatically acquire a short‑term exclusive metadata lock before executing the script, nor does it surface a configuration toggle to request one. It also provides no warning when another session holds or requests a conflicting DDL lock on the same objects during synchronization.
Without an explicit lock acquisition step or a guardrail setting, the generated script may wait indefinitely for a metadata lock or fail mid‑run if a concurrent ALTER TABLE executes in parallel. This behavior is version‑dependent: MySQL 5.6+ and PostgreSQL 12+ support non‑blocking DDL, but older versions or SQL Server still require full table locks that DataGrip does not detect.
Is there a supported way to configure DataGrip to prepend an explicit LOCK TABLES or pg_advisory_xact_lock call before the synchronization script runs? Does the IDE expose any hidden option under Tools → Database → Data Extractors and Synchronization → Options to enable automatic metadata lock acquisition? How can a team verify that the generated script will not contend with concurrent DDL in a production environment without a maintenance window?