influxdb
influxdb copied to clipboard
data race between test and product code in partition compaction
There is an occasional data race between a test and the product code. The test needs to lock the partition for writing before modifying the MaxLogFileSize
.
Failed
=== RUN TestPartition_Compact_Write_Fail
=== RUN TestPartition_Compact_Write_Fail/write_MANIFEST
==================
WARNING: DATA RACE
Write at 0x00c0001593e0 by goroutine 7789:
github.com/influxdata/influxdb/tsdb/index/tsi1_test.TestPartition_Compact_Write_Fail.func1()
/root/project/tsdb/index/tsi1/partition_test.go:135 +0x14a
testing.tRunner()
/go/src/testing/testing.go:1446 +0x216
testing.(*T).Run.func1()
/go/src/testing/testing.go:1493 +0x47
Previous read at 0x00c0001593e0 by goroutine 7790:
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).needsLogCompaction()
/root/project/tsdb/index/tsi1/partition.go:1217 +0x9e
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).compact()
/root/project/tsdb/index/tsi1/partition.go:1013 +0x19d
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).Compact()
/root/project/tsdb/index/tsi1/partition.go:915 +0x72
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).runPeriodicCompaction()
/root/project/tsdb/index/tsi1/partition.go:952 +0x47
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).Open.func3()
/root/project/tsdb/index/tsi1/partition.go:254 +0x39
Goroutine 7789 (running) created at:
testing.(*T).Run()
/go/src/testing/testing.go:1493 +0x75d
github.com/influxdata/influxdb/tsdb/index/tsi1_test.TestPartition_Compact_Write_Fail()
/root/project/tsdb/index/tsi1/partition_test.go:125 +0x44
testing.tRunner()
/go/src/testing/testing.go:1446 +0x216
testing.(*T).Run.func1()
/go/src/testing/testing.go:1493 +0x47
Goroutine 7790 (running) created at:
github.com/influxdata/influxdb/tsdb/index/tsi1.(*Partition).Open()
/root/project/tsdb/index/tsi1/partition.go:254 +0xd2b
github.com/influxdata/influxdb/tsdb/index/tsi1_test.MustOpenPartition()
/root/project/tsdb/index/tsi1/partition_test.go:163 +0x49
github.com/influxdata/influxdb/tsdb/index/tsi1_test.TestPartition_Compact_Write_Fail.func1()
/root/project/tsdb/index/tsi1/partition_test.go:129 +0xb4
testing.tRunner()
/go/src/testing/testing.go:1446 +0x216
testing.(*T).Run.func1()
/go/src/testing/testing.go:1493 +0x47
==================