Skip to content

Conversation

@awiegers
Copy link
Contributor

@awiegers awiegers commented Nov 3, 2025

It is possible for the entrypoint scripts to be run concurrently creating race conditions when the module databases are being initialized or upgraded. This PR locks those files so only one process can initialize or upgrade databases at a time. Similar to https://github.com/IQGeo/utils-docker-platform/pull/369 for the core database.

@awiegers awiegers requested a review from Copilot November 3, 2025 17:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds distributed locking mechanisms to database initialization and upgrade scripts to prevent race conditions when multiple instances attempt to initialize or upgrade the database simultaneously. The scripts now use file-based locking with flock when a shared directory is available.

  • Wraps existing database operations in functions to enable conditional execution
  • Implements file-based locking using flock when SHARED_DIRECTORY is configured
  • Falls back to direct execution when no shared directory is available

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
deployment/entrypoint.d/600_init_db.sh Adds locking mechanism to database initialization to prevent concurrent initialization attempts
deployment/entrypoint.d/610_upgrade_db.sh Adds locking mechanism to database upgrade to prevent concurrent upgrade attempts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

awiegers and others added 2 commits November 3, 2025 10:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants