VictoriaMetrics/app/vminsert
Aliaksandr Valialkin fc3d826d7f
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 23:28:26 -07:00
..
clusternative lib/protoparser/clusternative: extract stream parsing code into a separate stream package 2023-02-13 10:38:02 -08:00
csvimport lib/protoparser/csvimport: extract stream parsing code into a separate stream package 2023-02-13 10:26:29 -08:00
datadog lib/protoparser/datadog: extract stream parsing code into a separate stream package 2023-02-13 09:53:20 -08:00
deployment Rootless docker images by default (#358) 2020-03-27 21:18:32 +02:00
graphite lib/protoparser/graphite: extract stream parsing code into a separate stream package 2023-02-13 10:33:24 -08:00
influx lib/protoparser/influx: extract stream parsing code into a separate stream package 2023-02-13 09:59:56 -08:00
multiarch all: run apk update && apk upgrade in base Alpine Docker image in order to get all the recent security fixes 2023-02-09 14:03:02 -08:00
native lib/protoparser/native: extract stream parsing code into a separate stream package 2023-02-13 10:44:27 -08:00
netstorage app/{vminsert,vmselect}: speed up TestInitStopNodes() 2022-12-03 23:53:14 -08:00
opentsdb lib/protoparser/opentsdb: extract stream parsing code into a separate stream package 2023-02-13 10:04:14 -08:00
opentsdbhttp lib/protoparser/opentsdbhttp: extract stream parsing code into a separate stream package 2023-02-13 10:15:15 -08:00
prometheusimport lib/protoparser/prometheus: move streamparser to subpackage (#3814) 2023-02-13 09:44:47 -08:00
promremotewrite app/vmagent: add support for VictoriaMetrics remote write protocol, which allows saving up to 10x on network bandwidth costs under high load 2023-02-20 18:40:40 -08:00
relabel lib/promscrape: implement target-level and metric-level relabel debugging 2022-12-10 02:25:56 -08:00
vmimport lib/protoparser/vmimport: extract stream parsing code into a separate stream package 2023-02-13 10:22:00 -08:00
main.go all: follow-up for 7a3e16e774 2023-03-08 01:42:58 -08:00
Makefile all: add Windows build for VictoriaMetrics 2023-03-19 23:28:26 -07:00
README.md all: add native format for data export and import 2020-09-27 17:36:38 +03:00

vminsert routes the ingested data to vmstorage.