Skip to content

Commit

Permalink
GOCBC-1493: Update how we assign errors in setting kv durability
Browse files Browse the repository at this point in the history
Motivation
-----------
When we set durability level options on an op after setting the
value then we will swallow any transcoding errors as we assign
the error value straight into the op manager error, even if that
value is nil.

Changes
-------
Update op manager so that the error is only assigned if it is
non-nil after translating to memd.

Change-Id: Ieb01b295b6ea1bd82e6459d2b15d1e781270911d
Reviewed-on: https://review.couchbase.org/c/gocb/+/198636
Reviewed-by: Dimitris Christodoulou <[email protected]>
Tested-by: Charles Dixon <[email protected]>
  • Loading branch information
chvck committed Oct 12, 2023
1 parent 024dca5 commit c9408eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kvopmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ func (m *kvOpManager) SetDuraOptions(persistTo, replicateTo uint, level Durabili

m.persistTo = persistTo
m.replicateTo = replicateTo
m.durabilityLevel, m.err = level.toMemd()
durabilityLevel, err := level.toMemd()
if err != nil {
m.err = err
return
}

m.durabilityLevel = durabilityLevel

if level > DurabilityLevelNone {
levelStr, err := level.toManagementAPI()
Expand Down

0 comments on commit c9408eb

Please sign in to comment.