How to get record size in Go Client

I’d like to get record sizes in order to split a large record. And I found the following solution.

But, the estimateSize method is private in go client.

How can I acutually get a record size in my application.

It is not really possible to accurately know how big a record will be on the server from the client side. The best you can do is to count the size of each data item, and add a byte per piece of data. (number of bins, key+vals in maps, number of slices, etc.)

I’ll think about how to make this a bit more intuitive, but even knowing the wire payload wouldn’t tell you exactly how it would be on the server.

In our use case we try to insert data and if we catch record too big exception we split then repeat…

Indeed, that is a good way to go. I’ll give it a try. Thank you very much.

Thank you for your reply. After all it is difficult to know exactly the size.

I should have been more specific. By size I mean:

  • len for strings.
  • 4 bytes for int and floats.
  • 2 bytes for the size of arrays and maps.
  • 2 bytes per data item (bin name, bin value, map key, etc.)

I understand exactly what you mean, thank you so much.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.