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
4fcc564a
Commit
4fcc564a
authored
Dec 14, 2017
by
antirez
Browse files
safe_write -> aofWrite. Function commented.
Related to #4498.
parent
27d9c729
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
4fcc564a
...
...
@@ -266,7 +266,14 @@ int startAppendOnly(void) {
return C_OK;
}
ssize_t
safe_write
(
int
fd
,
const
char
*
buf
,
size_t
len
)
{
/* This is a wrapper to the write syscall in order to retry on short writes
* or if the syscall gets interrupted. It could look strange that we retry
* on short writes given that we are writing to a block device: normally if
* the first call is short, there is a end-of-space condition, so the next
* is likely to fail. However apparently in modern systems this is no longer
* true, and in general it looks just more resilient to retry the write. If
* there is an actual error condition we'll get it at the next try. */
ssize_t aofWrite(int fd, const char *buf, size_t len) {
ssize_t nwritten = 0, totwritten = 0;
while(len) {
...
...
@@ -344,7 +351,7 @@ void flushAppendOnlyFile(int force) {
* or alike */
latencyStartMonitor(latency);
nwritten
=
safe_w
rite
(
server
.
aof_fd
,
server
.
aof_buf
,
sdslen
(
server
.
aof_buf
));
nwritten =
aofW
rite(server.aof_fd,server.aof_buf,sdslen(server.aof_buf));
latencyEndMonitor(latency);
/* We want to capture different events for delayed writes:
* when the delay happens with a pending fsync, or with a saving child
...
...
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