Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9a373028
Commit
9a373028
authored
Jan 01, 2011
by
antirez
Browse files
blocking load fixed with the new design
parent
3be00d7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
9a373028
...
@@ -34,12 +34,18 @@ robj *lookupKey(redisDb *db, robj *key) {
...
@@ -34,12 +34,18 @@ robj *lookupKey(redisDb *db, robj *key) {
/* Key not found in the in memory hash table, but if disk store is
/* Key not found in the in memory hash table, but if disk store is
* enabled we may have this key on disk. If so load it in memory
* enabled we may have this key on disk. If so load it in memory
* in a blocking way.
* in a blocking way. */
*
* FIXME: race condition here. If there was an already scheduled
* async loading of this key, what may happen is that the old
* key is loaded in memory if this gets deleted in the meantime. */
if
(
server
.
ds_enabled
&&
cacheKeyMayExist
(
db
,
key
))
{
if
(
server
.
ds_enabled
&&
cacheKeyMayExist
(
db
,
key
))
{
if
(
cacheScheduleIOGetFlags
(
db
,
key
)
&
(
REDIS_IO_SAVE
|
REDIS_IO_SAVEINPROG
))
{
/* There is a save in progress for this object!
* Wait for it to get out. */
waitEmptyIOJobsQueue
();
processAllPendingIOJobs
();
redisAssert
((
cacheScheduleIOGetFlags
(
db
,
key
)
&
(
REDIS_IO_SAVE
|
REDIS_IO_SAVEINPROG
))
==
0
);
}
redisLog
(
REDIS_DEBUG
,
"Force loading key %s via lookup"
,
redisLog
(
REDIS_DEBUG
,
"Force loading key %s via lookup"
,
key
->
ptr
);
key
->
ptr
);
val
=
dsGet
(
db
,
key
,
&
expire
);
val
=
dsGet
(
db
,
key
,
&
expire
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment