mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
6b9f57e5f7
Some checks are pending
build / Build (push) Waiting to run
CodeQL Go / Analyze (push) Waiting to run
main / lint (push) Waiting to run
main / test (test-full) (push) Blocked by required conditions
main / test (test-full-386) (push) Blocked by required conditions
main / test (test-pure) (push) Blocked by required conditions
publish-docs / Build (push) Waiting to run
This commit fixes the TestStorageRotateIndexDB flaky test reported at: #6977. Sample test failure: https://pastebin.com/bTSs8HP1 The test fails because one goroutine adds items to the indexDB table while another goroutine is closing that table. This may happen if indexDB rotation happens twice during one Storage.add() operation: - Storage.add() takes the current indexDB and adds index recods to it - First index db rotation makes the current index DB a previous one (still ok at this point) - Second index db rotation removes the indexDB that was current two rotations earlier. It does this by setting the mustDrop flag to true and decrementing the ref counter. The ref counter reaches zero which cases the underlying indexdb table to release its resources gracefully. Graceful release assumes that the table is not written anymore. But Storage.add() still adds items to it. The solution is to increment the indexDB ref counters while it is used inside add(). The unit test has been changed a little so that the test fails reliably. The idea is to make add() function invocation to last much longer, therefore the test inserts not just one record at a time but thouthands of them. To see the test fail, just replace the idbsLocked() func with: ```go unc (s *Storage) idbsLocked2() (*indexDB, *indexDB, func()) { return s.idbCurr.Load(), s.idbNext.Load(), func() {} } ``` --------- Signed-off-by: Artem Fetishev <rtm@victoriametrics.com> |
||
---|---|---|
.. | ||
block_header_test.go | ||
block_header.go | ||
block_stream_merger.go | ||
block_stream_reader_test.go | ||
block_stream_reader_timing_test.go | ||
block_stream_reader.go | ||
block_stream_writer_timing_test.go | ||
block_stream_writer.go | ||
block_test.go | ||
block.go | ||
dedup_test.go | ||
dedup_timing_test.go | ||
dedup.go | ||
filenames.go | ||
index_db_test.go | ||
index_db_timing_test.go | ||
index_db.go | ||
inmemory_part_test.go | ||
inmemory_part_timing_test.go | ||
inmemory_part.go | ||
merge_test.go | ||
merge_timing_test.go | ||
merge.go | ||
metaindex_row_test.go | ||
metaindex_row.go | ||
metric_name_test.go | ||
metric_name.go | ||
part_header.go | ||
part_search_test.go | ||
part_search_timing_test.go | ||
part_search.go | ||
part.go | ||
partition_search_test.go | ||
partition_search.go | ||
partition_test.go | ||
partition.go | ||
raw_block.go | ||
raw_row.go | ||
search_test.go | ||
search.go | ||
storage_test.go | ||
storage_timing_test.go | ||
storage.go | ||
table_search_test.go | ||
table_search_timing_test.go | ||
table_search.go | ||
table_test.go | ||
table_timing_test.go | ||
table.go | ||
tag_filters_test.go | ||
tag_filters_timing_test.go | ||
tag_filters.go | ||
time_test.go | ||
time.go | ||
tsid_test.go | ||
tsid.go |