fix(zookeeper): cp: cannot create regular file (#552)
Hi,
I've been through quite a few different ways of implementing this fix and settled on creating a variable to store the output of checking whether the zookeeper copy target folder exists and copying the snapshot file based on the copy target folder existing. I've ran quite a few manual tests for each option as well. Currently the PR sits on Option 3 from the below options.
Option 1
Judging from the Jira issue, it seems like the work around for zookeeper upgrades could be omitted entirely since the issue relates to upgrades from v3.4.10 to v3.5.4. I've tested removing the zookeeper workaround entirely and that install ran smoothly on a clean install of Sentry (no existing data) as well as an install of Sentry that currently has very minimal amount of log entries (roughly 100 log entries). Could we possibly remove the workaround entirely?
Option 2
The second option was to simply add a check to the currently existing line of whether the copy target folder exists and perform the snapshot file copy only if the copy target folder exists. This is the least amount of code and possibly the simpler fix while also setting the ZOOKEEPER_SNAPSHOT_TRUST_EMPTY env var to true, however, some unnecessary calculations will be done to determine the ZOOKEEPER_LOG_FILE_COUNT and ZOOKEEPER_SNAPSHOT_FILE_COUNT.
Option 3
I've created a variable to store whether the copy target folder exists and proceed with the zookeeper upgrade workaround only if the copy target folder exists. This means that if the copy target folder does not exist, the env var ZOOKEEPER_SNAPSHOT_TRUST_EMPTY will not be set.
Fixes #547.
Co-authored-by: chamirb <chamirb@globalkinetic.com>