Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
55951f90
Commit
55951f90
authored
Apr 07, 2012
by
antirez
Browse files
For coverage testing use exit() instead of _exit() when termiating saving children.
parent
2cf3f071
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/Makefile
View file @
55951f90
...
@@ -263,7 +263,7 @@ gprof:
...
@@ -263,7 +263,7 @@ gprof:
$(MAKE)
PROF
=
"-pg"
$(MAKE)
PROF
=
"-pg"
gcov
:
gcov
:
$(MAKE)
PROF
=
"-fprofile-arcs -ftest-coverage"
$(MAKE)
PROF
=
"-fprofile-arcs -ftest-coverage
-DCOVERAGE_TEST
"
noopt
:
noopt
:
$(MAKE)
OPTIMIZATION
=
""
$(MAKE)
OPTIMIZATION
=
""
...
...
src/aof.c
View file @
55951f90
...
@@ -803,9 +803,9 @@ int rewriteAppendOnlyFileBackground(void) {
...
@@ -803,9 +803,9 @@ int rewriteAppendOnlyFileBackground(void) {
if
(
server
.
sofd
>
0
)
close
(
server
.
sofd
);
if
(
server
.
sofd
>
0
)
close
(
server
.
sofd
);
snprintf
(
tmpfile
,
256
,
"temp-rewriteaof-bg-%d.aof"
,
(
int
)
getpid
());
snprintf
(
tmpfile
,
256
,
"temp-rewriteaof-bg-%d.aof"
,
(
int
)
getpid
());
if
(
rewriteAppendOnlyFile
(
tmpfile
)
==
REDIS_OK
)
{
if
(
rewriteAppendOnlyFile
(
tmpfile
)
==
REDIS_OK
)
{
_
exit
(
0
);
exit
FromChild
(
0
);
}
else
{
}
else
{
_
exit
(
1
);
exit
FromChild
(
1
);
}
}
}
else
{
}
else
{
/* Parent */
/* Parent */
...
...
src/rdb.c
View file @
55951f90
...
@@ -686,7 +686,7 @@ int rdbSaveBackground(char *filename) {
...
@@ -686,7 +686,7 @@ int rdbSaveBackground(char *filename) {
if
(
server
.
ipfd
>
0
)
close
(
server
.
ipfd
);
if
(
server
.
ipfd
>
0
)
close
(
server
.
ipfd
);
if
(
server
.
sofd
>
0
)
close
(
server
.
sofd
);
if
(
server
.
sofd
>
0
)
close
(
server
.
sofd
);
retval
=
rdbSave
(
filename
);
retval
=
rdbSave
(
filename
);
_
exit
((
retval
==
REDIS_OK
)
?
0
:
1
);
exit
FromChild
((
retval
==
REDIS_OK
)
?
0
:
1
);
}
else
{
}
else
{
/* Parent */
/* Parent */
server
.
stat_fork_time
=
ustime
()
-
start
;
server
.
stat_fork_time
=
ustime
()
-
start
;
...
...
src/redis.c
View file @
55951f90
...
@@ -354,6 +354,18 @@ long long mstime(void) {
...
@@ -354,6 +354,18 @@ long long mstime(void) {
return
ustime
()
/
1000
;
return
ustime
()
/
1000
;
}
}
/* After an RDB dump or AOF rewrite we exit from children using _exit() instead of
* exit(), because the latter may interact with the same file objects used by
* the parent process. However if we are testing the coverage normal exit() is
* used in order to obtain the right coverage information. */
void
exitFromChild
(
int
retcode
)
{
#ifdef COVERAGE_TEST
exit
(
retcode
);
#else
_exit
(
retcode
);
#endif
}
/*====================== Hash table type implementation ==================== */
/*====================== Hash table type implementation ==================== */
/* This is an hash table type that uses the SDS dynamic strings libary as
/* This is an hash table type that uses the SDS dynamic strings libary as
...
...
src/redis.h
View file @
55951f90
...
@@ -694,6 +694,7 @@ long long ustime(void);
...
@@ -694,6 +694,7 @@ long long ustime(void);
long
long
mstime
(
void
);
long
long
mstime
(
void
);
void
getRandomHexChars
(
char
*
p
,
unsigned
int
len
);
void
getRandomHexChars
(
char
*
p
,
unsigned
int
len
);
uint64_t
crc64
(
const
unsigned
char
*
s
,
uint64_t
l
);
uint64_t
crc64
(
const
unsigned
char
*
s
,
uint64_t
l
);
void
exitFromChild
(
int
retcode
);
/* networking.c -- Networking and Client related operations */
/* networking.c -- Networking and Client related operations */
redisClient
*
createClient
(
int
fd
);
redisClient
*
createClient
(
int
fd
);
...
...
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