Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • slapos slapos
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 129
    • Merge requests 129
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • slaposslapos
  • Merge requests
  • !997

ERP5: fix mariadb init

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Xavier Thompson requested to merge xavier_thompson/slapos:erp5_fix_mariadb_init into master Jun 14, 2021
  • Overview 1
  • Commits 2
  • Pipelines 0
  • Changes 2

Previously the mariadb service worked on this assumption:

  • if ~/srv/mariadb exists then its contents are in a valid state
  • if it doesn't exist then it must be created and initialized

The initialization was first made in a temporary directory, and then /bin/mv was used to atomically move it to ~/srv/mariadb. This way if the initialization fails in the middle we don't end up with a miss-initialized ~/srv/mariadb directory.

However this approach had some issues: mv only works if ~/srv/mariadb is a simple directory: it fails if it's a symlink, a mount point, or a subvolume (btrfs).

Now the mariadb service works on these assumptions instead:

  • if ~/srv/mariadb/mysql exists and ~/srv/mariadb/.slapos_initializing does not exists then its in a valid state
  • else ~/srv/mariadb must be emptied (or created) and reinitialized

The initialization now starts by emptying (or creating) ~/srv/mariadb and then creating the marker file ~/srv/mariadb/.slapos_initializing. The marker file is atomically removed at the end of a successful initialization using /bin/rm.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: erp5_fix_mariadb_init
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7