Batch is not thread safe
Looking at batch code, it using an activeCommits int and size int counters very liberally all over the place. Calling Add(), at the same time as Commit() seems likely to trigger weird side effects: i.e. size reset to 0 when it should not, or activeCommits potentially going on the negative.
Batch was never intended to be thread-safe. We should probably document that.
We could also just make it thread-safe. Given that we have to spin off goroutines anyways, that may not be a bad idea.
For context, batch used to be extremely simple and flushed synchronously. We had to change that to prevent periodic pauses on add.
I'll add a note for the moment