Commit Graph

35340 Commits (db/golang-1.23.5)

Author SHA1 Message Date
devanbenz 7280c21200 feat: run ci 2025-01-28 11:41:32 -06:00
devanbenz c5540c419e feat: staticcheck formatting 2025-01-28 11:04:01 -06:00
devanbenz 1d7fcdd623 feat: modify staticcheck failures 2025-01-28 10:50:02 -06:00
devanbenz 771d4cb2fd feat: use go1.23 2025-01-28 10:06:42 -06:00
devanbenz 1faa53fe27 feat: This PR adds `query-log-path` for OSS to enable writing queries to a file 2025-01-28 09:45:15 -06:00
Jamie Strandboge df178f74d3
chore: upgrade go toolchain to 1.22.11 (#25920) 2025-01-27 11:39:09 -06:00
davidby-influx dd7b4ce351
fix: move aside TSM file on errBlockRead (#25899)
The error type check for errBlockRead was incorrect,
and bad TSM files were not being moved aside when
that error was encountered. Use errors.Join,
errors.Is, and errors.As to correctly unwrap multiple
errors.

Closes https://github.com/influxdata/influxdb/issues/25838

(cherry picked from commit 800970490a)

Closes https://github.com/influxdata/influxdb/issues/25840
2025-01-22 14:10:14 -08:00
davidby-influx c82d4f86ee
fix: do not leak file handles from Compactor.write (#25725) (#25740)
There are a number of code paths in Compactor.write which
on error can lead to leaked file handles to temporary files.
This, in turn, prevents the removal of the temporary files until
InfluxDB is rebooted, releasing the file handles.

closes https://github.com/influxdata/influxdb/issues/25724

(cherry picked from commit e974165d25)

closes https://github.com/influxdata/influxdb/issues/25739
2025-01-06 09:03:37 -08:00
davidby-influx 5b364b51c8
fix: avoid panic if shard group has no shards (#25717)
Avoid panicking when mapping points to a shard group
that has no shards. This does not address the root problem,
how the shard group ended up with no shards.

helps: https://github.com/influxdata/influxdb/issues/25715
2024-12-27 14:04:19 -08:00
WeblWabl 06ab224516
fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578) (#25622)
* fix(influxd): update xxhash, avoid stringtoslicebyte in cache (#578)

* fix(influxd): update xxhash, avoid stringtoslicebyte in cache

This commit does 3 things:

* it updates xxhash from v1 to v2; v2 includes a assembly arm version of
  Sum64
* it changes the cache storer to write with a string key instead of a
  byte slice. The cache only reads the key which WriteMulti already has
as a string so we can avoid a host of allocations when converting back
and forth from immutable strings to mutable byte slices. This includes
updating the cache ring and ring partition to write with a string key
* it updates the xxhash for finding the cache ring partition to use
Sum64String which uses unsafe pointers to directly use a string as a
byte slice since it only reads the string. Note: this now uses an
assembly version because of the v2 xxhash update. Go 1.22 included new
compiler ability to recognize calls of Method([]byte(myString)) and not
make a copy but from looking at the call sites, I'm not sure the
compiler would recognize it as the conversion to a byte slice was
happening several calls earlier.

That's what this change set does. If we are uncomfortable with any of
these, we can do fewer of them (for example, not upgrade xxhash; and/or
not use the specialized Sum64String, etc).

For the performance issue in maz-rr, I see converting string keys to
byte slices taking between 3-5% of cpu usage on both the primary and
secondary. So while this pr doesn't address directly the increased cpu
usage on the secondary, it makes cpu usage less on both which still
feels like a win. I believe these changes are easier to review that
switching to a byte slice pool that is likely needed in other places as
the compiler provides nearly all of the correctness checks we need (we
are relying also on xxhash v2 being correct).

* helps #550

* chore: fix tests/lint

* chore: don't use assembly version; should inline

This 2 line change causes xxhash to use a purego Sum64 implementation
which allows the compiler to see that Sum64 only read the byte slice
input which them means is can skip the string to byte slice allocation
and since it can skip that, it should inline all the calls to
getPartitionStringKey and Sum64 avoiding 1 call to Sum64String which
isn't inlined.

* chore: update ci build file

the ci build doesn't use the make file!!!

* chore: revert "chore: update ci build file"

This reverts commit 94be66fde03e0bbe18004aab25c0e19051406de2.

* chore: revert "chore: don't use assembly version; should inline"

This reverts commit 67d8d06c02e17e91ba643a2991e30a49308a5283.

(cherry picked from commit 1d334c679ca025645ed93518b7832ae676499cd2)

* feat: need to update go sum

---------

Co-authored-by: Phil Bracikowski <13472206+philjb@users.noreply.github.com>
2024-12-05 16:57:26 -06:00
WeblWabl 514e24752c
feat: Upgrade go to 1.22.7 (#25586)
* feat: Upgrade go to 1.22.7
2024-11-22 16:47:31 -06:00
WeblWabl edbb55777e
feat(buildtsi): Adds log for rebuild TSI completion (#25576)
(cherry-picked from 75eb209f72)

closes https://github.com/influxdata/feature-requests/issues/612
2024-11-21 16:48:13 -06:00
Geoffrey Wossum 037c6af6e8
feat: check for uncommitted WRR segments during startup (#25540)
Check for uncommitted WRR segments during startup and abort startup
if found.

Closes: #25503
2024-11-14 15:27:01 -06:00
Geoffrey Wossum 5c7479eb14
chore: loadShards changes to more cleanly support 2.x feature (#25528)
* chore: loadShards changes to more cleanly support 2.x feature (#25513)

* chore: move shardID parsing and shard filtering into walkShardsAndProcess

* chore: make it impossible to miss sending shardResponse or marking shard as complete

* chore: always count number of shards (preparation for 2.x related feature)

* chore: explicitly load series files and create indices serially

Explicitly load series files and create indices serially. Also
avoid passing them to work functions that don't need them.

* chore: rework loadShards for changes necessary to cancel loading process

* chore: comment improvements

* fix: fix race conditions in TestStore_StartupShardProgress and TestStore_BadShardLoading

* chore: avoid logging nil error

* chore: refactor shard loading and shard walking

Refactor loadShards and CreateShard to use a common shardLoader class that
makes thread-safety easier. Refactor walkShardsAndProcess into findShards.

* chore: improve comment

* chore: rename OpenShard to ReopenShard and implement with shardLoader

Rename Store.OpenShard to Store.ReopenShard and implement using a
shardLoader object. Changes to tests as necessary.

* chore: avoid resetting shard options and locking on Reopen

Avoid resetting shard options when reopening a shard.
Proper mutex locker in Shard.ReopenShard.

* chore: fix formatting issue

* chore: warn on mixed index types in Store.CreateShard

* chore: change from info to warn when invalid shard IDs found in path

* chore: use coarser locking in Store.ReopenShard

* chore: fix typo in comment

* chore: code simplification

(cherry picked from commit 0bc167bbd7)

* chore: fix logging issues in Store.loadShards

Fix reporting shards not opening correctly when they actually did.
Fix race condition with logging in loadShards.

(cherry picked from commit 65683bf166)

* chore: remove unnecessary fmt.Sprintf calls

Remove unnecessary fmt.Sprintf calls for static code checks in main-2.x.

(cherry picked from commit 8497fbf0af)

* chore: remove unnecessary blank identifier

* chore: remove unnecessary blank identifier
2024-11-12 14:12:53 -06:00
WeblWabl 2ffb108a27
feat(logging): Add startup logging for shard counts (#25378) (#25507)
* feat(logging): Add startup logging for shard counts (#25378)
This PR adds a check to see how many shards are remaining
vs how many shards are opened. This change displays the percent
completed too.

closes influxdata/feature-requests#476

(cherry picked from commit 3c87f52)

closes https://github.com/influxdata/influxdb/issues/25506
2024-11-01 09:20:35 -05:00
Geoffrey Wossum 9d9e92c67d
chore: upgrade ui assets package to 2.7.10 (#25501)
Upgrade UI assets package to OSS 2.7.10.

Closes: #25500
2024-10-30 13:16:57 -05:00
Geoffrey Wossum 48f760065b
fix: correct flaky test (TestLauncher_PIDFile_Locked) (#25490) 2024-10-24 17:26:54 -05:00
Geoffrey Wossum c35321b470
feat: add `--pid-file` option to write PID files (#25474)
Add `--pid-file` option to write PID files on startup. The PID filename
is specified by the argument after `--pid-file`. If the PID file already exists, influxd will exit unless the `--overwrite-pid-file` flag is also used.

Example: `influxd --pid-file /var/lib/influxd/influxd.pid`

PID files are automatically removed when the influxd process is shutdown.

Closes: 25473
2024-10-24 15:19:41 -05:00
Geoffrey Wossum 96bade409e
feat: add option to flush WAL on shutdown (#25444)
* feat: add option to flush WAL on shutdown

Add `--storage-wal-flush-on-shutdown` to flush WAL on database shutdown.
On successful shutdown, all WAL data will be committed to TSM files and the
WAL directories will not contain any .wal files.

Closes: #25422
2024-10-10 15:27:54 -05:00
Geoffrey Wossum 60e49d854c
chore: replace uses of %v with %w (#25358)
Replace uses of `%v` with `%w` where appropriate in file_store.go

Closes: #25357
2024-09-25 15:12:31 -05:00
WeblWabl b88e74e6bb
fix(tsi1/partition/test): fix data races in test code (#57) (#25338) (#25344)
* fix(tsi1/partition/test): fix data races in test code (#57)

* fix(tsi1/partition/test): fix data races in test code

This PR is like influxdata/influxdb#24613 but solves it with a setter
method for MaxLogFileSize which allows unexporting that value and
MaxLogFileAge. There are actually two places locks were needed in test
code. The behavior of production code is unchanged.

(cherry picked from commit f0235c4daf4b97769db932f7346c1d3aecf57f8f)

* feat: modify error handling to be more idiomatic

closes https://github.com/influxdata/influxdb/issues/24042

* fix: errors.Join() filters nil errors

closes https://github.com/influxdata/influxdb/issues/25341
---------

Co-authored-by: Phil Bracikowski <13472206+philjb@users.noreply.github.com>
(cherry picked from commit 5c9e45f033)
2024-09-17 13:09:14 -05:00
Geoffrey Wossum 5aff511e40
fix: do not rename files on mmap failure (#25340)
If NewTSMReader() fails because mmap fails, do not
rename the file, because the error is probably
caused by vm.max_map_count being too low

Closes: #25337

(cherry picked from commit ec412f793b)
2024-09-17 12:48:21 -05:00
WeblWabl 5a599383f1
fix(tsi1/partition/test): fix data races in test code (#57) (#25336)
* fix(tsi1/partition/test): fix data races in test code

This PR is like #24613 but solves it with a setter
method for MaxLogFileSize which allows unexporting that value and
MaxLogFileAge. There are actually two places locks were needed in test
code. The behavior of production code is unchanged.

(cherry picked from commit f0235c4daf4b97769db932f7346c1d3aecf57f8f)
2024-09-16 16:51:00 -05:00
Geoffrey Wossum da9615fdc3
chore: improve error messages and logging during shard opening (#25331)
Ported from master-1.x.

(cherry picked from commit 23008e5286)

Closes: #25328
2024-09-13 16:59:17 -05:00
davidby-influx 96c97a76f4
fix: add additional logging on loading fields.idxl files (#25309) (#25319)
Log the path of the file being loaded, and when level=debug
log progress fpr each set of field changes

closes https://github.com/influxdata/influxdb/issues/25289

(cherry picked from commit 5d8d1120e1)

closes https://github.com/influxdata/influxdb/issues/25311
2024-09-12 13:46:21 -07:00
Jamie Strandboge 15592cf0ae
chore: upgrade go toolchain to 1.21.12 (#25198) 2024-09-05 11:04:30 -05:00
Martin Hilton 9b19ca7714
build(flux): update flux to v0.195.2 (#25244) 2024-08-14 14:30:32 -05:00
davidby-influx 031f394d2c
fix: prevent an infinite loop in measurementFieldSetChangeMgr (#25155) (#25156)
The measurementFieldSetChangeMgr has a possibly infinite loop
if the writeRequests channel is closed while in the inner
loop to consolidate write requests. We need to check for ok
on channel receive and exit the loop when ok is false.

closes https://github.com/influxdata/influxdb/issues/25151

(cherry picked from commit 176fca2138)

closes https://github.com/influxdata/influxdb/issues/25153
2024-07-12 20:33:59 -07:00
davidby-influx c2b3e38a38
fix: Store.validateArgs wrongfully overwriting start, end unix time (#25146)
When querying data before 1970-01-01 (UNIX time 0) 
validateArgs would set start to -in64 max and end to int64 max.

closes https://github.com/influxdata/influxdb/issues/24669

Co-authored-by: Paul Hegenberg <paul.hegenberg@gmail.com>
2024-07-12 14:11:18 -07:00
Jamie Strandboge a076f24439
chore: upgrade go toolchain to 1.21.10 (#25114) 2024-06-28 10:23:59 -05:00
davidby-influx ebb597d16c
fix: preserve time zone information in Task Scheduler (#25112)
Avoid converting times to int64 in the Task Scheduler
to preserve time zone information. This corrects a
failure after fall back time changes which halts
every-type tasks

closes https://github.com/influxdata/influxdb/issues/25110
2024-06-27 16:14:45 -07:00
peterbarnett03 8cb6b54b2b
chore: Update README to approved version. (#25103)
* chore: Update README to approved version.

* chore: README adjustments

---------

Co-authored-by: Peter Barnett <peterbarnett@Peters-MacBook-Pro.local>
2024-06-27 12:50:21 -04:00
davidby-influx 0c77b4cbd2
fix: GROUP BY queries with offset that crosses a DST boundary fail. (#25082) (#25087)
This is actually the second fix for
https://github.com/influxdata/influxdb/issues/20238
for when the time zone falls back in autumn.

closes https://github.com/influxdata/influxdb/issues/25078

(cherry picked from commit d60741b506)

closes https://github.com/influxdata/influxdb/issues/25080
2024-06-24 13:40:04 -07:00
Geoffrey Wossum cb8cfe3510
fix: prevent retention service from hanging (#25077)
* fix: prevent retention service from hanging (#25055)

Fix issue that can cause the retention service to hang waiting on a
`Shard.Close` call. When this occurs, no other shards will be deleted
by the retention service. This is usually noticed as an increase in
disk usage because old shards are not cleaned up.

The fix adds to new methods to `Store`, `SetShardNewReadersBlocked`
and `InUse`. `InUse` can be used to poll if a shard has active readers,
which the retention service uses to skip over in-use shards to prevent
the service from hanging. `SetShardNewReadersBlocked` determines if
new read access may be granted to a shard. This is required to prevent
race conditions around the use of `InUse` and the deletion of shards.

If the retention service skips over a shard because it is in-use, the
shard will be checked again the next time the retention service is run.
It can be deleted on subsequent checks if it is no longer in-use. If
the shards is stuck in-use, the retention service will not be able to
delete the shards, which can be observed in the logs for manual
intervention. Other shards can still be deleted by the retention service
even if a shard is stuck with readers.

This is a port of ad68ec8 from master-1.x to main-2.x.

closes: #25076
(cherry picked from commit b4bd607eef)
2024-06-24 12:27:22 -05:00
Geoffrey Wossum 9fd91a554d
feat: disable file:// urls when hardening enabled (#24858)
Stacks and templates allow specifying file:// URLs. Add command line
option `--template-file-urls-disabled` to disable their use for people who don't require them.
2024-06-17 17:33:48 -05:00
Martin Hilton f4ef091f50
build(flux): update flux to v0.195.1 (#25052) 2024-06-12 05:52:17 +01:00
Martin Hilton fd0531761c
feat: update flux to latest head (#25051)
* feat: update flux to latest head

Flux has updated some dependencies, including prometheus. Prometheus
has changed in some incompatible ways. Update the flux dependency
to a newer version with the updated prometheus dependency and apply
some small fixes to make everything build. This is in preparation
for a flux release later in the week.

The biggest change is in some tests that were using runtime.DeepEqual
to check the correctness of prometheus metrics. The internals of
these types have changed such that this is not a safe thing to do
anymore. The test now verifies the string representations, as
produced by String(), match.

* fix: update CI script

The scripts/ci/check-system-go-matches-go-mod.sh is failing because
newer go toolchains include the bugfix version in go.mod's go
directive. Update the script to check the major and minor versions
reported by both tools match.
2024-06-11 05:49:52 +01:00
davidby-influx a97566bc31
fix: return MergeIterator.Close errors (#24975) (#24997)
Ensure that errors from closing the
iterators underneath a MergeIterator
are returned up the stack.

(cherry picked from commit 5fda409f39)

closes https://github.com/influxdata/influxdb/issues/24977
2024-05-13 18:26:15 -07:00
davidby-influx 0a4d41bc90
fix: ensure TSMBatchKeyIterator and FileStore close all TSMReaders (#24957) (#24964)
Do not let errors on closing
a TSMReader prevent other
closes.

(cherry picked from commit 82cbdb5478)

closes https://github.com/influxdata/influxdb/issues/24961
2024-05-06 10:45:41 -07:00
davidby-influx 73f694ac3c
chore: update google.golang.org/protobuf to 1.33.0 (#24940)
* chore: update google.golang.org/protobuf to 1.33.0

closes https://github.com/influxdata/edge/issues/627

* chore: update protoc
2024-05-01 10:16:23 -04:00
Jamie Strandboge 4a5c1cf52c
chore: update golang.org/x/net to v0.23.0 (#24928)
Performed:
$ go mod edit golang.org/x/net@v0.23.0
$ go mod tidy
2024-04-19 12:12:37 -05:00
Brandon Pfeifer c165f2d427
chore: upgrade go toolchain to 1.21.9 (#24910) 2024-04-12 15:02:56 -04:00
Phil Bracikowski 2e458963f2
fix(meta.Client): add write lock to Load method ok kv store client (#24896)
This adds locking to the load method and renames it to Reload(). This
method replaces the cached data from the underlying kv.Store and needs a
write lock. The restore api uses it and may have been an issue with
concurrent writes into the cached data during a restore.

* fixes #24895
2024-04-10 11:14:20 -07:00
davidby-influx 31753c3c9e
fix: additional constant time code (#24887)
closes https://github.com/influxdata/influxdb/issues/24886
2024-04-04 19:58:29 -07:00
davidby-influx 7d8884beca
feat: add optional stricter password requirements (#24857)
Allow password length and character class checking.

closes https://github.com/influxdata/influxdb/issues/24856
2024-04-04 12:27:58 -07:00
davidby-influx 49d0bef3ea
fix: return and respect cursor errors (#24791) (#24846)
ArrayCursors were ignoring errors, which led to panics when nil
cursors were operated on. This fix passes errors back up the stack
and uses them to enforce healthy cursor creation.

Closes https://github.com/influxdata/influxdb/issues/24789
---------
Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>

(cherry picked from commit fe6c64b21e)

closes https://github.com/influxdata/influxdb/issues/24836
2024-03-26 14:54:32 -07:00
davidby-influx 2066c4be46
fix: improved shard deletion (#24602) (#24844)
Avoid unnecessarily deleting series from the series file
Log all errors on shard deletion

Closes https://github.com/influxdata/influxdb/issues/24834

(cherry picked from commit 8ff06d5a92)

closes https://github.com/influxdata/influxdb/issues/24836
2024-03-26 14:18:08 -07:00
davidby-influx 82dc3430b8
fix: do not panic when empty tags are queried (#24784) (#24786)
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes https://github.com/influxdata/influxdb/issues/24536

(cherry picked from commit bc80e881fa)
2024-03-18 22:03:27 -07:00
Brandon Pfeifer 1baa393f69
chore: use external "ci-packager" and "ci-slack" image (#24699) 2024-03-12 15:25:59 -04:00
Jakub Bednář 80488919a5
chore: upgrade to go 1.21.8 (main-2.x) (#24757)
* chore: upgrade to go 1.21.8 (main-2.x)

* chore(ci): update PyYAML to compatible version with latest cython https://github.com/yaml/pyyaml/issues/601
2024-03-12 13:11:39 -04:00