I am writing to BigTable using the Go library. I use the ApplyBulk
method to make multiple inserts atomically. However, when I query BigTable using the ReadRows
function I see multiple copies/versions with the same row key.
For instance: In the below-mentioned example, I see multiple copies of the same RowKey with partial data and the last occurrence has all the columns with all the fields.
How can I ensure that only a single copy of data is stored for each row key? And how can I fetch only the latest version of rows inserted?
Code:
row_range := bigtable.PrefixRange("")
err = tbl.ReadRows(ctx,row_range, func(row bigtable.Row) bool {
// logic goes here
}, bigtable.RowFilter(bigtable.LatestNFilter(1)))