Commit graph

172 commits

Author SHA1 Message Date
Aliaksandr Valialkin
56c115c455
wip 2024-04-30 23:03:34 +02:00
Aliaksandr Valialkin
f7dad8bd61
wip 2024-04-29 08:05:53 +02:00
Aliaksandr Valialkin
0d0804a202
wip 2024-04-29 07:54:05 +02:00
Aliaksandr Valialkin
84631d8c04
wip 2024-04-29 07:51:39 +02:00
Aliaksandr Valialkin
a2878feb1e
wip 2024-04-29 07:45:44 +02:00
Aliaksandr Valialkin
a62b0ab12b
wip 2024-04-29 07:44:23 +02:00
Aliaksandr Valialkin
65dfdda14b
wip 2024-04-29 07:42:40 +02:00
Aliaksandr Valialkin
e876b99b59
wip 2024-04-29 07:36:23 +02:00
Aliaksandr Valialkin
4e1f20338f
wip 2024-04-29 07:30:34 +02:00
Aliaksandr Valialkin
292d7fcfc6
wip 2024-04-29 07:27:45 +02:00
Aliaksandr Valialkin
bb89151ae8
wip 2024-04-29 07:21:09 +02:00
Aliaksandr Valialkin
7591f72919
wip 2024-04-29 07:15:54 +02:00
Aliaksandr Valialkin
9b5dd883b4
wip 2024-04-29 07:06:26 +02:00
Aliaksandr Valialkin
b370a785e9
wip 2024-04-29 06:49:06 +02:00
Aliaksandr Valialkin
4308f7060d
wip 2024-04-29 06:44:49 +02:00
Aliaksandr Valialkin
f49352ece4
wip 2024-04-29 06:42:18 +02:00
Aliaksandr Valialkin
ecef86c641
wip 2024-04-29 06:37:22 +02:00
Aliaksandr Valialkin
203bb5f651
wip 2024-04-29 06:35:06 +02:00
Aliaksandr Valialkin
75838f0a87
wip 2024-04-29 06:27:35 +02:00
Aliaksandr Valialkin
8d0eb0c43c
wip 2024-04-29 06:17:14 +02:00
Aliaksandr Valialkin
22615889a7
wip 2024-04-29 06:14:56 +02:00
Aliaksandr Valialkin
2a1cede9f7
wip 2024-04-29 06:01:06 +02:00
Aliaksandr Valialkin
a968561182
wip 2024-04-29 05:51:43 +02:00
Aliaksandr Valialkin
1528b379cf
wip 2024-04-29 05:42:32 +02:00
Aliaksandr Valialkin
68ec1cb1dd
wip 2024-04-29 05:04:20 +02:00
Aliaksandr Valialkin
b6a1576e0d
wip 2024-04-29 04:37:57 +02:00
Aliaksandr Valialkin
7ae71cab2e
wip 2024-04-29 04:21:40 +02:00
Aliaksandr Valialkin
89235a3489
wip 2024-04-29 04:20:42 +02:00
Aliaksandr Valialkin
93c5f2f9bc
wip 2024-04-29 04:15:14 +02:00
Aliaksandr Valialkin
70baaace98
wip 2024-04-29 04:07:51 +02:00
Aliaksandr Valialkin
78938aaaae
wip 2024-04-29 03:57:27 +02:00
Aliaksandr Valialkin
944f4ab01c
wip 2024-04-29 03:56:27 +02:00
Aliaksandr Valialkin
0418bd0fa9
wip 2024-04-29 03:51:09 +02:00
Aliaksandr Valialkin
4a819f65f2
wip 2024-04-29 03:49:40 +02:00
Aliaksandr Valialkin
b6a9b4b04c
wip 2024-04-29 03:49:09 +02:00
Aliaksandr Valialkin
801a4d79d6
wip 2024-04-29 03:47:25 +02:00
Aliaksandr Valialkin
cc1a3e09b9
wip 2024-04-29 03:44:54 +02:00
Aliaksandr Valialkin
7c4c8d45d6
wip 2024-04-29 03:32:49 +02:00
Aliaksandr Valialkin
16352baba9
wip 2024-04-29 03:32:13 +02:00
Aliaksandr Valialkin
fa8c611361
wip 2024-04-29 03:30:25 +02:00
Aliaksandr Valialkin
5d791d617b
wip 2024-04-29 03:27:46 +02:00
Aliaksandr Valialkin
dd55ed98a8
wip 2024-04-29 03:23:41 +02:00
Aliaksandr Valialkin
6339cae5de
wip 2024-04-29 03:22:27 +02:00
Aliaksandr Valialkin
d9fdbf907c
wip 2024-04-29 03:20:43 +02:00
Aliaksandr Valialkin
449eade980
wip 2024-04-29 03:08:35 +02:00
Aliaksandr Valialkin
cb42a1a6fc
wip 2024-04-29 02:18:48 +02:00
Aliaksandr Valialkin
ccb4031e62
wip 2024-04-29 02:04:42 +02:00
Aliaksandr Valialkin
fcbad5ac1b
wip 2024-04-29 01:32:11 +02:00
Aliaksandr Valialkin
53c3384bf7
wip 2024-04-29 00:54:32 +02:00
Aliaksandr Valialkin
1b67995907
wip 2024-04-29 00:35:16 +02:00
Aliaksandr Valialkin
20fd87f86f
wip 2024-04-29 00:05:31 +02:00
Aliaksandr Valialkin
24f07dfdc3
wip 2024-04-28 23:19:40 +02:00
Aliaksandr Valialkin
0850e13eb3
wip 2024-04-28 22:52:15 +02:00
Aliaksandr Valialkin
a941bdcdbd
wip 2024-04-28 22:42:50 +02:00
Aliaksandr Valialkin
59b7bef051
wip 2024-04-28 22:15:27 +02:00
Aliaksandr Valialkin
0f31264e83
wip 2024-04-28 16:21:08 +02:00
Aliaksandr Valialkin
3008c58ac8
wip 2024-04-28 12:52:55 +02:00
Aliaksandr Valialkin
75914210ec
wip 2024-04-27 22:08:03 +02:00
Aliaksandr Valialkin
f9d0b21bb9
wip 2024-04-27 21:15:56 +02:00
Aliaksandr Valialkin
56d6496319
wip 2024-04-27 20:36:02 +02:00
Aliaksandr Valialkin
d282056124
wip 2024-04-27 04:43:38 +02:00
Aliaksandr Valialkin
91c7902555
wip 2024-04-27 04:26:15 +02:00
Aliaksandr Valialkin
75bbe51a05
wip 2024-04-27 03:31:19 +02:00
Aliaksandr Valialkin
16a91539bd
wip 2024-04-27 03:14:00 +02:00
Aliaksandr Valialkin
2270c42c82
wip 2024-04-27 02:50:19 +02:00
Aliaksandr Valialkin
51b869d458
wip 2024-04-27 01:53:32 +02:00
Aliaksandr Valialkin
9f8dd1ef31
wip 2024-04-27 00:52:15 +02:00
Aliaksandr Valialkin
640b18cd66
wip 2024-04-26 23:47:50 +02:00
Aliaksandr Valialkin
65f09bc641
wip 2024-04-26 00:19:58 +02:00
Aliaksandr Valialkin
5512787b72
lib/logstorage: add support for fields modifier 2024-04-25 03:44:07 +02:00
Aliaksandr Valialkin
d304785936
wip 2024-04-25 02:16:06 +02:00
Aliaksandr Valialkin
984dd2abaf
lib/logstorage: optimize typical AND case 2024-04-25 00:57:48 +02:00
Aliaksandr Valialkin
ffdafc32c6
lib/logstorage: skip scheduled work when stopCh is closed
This saves CPU time
2024-04-24 23:41:20 +02:00
Aliaksandr Valialkin
e42b9d26a9
lib/logstorage: skip log entries if it is impossible to find stream tags for them
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6042
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6127
2024-04-24 23:24:09 +02:00
Aliaksandr Valialkin
543a6b9cee
lib/logstorage: search in partitions in parallel 2024-04-24 23:04:29 +02:00
Aliaksandr Valialkin
e7685164f5
wip 2024-04-24 18:32:58 +02:00
Aliaksandr Valialkin
522415bf56
lib/logstorage: small clarifications in comments 2024-04-23 15:49:58 +02:00
wanshuangcheng
83216e956c
chore: fix function names in comment (#6076)
Signed-off-by: wanshuangcheng <wanshuangcheng@outlook.com>
2024-04-08 01:11:12 -07:00
Aliaksandr Valialkin
918cccaddf
all: fix golangci-lint(revive) warnings after 0c0ed61ce7
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6001
2024-04-02 23:16:29 +03:00
XLONG96
a5795f533d
lib/logstorage: avoid panic when parsing regex with stream filter (#5897) 2024-02-29 15:31:54 +02:00
Aliaksandr Valialkin
4617dc8bbe
lib/logstorage: consistently use atomic.* types instead of atomic.* functions on regular types
See ea9e2b19a5
2024-02-23 23:46:13 +02:00
Aliaksandr Valialkin
f81b480905
lib/mergeset: consistently use atomic.* types instead of atomic.* function calls on ordinary types
See ea9e2b19a5
2024-02-23 23:29:35 +02:00
Aliaksandr Valialkin
275335c181
lib/logstorage: consistently use atomic.* type for refCount and mustDrop fields in datadb and storage structs in the same way as it is used in lib/storage
See ea9e2b19a5 and a204fd69f1
2024-02-23 23:04:42 +02:00
Aliaksandr Valialkin
0514091948
app/vlselect: follow-up for 451d2abf50
- Consistently return the first `limit` log entries if the total size of found log entries doesn't exceed 1Mb.
  See app/vlselect/logsql/sort_writer.go . Previously random log entries could be returned with each request.
- Document the change at docs/VictoriaLogs/CHANGELOG.md
- Document the `limit` query arg at docs/VictoriaLogs/querying/README.md
- Make the change less intrusive.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5674
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5778
2024-02-18 23:05:51 +02:00
Dmytro Kozlov
451d2abf50
Enable the limit query param for the /select/logsql/query (#5778)
* app/vlselect: add limit for logs query

* app/vlselect: CHANGELOG.md

* app/vlselect: stop search process if limit is reached, update logic, remove default limit

* app/vlselect: fix tests

* app/vlselect: fix filter tests

* app/vlselect: fix tests
2024-02-18 22:58:47 +02:00
noodles2hg
cafd6f08b3
lib/logstorage: proper exit during block search (#5400) 2024-02-01 12:11:05 +00:00
Jiajing LU
333bda8702
count inmemoryParts that have not been taken for merge (#5447) 2024-02-01 12:06:28 +00:00
Aliaksandr Valialkin
2655c02d5e
lib/logstorage: make sure that WaitGroup.Add isnt called after stopCh is closed and WaitGroup.Wait is called
This protects from rare panic, which may occur during graceful shutdown of VictoriaLogs
2024-01-26 21:17:02 +01:00
Aliaksandr Valialkin
3449d563bd
all: add up to 10% random jitter to the interval between periodic tasks performed by various components
This should smooth CPU and RAM usage spikes related to these periodic tasks,
by reducing the probability that multiple concurrent periodic tasks are performed at the same time.
2024-01-22 18:40:32 +02:00
Aliaksandr Valialkin
cef7a39ba3
lib/logstorage: always check the previous indexBlockHeader for blocks with matching tenantID and/or streamID
The previous indexBlockHeader may contain blocks for the matching tenantID and/or streamID,
so it must be scanned unconditionally during the search.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5295
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4856

This is a follow-up for 89dcbc2fe7
2023-11-13 23:13:53 +01:00
XLONG96
89dcbc2fe7
lib/logstorage: fix streamID and tenantID search (#4856) (#5295) 2023-11-13 23:09:39 +01:00
Aliaksandr Valialkin
42dd71bb63
all: consistently use %w instead of %s in when error is passed to fmt.Errorf()
This allows consistently using errors.Is() for verifying whether the given error wraps some other known error.
2023-10-25 21:24:03 +02:00
Zakhar Bessarab
b296c8e95a
lib/logstorage: fix free space check (#5113)
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
2023-10-03 12:39:41 +02:00
Aliaksandr Valialkin
8dce4eb189
lib/logstorage: follow-up for 94627113db
- Move uniqueFields from rows to blockStreamMerger struct.
  This allows localizing all the references to uniqueFields inside blockStreamMerger.mustWriteBlock(),
  which should improve readability and maintainability of the code.

- Remove logging of the event when blocks cannot be merged because they contain more than maxColumnsPerBlock,
  since the provided logging didn't provide the solution for the issue with too many columns.
  I couldn't figure out the proper solution, which could be helpful for end user,
  so decided to remove the logging until we find the solution.

This commit also contains the following additional changes:

- It truncates field names longer than 128 chars during logs ingestion.
  This should prevent from ingesting bogus field names.
  This also should prevent from too big columnsHeader blocks,
  which could negatively affect search query performance,
  since columnsHeader is read on every scan of the corresponding data block.

- It limits the maximum length of const column value to 256.
  Longer values are stored in an ordinary columns.
  This helps limiting the size of columnsHeader blocks
  and improving search query performance by avoiding
  reading too long const columns on every scan of the corresponding data block.

- It deduplicates columns with identical names during data ingestion
  and background merging. Previously it was possible to pass columns with duplicate names
  to block.mustInitFromRows(), and they were stored as is in the block.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4762
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4969
2023-10-02 19:19:08 +02:00
Aliaksandr Valialkin
7b33a27874
lib/logstorage: follow-up for 8a23d08c21
- Compare the actual free disk space to the value provided via -storage.minFreeDiskSpaceBytes
  directly inside the Storage.IsReadOnly(). This should work fast in most cases.
  This simplifies the logic at lib/storage.

- Do not take into account -storage.minFreeDiskSpaceBytes during background merges, since
  it results in uncontrolled growth of small parts when the free disk space approaches -storage.minFreeDiskSpaceBytes.
  The background merge logic uses another mechanism for determining whether there is enough
  disk space for the merge - it reserves the needed disk space before the merge
  and releases it after the merge. This prevents from out of disk space errors during background merge.

- Properly handle corner cases for flushing in-memory data to disk when the storage
  enters read-only mode. This is better than losing the in-memory data.

- Return back Storage.MustAddRows() instead of Storage.AddRows(),
  since the only case when AddRows() can return error is when the storage is in read-only mode.
  This case must be handled by the caller by calling Storage.IsReadOnly()
  before adding rows to the storage.
  This simplifies the code a bit, since the caller of Storage.MustAddRows() shouldn't handle
  errors returned by Storage.AddRows().

- Properly store parsed logs to Storage if parts of the request contain invalid log lines.
  Previously the parsed logs could be lost in this case.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4737
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4945
2023-10-02 16:52:23 +02:00
Aliaksandr Valialkin
10d9214980
lib/logstorage: run up to GOMAXPROCS flushers of old in-memory parts to disk
One flusher isn't enough under high data ingestion rate.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4775
2023-10-02 16:20:59 +02:00
Aliaksandr Valialkin
da9ef90277
lib/logstorage: assist merging in-memory parts at data ingestion path if their number starts exceeding maxInmemoryPartsPerPartition
This is a follow-up for 9310e9f584 , which removed data ingestion pacing.
This can result in uncontrolled growth of in-memory parts under high data ingestion rate,
which, in turn, can result in unbounded RAM usage, OOM crashes and slow query performance.

While at it, consistently reset isInMerge field for parts passed to mergeParts() before returning from this function.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4775
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4828
2023-10-02 08:24:58 +02:00
Zakhar Bessarab
94627113db
lib/logstorage: prevent from panic during background merge (#4969)
* lib/logstorage: prevent from panic during background merge

Fixes panic during background merge when resulting block would contain more columns than maxColumnsPerBlock.
Buffered data will be flushed and replaced by the next block.

See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4762
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/logstorage: clarify field description and comment

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
2023-09-29 11:58:20 +02:00
Zakhar Bessarab
8a23d08c21
lib/logstorage: switch to read-only mode when running out of disk space (#4945)
* lib/logstorage: switch to read-only mode when running out of disk space

Added support of `--storage.minFreeDiskSpaceBytes` command-line flag to allow graceful handling of running out of disk space at `--storageDataPath`.

See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4737
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/logstorage: fix error handling logic during merge

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/logstorage: fix log level

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
2023-09-29 11:55:38 +02:00
Zakhar Bessarab
9310e9f584
lib/logstorage/datadb: remove parts merge cond (#4828)
It was added in order to limit number of goroutines performing assisted merges during ingestion.
It turned out that blocking ingestion goroutines lower ingestion performance and limits overall ingestion around 40k items per seconds because of lock contention.
Removing parts merge sync.Cond allows to remove lock contention at write path and significantly improves write performance.

See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4775

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
2023-09-29 11:50:14 +02:00