Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Entries fetched with db.GetOrInsert and written with db.Put will now correctly flush the memcache #162

Merged
merged 1 commit into from
May 10, 2019

Conversation

tsteinruecken
Copy link
Contributor

This bug can cause consinstency issues with the datastore if an entry is fetched with
GetOrInsert and then later modified and written back to the datastore with db.Put.
In this case, the old version of this entry is not beeing removed from the memcache
and thus returned in subsequent db.Get() calls. This does not happen if the entry is exclusivly read
with GetOrInsert becorse GetOrInsert will run in a transaction (in which the memcache is never accessed).

…correctly flush the memcache

This bug can cause consinstency issues with the datastore if an entry is fetched with
GetOrInsert and then later modified and written back to the datastore with db.Put.
In this case, the old version of this entry is not beeing removed from the memcache
and thus returned in subsequent db.Get() calls. This does not happen if the entry is exclusivly read
with GetOrInsert becorse GetOrInsert will run in a transaction (in which the memcache is never accessed).
Copy link
Member

@phorward phorward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better now than never ;-)

Copy link
Member

@xnopasaranx xnopasaranx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested manually on a project, thanks to TS. This is working well for me.

@phorward phorward added the v2.4 label May 10, 2019
@tsteinruecken tsteinruecken merged commit ddfd8d0 into develop May 10, 2019
@tsteinruecken tsteinruecken deleted the hotfix/dbGetOrInsertWrap branch May 10, 2019 14:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants