Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix imports of multiple databases in a single import file from influx -import #9423

Merged
merged 2 commits into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ v1.5.0 [unreleased]
- [#9353](https://github.com/influxdata/influxdb/pull/9353): Fix panic in msgpack httpd WriteResponse error handler.
- [#9335](https://github.com/influxdata/influxdb/pull/9335): Prevent race condition caused by WaitGroup re-use
- [#9386](https://github.com/influxdata/influxdb/issues/9386): Fix stddev() call to report itself as always returning a float.
- [#9336](https://github.com/influxdata/influxdb/issues/9336): Fix `influx -import` importing to incorrect databases when export file had multiple databases. Thanks @wwilfinger!
- [#9401](https://github.com/influxdata/influxdb/pull/9401): Fix windows history file location.

v1.4.3 [unreleased]
Expand Down
13 changes: 9 additions & 4 deletions importer/v8/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ func (i *Importer) batchAccumulator(line string) {
}

func (i *Importer) batchWrite() {
// Exit early if there are no points in the batch.
if len(i.batch) == 0 {
return
}

// Accumulate the batch size to see how many points we have written this second
i.throttlePointsWritten += len(i.batch)

Expand Down Expand Up @@ -254,16 +259,16 @@ func (i *Importer) batchWrite() {
} else {
i.totalInserts += len(i.batch)
}
i.throttlePointsWritten = 0
i.lastWrite = time.Now()

// Clear the batch and record the number of processed points.
i.batch = i.batch[:0]
// Give some status feedback every 100000 lines processed
processed := i.totalInserts + i.failedInserts
if processed%100000 == 0 {
since := time.Since(i.startTime)
pps := float64(processed) / since.Seconds()
i.stdoutLogger.Printf("Processed %d lines. Time elapsed: %s. Points per second (PPS): %d", processed, since.String(), int64(pps))
}

i.batch = i.batch[:0]
i.throttlePointsWritten = 0
i.lastWrite = time.Now()
}
181 changes: 0 additions & 181 deletions tests/export_import_test.go

This file was deleted.