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
1190c6cb
Commit
1190c6cb
authored
Jan 04, 2011
by
antirez
Browse files
handle end of space on device in a better way
parent
418d5eaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/diskstore.c
View file @
1190c6cb
...
@@ -191,7 +191,16 @@ int dsSet(redisDb *db, robj *key, robj *val) {
...
@@ -191,7 +191,16 @@ int dsSet(redisDb *db, robj *key, robj *val) {
len
=
dsKeyToPath
(
db
,
buf
,
key
);
len
=
dsKeyToPath
(
db
,
buf
,
key
);
memcpy
(
buf2
,
buf
,
len
);
memcpy
(
buf2
,
buf
,
len
);
snprintf
(
buf2
+
len
,
sizeof
(
buf2
)
-
len
,
"_%ld_%ld"
,(
long
)
time
(
NULL
),(
long
)
val
);
snprintf
(
buf2
+
len
,
sizeof
(
buf2
)
-
len
,
"_%ld_%ld"
,(
long
)
time
(
NULL
),(
long
)
val
);
fp
=
fopen
(
buf2
,
"w"
);
while
((
fp
=
fopen
(
buf2
,
"w"
))
==
NULL
)
{
if
(
errno
==
ENOSPC
)
{
redisLog
(
REDIS_WARNING
,
"Diskstore: No space left on device. Please make room and wait 30 seconds for Redis to continue."
);
sleep
(
30
);
}
else
{
redisLog
(
REDIS_WARNING
,
"diskstore error opening %s: %s"
,
buf2
,
strerror
(
errno
));
redisPanic
(
"Unrecoverable diskstore error. Exiting."
);
}
}
if
((
retval
=
rdbSaveKeyValuePair
(
fp
,
db
,
key
,
val
,
time
(
NULL
)))
==
-
1
)
if
((
retval
=
rdbSaveKeyValuePair
(
fp
,
db
,
key
,
val
,
time
(
NULL
)))
==
-
1
)
return
REDIS_ERR
;
return
REDIS_ERR
;
fclose
(
fp
);
fclose
(
fp
);
...
...
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