Skip to content

Commit 3c9e8c2

Browse files
authored
fix(sentry-data): Don't migrate when not needed (getsentry#297)
With this patch, `./install.sh` becomes safer as it won't recursively move things under `/data/file`. It also won't try to migrate an empty volume.
1 parent 4af4ecf commit 3c9e8c2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

install.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ until $(docker-compose run --rm clickhouse clickhouse-client -h clickhouse --que
130130
done;
131131
echo ""
132132

133-
echo "Migrating file storage..."
134-
docker run --rm -v sentry-data:/data alpine ash -c \
135-
"mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"
133+
SENTRY_DATA_NEEDS_MIGRATION=$(docker run --rm -v sentry-data:/data alpine ash -c "[ ! -d '/data/files' ] && ls -A1x /data | wc -l")
134+
if [ "$SENTRY_DATA_NEEDS_MIGRATION" ]; then
135+
echo "Migrating file storage..."
136+
docker run --rm -v sentry-data:/data alpine ash -c \
137+
"mkdir -p /tmp/files; mv /data/* /tmp/files/; mv /tmp/files /data/files"
138+
fi
136139

137140
cleanup
138141

0 commit comments

Comments
 (0)