Open SpComb opened 4 years ago
It's pretty clear from the influxd restore
source code why this is happening, with strings.Split(filepath.Base(fn), ".")
: https://github.com/influxdata/influxdb/blob/ff383cdc0420217e3460dabe17db54f8557d95b6/cmd/influxd/restore/restore.go#L443-L451
Because the uploadShardsLegacy
only happens for a single database at a time, this could perhaps be fixed by removing the cmd.sourceDatabase
prefix from the filename, and then only split the remaining parts?
There's probably a second bug in the error-handling here, the "Skipping mis-named backup file ..."
case is missing a continue
, so it's crashing hard on the strconv.ParseUint
instead of skipping the backup file as intended.
I have this problem too restoring Influx 1.8 databases with periods:
# /usr/bin/influxd restore -db telegraf_redacted01.ab.redacted02.com -datadir /var/lib/influxdb/data /mnt/backups/20220329-130428/data/telegraf_redacted01.ab.redacted02.com
2022/03/30 11:52:35 Restoring offline from backup /mnt/backups/20220329-130428/data/telegraf_redacted01.ab.redacted02.com/telegraf_redacted01.ab.redacted02.com.*
restore: backup tarfile name incorrect format
I need to restore a full backup into a new server, "-portable" also not works for me because is not backing up users. Is there any workaround?
Regards
If you have a database name containing periods, then it is possible to backup the database, but it is not possible to restore the backup.
Steps to reproduce:
Create a database with a
.
in the name, take a backup, and attempt to restore itCREATE DATABASE "hcloud-infra.telegraf"
influxd backup -host infra-influxdb1:8088 -database hcloud-infra.telegraf hcloud-infra.telegraf
influxd restore -online -host infra-influxdb1:8088 -db hcloud-infra.telegraf -newdb 'hcloud-infra.telegraf-restore' hcloud-infra.telegraf
Note that the backup shard files will contain an extra
.
, because the database name is included at the start of the filename:Expected behavior: The database shards should be restored to a new
hcloud-infra.telegraf-restore
database.Actual behavior: The metastore snapshot is succesfully restored and the new
hcloud-infra.telegraf-restore
database is created, but the shard restore fails and crashes with an error:Environment info:
Linux 3.10.0-1062.12.1.el7.x86_64 x86_64
InfluxDB v1.7.8 (git: 1.7 ff383cdc0420217e3460dabe17db54f8557d95b6)
influxdb:1.7.8
image