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
12e65a42
Commit
12e65a42
authored
Dec 14, 2017
by
antirez
Browse files
safe_write -> aofWrite. Function commented.
Related to #4498.
parent
5182dcd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
12e65a42
...
@@ -266,7 +266,14 @@ int startAppendOnly(void) {
...
@@ -266,7 +266,14 @@ int startAppendOnly(void) {
return
C_OK
;
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
;
ssize_t
nwritten
=
0
,
totwritten
=
0
;
while
(
len
)
{
while
(
len
)
{
...
@@ -344,7 +351,7 @@ void flushAppendOnlyFile(int force) {
...
@@ -344,7 +351,7 @@ void flushAppendOnlyFile(int force) {
* or alike */
* or alike */
latencyStartMonitor
(
latency
);
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
);
latencyEndMonitor
(
latency
);
/* We want to capture different events for delayed writes:
/* We want to capture different events for delayed writes:
* when the delay happens with a pending fsync, or with a saving child
* 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