VictoriaMetrics/app
Aliaksandr Valialkin 43b24164ef
all: add Windows build for VictoriaMetrics
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
2023-03-19 01:36:51 -07:00
..
victoria-metrics all: add Windows build for VictoriaMetrics 2023-03-19 01:36:51 -07:00
vmagent all: follow-up for 7a3e16e774 2023-03-08 01:26:55 -08:00
vmalert Vmalert tests (#3975) 2023-03-17 15:57:24 +01:00
vmauth all: follow-up for 7a3e16e774 2023-03-08 01:26:55 -08:00
vmbackup all: add makefile rules for GOARCH=s390x for all the VictoriaMetrics components 2023-02-26 12:36:51 -08:00
vmbackupmanager doc: add vmbackupmanager monitoring section (#3605) 2023-01-05 16:03:06 +01:00
vmctl app/vmctl: integration test for native protocol (#3947) 2023-03-14 09:55:49 +01:00
vmgateway app/vmgateway: add new flag doc 2023-02-27 11:18:34 -08:00
vminsert app/vmagent: automatically detect whether the remote storage supports VictoriaMetrics remote write protocol 2023-02-23 17:36:55 -08:00
vmrestore all: add makefile rules for GOARCH=s390x for all the VictoriaMetrics components 2023-02-26 12:36:51 -08:00
vmselect app/vmselect/promql: add test to ensure 8-byte alignment (#3948) 2023-03-16 09:01:42 -07:00
vmstorage lib/storage: follow-up for 39cdc546dd 2023-02-27 13:07:38 -08:00
vmui vmui: predefined dashboards docs (#3895) 2023-03-12 17:16:26 -07:00