mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
43b24164ef
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 |
||
---|---|---|
.. | ||
block.go | ||
block_header.go | ||
block_header_test.go | ||
block_stream_merger.go | ||
block_stream_reader.go | ||
block_stream_reader_test.go | ||
block_stream_reader_timing_test.go | ||
block_stream_writer.go | ||
block_stream_writer_timing_test.go | ||
block_test.go | ||
dedup.go | ||
dedup_test.go | ||
dedup_timing_test.go | ||
index_db.go | ||
index_db_test.go | ||
index_db_timing_test.go | ||
inmemory_part.go | ||
inmemory_part_test.go | ||
inmemory_part_timing_test.go | ||
merge.go | ||
merge_test.go | ||
merge_timing_test.go | ||
metaindex_row.go | ||
metaindex_row_test.go | ||
metric_name.go | ||
metric_name_test.go | ||
part.go | ||
part_header.go | ||
part_search.go | ||
part_search_test.go | ||
part_search_timing_test.go | ||
partition.go | ||
partition_search.go | ||
partition_search_test.go | ||
partition_test.go | ||
raw_block.go | ||
raw_row.go | ||
search.go | ||
search_test.go | ||
storage.go | ||
storage_test.go | ||
storage_timing_test.go | ||
table.go | ||
table_search.go | ||
table_search_test.go | ||
table_search_timing_test.go | ||
table_test.go | ||
table_timing_test.go | ||
tag_filters.go | ||
tag_filters_test.go | ||
tag_filters_timing_test.go | ||
time.go | ||
time_test.go | ||
tsid.go | ||
tsid_test.go |