mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-24 03:06:48 +01:00
fc3d826d7f
This commit changes background merge algorithm, so it becomes compatible with Windows file semantics. The previous algorithm for background merge: 1. Merge source parts into a destination part inside tmp directory. 2. Create a file in txn directory with instructions on how to atomically swap source parts with the destination part. 3. Perform instructions from the file. 4. Delete the file with instructions. This algorithm guarantees that either source parts or destination part is visible in the partition after unclean shutdown at any step above, since the remaining files with instructions is replayed on the next restart, after that the remaining contents of the tmp directory is deleted. Unfortunately this algorithm doesn't work under Windows because it disallows removing and moving files, which are in use. So the new algorithm for background merge has been implemented: 1. Merge source parts into a destination part inside the partition directory itself. E.g. now the partition directory may contain both complete and incomplete parts. 2. Atomically update the parts.json file with the new list of parts after the merge, e.g. remove the source parts from the list and add the destination part to the list before storing it to parts.json file. 3. Remove the source parts from disk when they are no longer used. This algorithm guarantees that either source parts or destination part is visible in the partition after unclean shutdown at any step above, since incomplete partitions from step 1 or old source parts from step 3 are removed on the next startup by inspecting parts.json file. This algorithm should work under Windows, since it doesn't remove or move files in use. This algorithm has also the following benefits: - It should work better for NFS. - It fits object storage semantics. The new algorithm changes data storage format, so it is impossible to downgrade to the previous versions of VictoriaMetrics after upgrading to this algorithm. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3236 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3821 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/70
105 lines
2.9 KiB
Makefile
105 lines
2.9 KiB
Makefile
# All these commands must run from repository root.
|
|
|
|
run-vmstorage:
|
|
mkdir -p vmstorage-data
|
|
DOCKER_OPTS='-v $(shell pwd)/vmstorage-data:/vmstorage-data' \
|
|
APP_NAME=vmstorage \
|
|
ARGS='-retentionPeriod=12' \
|
|
$(MAKE) run-via-docker
|
|
|
|
vmstorage:
|
|
APP_NAME=vmstorage $(MAKE) app-local
|
|
|
|
vmstorage-race:
|
|
APP_NAME=vmstorage RACE=-race $(MAKE) app-local
|
|
|
|
vmstorage-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker
|
|
|
|
vmstorage-pure-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-pure
|
|
|
|
vmstorage-linux-amd64-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-linux-amd64
|
|
|
|
vmstorage-linux-arm-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-linux-arm
|
|
|
|
vmstorage-linux-arm64-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-linux-arm64
|
|
|
|
vmstorage-linux-ppc64le-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-linux-ppc64le
|
|
|
|
vmstorage-linux-386-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-linux-386
|
|
|
|
vmstorage-freebsd-amd64-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-freebsd-amd64
|
|
|
|
vmstorage-openbsd-amd64-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-openbsd-amd64
|
|
|
|
vmstorage-windows-amd64-prod:
|
|
APP_NAME=vmstorage $(MAKE) app-via-docker-windows-amd64
|
|
|
|
vmstorage-prod-race:
|
|
APP_NAME=vmstorage RACE=-race $(MAKE) app-via-docker
|
|
|
|
package-vmstorage:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker
|
|
|
|
package-vmstorage-race:
|
|
APP_NAME=vmstorage RACE=-race $(MAKE) package-via-docker
|
|
|
|
package-vmstorage-amd64:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker-amd64
|
|
|
|
package-vmstorage-arm:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker-arm
|
|
|
|
package-vmstorage-arm64:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker-arm64
|
|
|
|
package-vmstorage-ppc64le:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker-ppc64le
|
|
|
|
package-vmstorage-386:
|
|
APP_NAME=vmstorage $(MAKE) package-via-docker-386
|
|
|
|
publish-vmstorage:
|
|
APP_NAME=vmstorage $(MAKE) publish-via-docker
|
|
|
|
publish-vmstorage-race:
|
|
APP_NAME=vmstorage RACE=-race $(MAKE) publish-via-docker
|
|
|
|
vmstorage-linux-amd64:
|
|
APP_NAME=vmstorage CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-linux-arm:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=linux GOARCH=arm $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-linux-arm64:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-linux-ppc64le:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-linux-s390x:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=linux GOARCH=s390x $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-linux-386:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=linux GOARCH=386 $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-freebsd-amd64:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-openbsd-amd64:
|
|
APP_NAME=vmstorage CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 $(MAKE) app-local-goos-goarch
|
|
|
|
vmstorage-windows-amd64:
|
|
GOARCH=amd64 APP_NAME=vmstorage $(MAKE) app-local-windows-goarch
|
|
|
|
vmstorage-pure:
|
|
APP_NAME=vmstorage $(MAKE) app-local-pure
|