influx-cli
influx-cli copied to clipboard
Backups on Windows are failing due to boltdb issue
From community slack:
I am unable to backup data:
PS C:\Temp\influxbackup> influx backup .
2021/12/21 09:52:07 INFO: Downloading legacy KV snapshot
2021/12/21 09:52:07 INFO: Extracting bucket manifest from legacy KV snapshot
Error: failed to backup metadata: failed to extract bucket metadata from downloaded KV snapshot: unable to open boltdb:
CreateFileMapping: Not enough memory resources are available to process this command.
No differences specifying organization, bucket and token. Influx CLI is configured correctly as other commands work fine.
See also underlying boltdb issue: https://github.com/etcd-io/bbolt/issues/252 And https://github.com/influxdata/influx-cli/pull/183#issuecomment-876680455
Looks like we skipped a test on Windows and now its biting us. No movement on the upstream issue since Nov 2020 so we're going to have to find a workaround or fix the upstream I think.
@dgnorton for prioritization
Per Franco, this is happening on the latest docker image.
This should only be happening if the CLI needs to build a manifest from a pre-2.1 influxd
server on a windows machine. There was a backup API change between 2.0.x and 2.1 that requires building this legacy manifest.
Running CLI v2.2.1 with InfluxDB v2.1.1 on Windows 10 to do a backup works for me - doesn't need to create a legacy manifest like the log 2021/12/21 09:52:07 INFO: Extracting bucket manifest from legacy KV snapshot
indicates.
For backing up a 2.0.x influxd
server, the CLI client bundled with the server release should still work on windows. These were built from the "old" CLI source code in the influxdb
repository.
The old CLI code didn't need to build a legacy manifest, but it did need to open the bolt file, as in: https://github.com/influxdata/influxdb/blob/d1233b7951ddf06a3f201c84f4b0915692c22ba5/backup/backup.go#L67
I believe the reason the old CLI code can do this on Windows is because it used the same logic to open the bolt file as the influxd
server, which does not use the ReadOnly
option for normal use: https://github.com/influxdata/influxdb/blob/d1233b7951ddf06a3f201c84f4b0915692c22ba5/bolt/kv.go#L94-L100
A simple fix for this error when backing up a legacy server on Windows therefor might be to not use the ReadOnly
option here: https://github.com/influxdata/influx-cli/blob/7af0b2ae73b7f3dec819ce6fed546c6daec73f8f/internal/backup_restore/bolt.go#L47
I asked Franco in the community slack to confirm the version of influxd
that is being run, since if it is actually v2.1.1
and the CLI is trying to create a legacy manifest that would be a different problem - and one that I could not reproduce.