Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Issue 2604943002: impl/memory: Replace gkvlite with "treapstore". (Closed)

Created:
3 years, 12 months ago by dnj
Modified:
3 years, 11 months ago
Reviewers:
Vadim Sh., iannucci, hinoka
CC:
chromium-reviews, infra-reviews+luci-gae_chromium.org
Target Ref:
refs/heads/master
Project:
luci-gae
Visibility:
Public.

Description

impl/memory: Replace gkvlite with "treapstore". gkvlite is the treap (tree + heap)-based key/value store used by "impl/memory"'s backend. While it is very powerful package, its complexity and ensuing requirements make it a somewhat-imperfect fit. Specifically, "gkvlite" is built around resources that must be explicitly allocated and free'd. While this makes a lot of sense for its on-disk storage functionality, we don't use that functionality, and integrating snapshot closing into every layer of "impl/memory" is non-trivial. Enter "treapstore", a treap-based storage implementation that closesly mirrors the functionality in "gkvlite" that "impl/memory" uses, but specifically focuses the in-memory use case. Because "treapstore" foregoes node reuse and snapshot cleanup, we can rely entirely on Go's memory manager to clean things up, removing the need to close things. "treapstore" builds on an extended version of "gkvlite"'s underlying "gtreap" package which introduces an iterator. This iterator removes the need for the goroutine- and callback-based iteration implementations that "impl/memory" used to interface with gkvlite (and "gtreap")'s VisitItemsAscend method, resulting in signifcantly cleaner and likely higher perfomant code. "treapstore" iterators don't have any cleanup requirements. Consqeuently, explicit resource management via "stop" is no longer necessary to perform iteration. BUG=chromium:675485 TEST=unit Review-Url: https://codereview.chromium.org/2604943002 Committed: https://github.com/luci/gae/commit/951a9bd6e11300d097436f797c397d42334c742e

Patch Set 1 #

Patch Set 2 : Cleaner multiIterate loop. #

Total comments: 4

Patch Set 3 : Cleaner iteration, comment fix. #

Patch Set 4 : Update API for get/create. #

Total comments: 10

Patch Set 5 : Comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+488 lines, -1151 lines) Patch
M impl/memory/README.md View 1 chunk +1 line, -1 line 0 comments Download
M impl/memory/datastore_index.go View 1 2 3 4 6 chunks +17 lines, -23 lines 0 comments Download
M impl/memory/datastore_index_test.go View 1 2 3 4 4 chunks +11 lines, -13 lines 0 comments Download
M impl/memory/datastore_test.go View 2 chunks +6 lines, -11 lines 0 comments Download
M impl/memory/doc.go View 1 chunk +5 lines, -6 lines 0 comments Download
D impl/memory/gkvlite_iter.go View 1 chunk +0 lines, -220 lines 0 comments Download
D impl/memory/gkvlite_iter_test.go View 1 chunk +0 lines, -283 lines 0 comments Download
D impl/memory/gkvlite_tracing_utils.go View 1 chunk +0 lines, -198 lines 0 comments Download
D impl/memory/gkvlite_utils.go View 1 chunk +0 lines, -198 lines 0 comments Download
D impl/memory/gkvlite_utils_test.go View 1 chunk +0 lines, -130 lines 0 comments Download
A impl/memory/memstore.go View 1 2 3 4 1 chunk +217 lines, -0 lines 0 comments Download
A impl/memory/memstore_iter.go View 1 1 chunk +152 lines, -0 lines 0 comments Download
A + impl/memory/memstore_iter_test.go View 1 2 3 4 7 chunks +36 lines, -39 lines 0 comments Download
A + impl/memory/memstore_test.go View 1 chunk +2 lines, -2 lines 0 comments Download
A + impl/memory/memstore_tracing_utils.go View 1 2 3 4 9 chunks +41 lines, -27 lines 0 comments Download

Messages

Total messages: 12 (5 generated)
dnj
PTAL. This is part of a series of patches that I created today. For context ...
3 years, 12 months ago (2016-12-27 23:50:58 UTC) #2
Vadim Sh.
lgtm, but wait for Robbie's review too https://codereview.chromium.org/2604943002/diff/20001/impl/memory/memstore.go File impl/memory/memstore.go (right): https://codereview.chromium.org/2604943002/diff/20001/impl/memory/memstore.go#newcode53 impl/memory/memstore.go:53: f(r.key, nil, ...
3 years, 12 months ago (2016-12-28 01:57:06 UTC) #3
dnj
Thanks! Will definitely wait for Robbie's review for all of this :) https://codereview.chromium.org/2604943002/diff/20001/impl/memory/memstore.go File impl/memory/memstore.go ...
3 years, 12 months ago (2016-12-28 02:52:16 UTC) #4
iannucci
\o/ lgtm! https://codereview.chromium.org/2604943002/diff/60001/impl/memory/datastore_index.go File impl/memory/datastore_index.go (right): https://codereview.chromium.org/2604943002/diff/60001/impl/memory/datastore_index.go#newcode212 impl/memory/datastore_index.go:212: forEachItem(newColl, func(k, _ []byte) bool { would ...
3 years, 11 months ago (2017-01-07 19:06:17 UTC) #5
dnj
https://codereview.chromium.org/2604943002/diff/60001/impl/memory/datastore_index.go File impl/memory/datastore_index.go (right): https://codereview.chromium.org/2604943002/diff/60001/impl/memory/datastore_index.go#newcode212 impl/memory/datastore_index.go:212: forEachItem(newColl, func(k, _ []byte) bool { On 2017/01/07 19:06:17, ...
3 years, 11 months ago (2017-01-08 03:38:14 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2604943002/80001
3 years, 11 months ago (2017-01-08 20:31:39 UTC) #9
commit-bot: I haz the power
3 years, 11 months ago (2017-01-08 20:35:40 UTC) #12
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as
https://github.com/luci/gae/commit/951a9bd6e11300d097436f797c397d42334c742e

Powered by Google App Engine
This is Rietveld 408576698