1) Indeed, I should have. I get "The operation has timed out" error on
Counter and "Queue overflow" error on insert. Tried setting operation
timeout to a big value with no success.
2) Tried setting expiry to a big value and the result is the same.
3) I put insert and counter in the same goroutine.
On Tuesday, May 17, 2016 at 6:58:07 PM UTC+3, Manlio Perillo wrote:

Il giorno martedì 17 maggio 2016 16:36:07 UTC+2, Rayland ha scritto:
I have a TCP server saving messages received from clients to a Coucbase
DB. Besides this I also increase a counter for each inserted message.

The insert and counter update are done in goroutines.

I see very big differences between the number of messages I get on server
and the number of messages inserted in Couchbase DB.

If I use only one Couchbase bucket connection the difference is much

How can I ensure that all messages are saved?
1) You should check all the errors returned by Couchbase.
2) Are you sure you are using counters correctly?
The function signature is:
func (b *Bucket <https://godoc.org/github.com/couchbase/gocb#Bucket>)
Counter(key string <https://godoc.org/builtin#string>, delta, initial
int64 <https://godoc.org/builtin#int64>, expiry uint32
<https://godoc.org/builtin#uint32>) (uint64
<https://godoc.org/builtin#uint64>, Cas
<https://godoc.org/github.com/couchbase/gocb#Cas>, error

In your code you are setting expiry to 1 second, AFAIK.
This means that the counter is reset every seconds (again, AFAIK).
3) Do not call the Insert and Counter methods in separate goroutine.
Start with a simple implementation, and only use additional goroutines
if necessary.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 15 | next ›
Discussion Overview
groupgolang-nuts @
postedMay 17, '16 at 2:36p
activeMay 20, '16 at 1:17p



site design / logo © 2021 Grokbase