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
a0e7e5f5
Commit
a0e7e5f5
authored
May 07, 2010
by
antirez
Browse files
swap file name pid expansion removed. Not suited for mission critical software...
parent
8b5bb414
Changes
3
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
a0e7e5f5
...
@@ -4485,7 +4485,6 @@ static void shutdownCommand(redisClient *c) {
...
@@ -4485,7 +4485,6 @@ static void shutdownCommand(redisClient *c) {
unlink
(
server
.
pidfile
);
unlink
(
server
.
pidfile
);
redisLog
(
REDIS_WARNING
,
"%zu bytes used at exit"
,
zmalloc_used_memory
());
redisLog
(
REDIS_WARNING
,
"%zu bytes used at exit"
,
zmalloc_used_memory
());
redisLog
(
REDIS_WARNING
,
"Server exit now, bye bye..."
);
redisLog
(
REDIS_WARNING
,
"Server exit now, bye bye..."
);
if
(
server
.
vm_enabled
)
unlink
(
server
.
vm_swap_file
);
exit
(
0
);
exit
(
0
);
}
else
{
}
else
{
/* Ooops.. error saving! The best we can do is to continue
/* Ooops.. error saving! The best we can do is to continue
...
@@ -8584,22 +8583,6 @@ static void aofRemoveTempFile(pid_t childpid) {
...
@@ -8584,22 +8583,6 @@ static void aofRemoveTempFile(pid_t childpid) {
/* =================== Virtual Memory - Blocking Side ====================== */
/* =================== Virtual Memory - Blocking Side ====================== */
/* substitute the first occurrence of '%p' with the process pid in the
* swap file name. */
static
void
expandVmSwapFilename
(
void
)
{
char
*
p
=
strstr
(
server
.
vm_swap_file
,
"%p"
);
sds
new
;
if
(
!
p
)
return
;
new
=
sdsempty
();
*
p
=
'\0'
;
new
=
sdscat
(
new
,
server
.
vm_swap_file
);
new
=
sdscatprintf
(
new
,
"%ld"
,(
long
)
getpid
());
new
=
sdscat
(
new
,
p
+
2
);
zfree
(
server
.
vm_swap_file
);
server
.
vm_swap_file
=
new
;
}
static
void
vmInit
(
void
)
{
static
void
vmInit
(
void
)
{
off_t
totsize
;
off_t
totsize
;
int
pipefds
[
2
];
int
pipefds
[
2
];
...
@@ -8609,7 +8592,6 @@ static void vmInit(void) {
...
@@ -8609,7 +8592,6 @@ static void vmInit(void) {
if
(
server
.
vm_max_threads
!=
0
)
if
(
server
.
vm_max_threads
!=
0
)
zmalloc_enable_thread_safeness
();
/* we need thread safe zmalloc() */
zmalloc_enable_thread_safeness
();
/* we need thread safe zmalloc() */
expandVmSwapFilename
();
redisLog
(
REDIS_NOTICE
,
"Using '%s' as swap file"
,
server
.
vm_swap_file
);
redisLog
(
REDIS_NOTICE
,
"Using '%s' as swap file"
,
server
.
vm_swap_file
);
/* Try to open the old swap file, otherwise create it */
/* Try to open the old swap file, otherwise create it */
if
((
server
.
vm_fp
=
fopen
(
server
.
vm_swap_file
,
"r+b"
))
==
NULL
)
{
if
((
server
.
vm_fp
=
fopen
(
server
.
vm_swap_file
,
"r+b"
))
==
NULL
)
{
...
...
redis.conf
View file @
a0e7e5f5
...
@@ -206,20 +206,16 @@ vm-enabled no
...
@@ -206,20 +206,16 @@ vm-enabled no
# This is the path of the Redis swap file. As you can guess, swap files
# This is the path of the Redis swap file. As you can guess, swap files
# can't be shared by different Redis instances, so make sure to use a swap
# can't be shared by different Redis instances, so make sure to use a swap
# file for every redis process you are running.
# file for every redis process you are running. Redis will complain if the
# swap file is already in use.
#
#
# The swap file name may contain "%p" that is substituted with the PID of
# The best kind of storage for the Redis swap file (that's accessed at random)
# the Redis process, so the default name /tmp/redis-%p.vm will work even
# is a Solid State Disk (SSD).
# with multiple instances as Redis will use, for example, redis-811.vm
# for one instance and redis-593.vm for another one.
#
# Useless to say, the best kind of disk for a Redis swap file (that's accessed
# at random) is a Solid State Disk (SSD).
#
#
# *** WARNING *** if you are using a shared hosting the default of putting
# *** WARNING *** if you are using a shared hosting the default of putting
# the swap file under /tmp is not secure. Create a dir with access granted
# the swap file under /tmp is not secure. Create a dir with access granted
# only to Redis user and configure Redis to create the swap file there.
# only to Redis user and configure Redis to create the swap file there.
vm
-
swap
-
file
/
tmp
/
redis
-%
p
.
vm
vm
-
swap
-
file
/
tmp
/
redis
.
swap
# vm-max-memory configures the VM to use at max the specified amount of
# vm-max-memory configures the VM to use at max the specified amount of
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
...
...
staticsymbols.h
View file @
a0e7e5f5
static
struct
redisFunctionSym
symsTable
[]
=
{
static
struct
redisFunctionSym
symsTable
[]
=
{
{
"IOThreadEntryPoint"
,(
unsigned
long
)
IOThreadEntryPoint
},
{
"IOThreadEntryPoint"
,(
unsigned
long
)
IOThreadEntryPoint
},
{
"_redisAssert"
,(
unsigned
long
)
_redisAssert
},
{
"_redisAssert"
,(
unsigned
long
)
_redisAssert
},
{
"_redisPanic"
,(
unsigned
long
)
_redisPanic
},
{
"acceptHandler"
,(
unsigned
long
)
acceptHandler
},
{
"acceptHandler"
,(
unsigned
long
)
acceptHandler
},
{
"addReply"
,(
unsigned
long
)
addReply
},
{
"addReply"
,(
unsigned
long
)
addReply
},
{
"addReplyBulk"
,(
unsigned
long
)
addReplyBulk
},
{
"addReplyBulk"
,(
unsigned
long
)
addReplyBulk
},
...
@@ -41,6 +42,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -41,6 +42,7 @@ static struct redisFunctionSym symsTable[] = {
{
"createSharedObjects"
,(
unsigned
long
)
createSharedObjects
},
{
"createSharedObjects"
,(
unsigned
long
)
createSharedObjects
},
{
"createSortOperation"
,(
unsigned
long
)
createSortOperation
},
{
"createSortOperation"
,(
unsigned
long
)
createSortOperation
},
{
"createStringObject"
,(
unsigned
long
)
createStringObject
},
{
"createStringObject"
,(
unsigned
long
)
createStringObject
},
{
"createStringObjectFromLongLong"
,(
unsigned
long
)
createStringObjectFromLongLong
},
{
"createZsetObject"
,(
unsigned
long
)
createZsetObject
},
{
"createZsetObject"
,(
unsigned
long
)
createZsetObject
},
{
"daemonize"
,(
unsigned
long
)
daemonize
},
{
"daemonize"
,(
unsigned
long
)
daemonize
},
{
"dbsizeCommand"
,(
unsigned
long
)
dbsizeCommand
},
{
"dbsizeCommand"
,(
unsigned
long
)
dbsizeCommand
},
...
@@ -63,14 +65,15 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -63,14 +65,15 @@ static struct redisFunctionSym symsTable[] = {
{
"dupStringObject"
,(
unsigned
long
)
dupStringObject
},
{
"dupStringObject"
,(
unsigned
long
)
dupStringObject
},
{
"echoCommand"
,(
unsigned
long
)
echoCommand
},
{
"echoCommand"
,(
unsigned
long
)
echoCommand
},
{
"execCommand"
,(
unsigned
long
)
execCommand
},
{
"execCommand"
,(
unsigned
long
)
execCommand
},
{
"execCommandReplicateMulti"
,(
unsigned
long
)
execCommandReplicateMulti
},
{
"existsCommand"
,(
unsigned
long
)
existsCommand
},
{
"existsCommand"
,(
unsigned
long
)
existsCommand
},
{
"expandVmSwapFilename"
,(
unsigned
long
)
expandVmSwapFilename
},
{
"expireCommand"
,(
unsigned
long
)
expireCommand
},
{
"expireCommand"
,(
unsigned
long
)
expireCommand
},
{
"expireGenericCommand"
,(
unsigned
long
)
expireGenericCommand
},
{
"expireGenericCommand"
,(
unsigned
long
)
expireGenericCommand
},
{
"expireIfNeeded"
,(
unsigned
long
)
expireIfNeeded
},
{
"expireIfNeeded"
,(
unsigned
long
)
expireIfNeeded
},
{
"expireatCommand"
,(
unsigned
long
)
expireatCommand
},
{
"expireatCommand"
,(
unsigned
long
)
expireatCommand
},
{
"feedAppendOnlyFile"
,(
unsigned
long
)
feedAppendOnlyFile
},
{
"feedAppendOnlyFile"
,(
unsigned
long
)
feedAppendOnlyFile
},
{
"findFuncName"
,(
unsigned
long
)
findFuncName
},
{
"findFuncName"
,(
unsigned
long
)
findFuncName
},
{
"flushAppendOnlyFile"
,(
unsigned
long
)
flushAppendOnlyFile
},
{
"flushallCommand"
,(
unsigned
long
)
flushallCommand
},
{
"flushallCommand"
,(
unsigned
long
)
flushallCommand
},
{
"flushdbCommand"
,(
unsigned
long
)
flushdbCommand
},
{
"flushdbCommand"
,(
unsigned
long
)
flushdbCommand
},
{
"freeClient"
,(
unsigned
long
)
freeClient
},
{
"freeClient"
,(
unsigned
long
)
freeClient
},
...
@@ -94,13 +97,29 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -94,13 +97,29 @@ static struct redisFunctionSym symsTable[] = {
{
"genericZrangebyscoreCommand"
,(
unsigned
long
)
genericZrangebyscoreCommand
},
{
"genericZrangebyscoreCommand"
,(
unsigned
long
)
genericZrangebyscoreCommand
},
{
"getCommand"
,(
unsigned
long
)
getCommand
},
{
"getCommand"
,(
unsigned
long
)
getCommand
},
{
"getDecodedObject"
,(
unsigned
long
)
getDecodedObject
},
{
"getDecodedObject"
,(
unsigned
long
)
getDecodedObject
},
{
"getDoubleFromObject"
,(
unsigned
long
)
getDoubleFromObject
},
{
"getDoubleFromObjectOrReply"
,(
unsigned
long
)
getDoubleFromObjectOrReply
},
{
"getExpire"
,(
unsigned
long
)
getExpire
},
{
"getExpire"
,(
unsigned
long
)
getExpire
},
{
"getGenericCommand"
,(
unsigned
long
)
getGenericCommand
},
{
"getGenericCommand"
,(
unsigned
long
)
getGenericCommand
},
{
"getLongFromObjectOrReply"
,(
unsigned
long
)
getLongFromObjectOrReply
},
{
"getLongLongFromObject"
,(
unsigned
long
)
getLongLongFromObject
},
{
"getLongLongFromObjectOrReply"
,(
unsigned
long
)
getLongLongFromObjectOrReply
},
{
"getMcontextEip"
,(
unsigned
long
)
getMcontextEip
},
{
"getMcontextEip"
,(
unsigned
long
)
getMcontextEip
},
{
"getsetCommand"
,(
unsigned
long
)
getsetCommand
},
{
"getsetCommand"
,(
unsigned
long
)
getsetCommand
},
{
"glueReplyBuffersIfNeeded"
,(
unsigned
long
)
glueReplyBuffersIfNeeded
},
{
"glueReplyBuffersIfNeeded"
,(
unsigned
long
)
glueReplyBuffersIfNeeded
},
{
"handleClientsBlockedOnSwappedKey"
,(
unsigned
long
)
handleClientsBlockedOnSwappedKey
},
{
"handleClientsBlockedOnSwappedKey"
,(
unsigned
long
)
handleClientsBlockedOnSwappedKey
},
{
"handleClientsWaitingListPush"
,(
unsigned
long
)
handleClientsWaitingListPush
},
{
"handleClientsWaitingListPush"
,(
unsigned
long
)
handleClientsWaitingListPush
},
{
"hashCurrent"
,(
unsigned
long
)
hashCurrent
},
{
"hashDelete"
,(
unsigned
long
)
hashDelete
},
{
"hashExists"
,(
unsigned
long
)
hashExists
},
{
"hashGet"
,(
unsigned
long
)
hashGet
},
{
"hashInitIterator"
,(
unsigned
long
)
hashInitIterator
},
{
"hashLookupWriteOrCreate"
,(
unsigned
long
)
hashLookupWriteOrCreate
},
{
"hashNext"
,(
unsigned
long
)
hashNext
},
{
"hashReleaseIterator"
,(
unsigned
long
)
hashReleaseIterator
},
{
"hashSet"
,(
unsigned
long
)
hashSet
},
{
"hashTryConversion"
,(
unsigned
long
)
hashTryConversion
},
{
"hashTryObjectEncoding"
,(
unsigned
long
)
hashTryObjectEncoding
},
{
"hdelCommand"
,(
unsigned
long
)
hdelCommand
},
{
"hdelCommand"
,(
unsigned
long
)
hdelCommand
},
{
"hexistsCommand"
,(
unsigned
long
)
hexistsCommand
},
{
"hexistsCommand"
,(
unsigned
long
)
hexistsCommand
},
{
"hgetCommand"
,(
unsigned
long
)
hgetCommand
},
{
"hgetCommand"
,(
unsigned
long
)
hgetCommand
},
...
@@ -108,13 +127,17 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -108,13 +127,17 @@ static struct redisFunctionSym symsTable[] = {
{
"hincrbyCommand"
,(
unsigned
long
)
hincrbyCommand
},
{
"hincrbyCommand"
,(
unsigned
long
)
hincrbyCommand
},
{
"hkeysCommand"
,(
unsigned
long
)
hkeysCommand
},
{
"hkeysCommand"
,(
unsigned
long
)
hkeysCommand
},
{
"hlenCommand"
,(
unsigned
long
)
hlenCommand
},
{
"hlenCommand"
,(
unsigned
long
)
hlenCommand
},
{
"hmgetCommand"
,(
unsigned
long
)
hmgetCommand
},
{
"hmsetCommand"
,(
unsigned
long
)
hmsetCommand
},
{
"hsetCommand"
,(
unsigned
long
)
hsetCommand
},
{
"hsetCommand"
,(
unsigned
long
)
hsetCommand
},
{
"hsetnxCommand"
,(
unsigned
long
)
hsetnxCommand
},
{
"htNeedsResize"
,(
unsigned
long
)
htNeedsResize
},
{
"htNeedsResize"
,(
unsigned
long
)
htNeedsResize
},
{
"hvalsCommand"
,(
unsigned
long
)
hvalsCommand
},
{
"hvalsCommand"
,(
unsigned
long
)
hvalsCommand
},
{
"incrCommand"
,(
unsigned
long
)
incrCommand
},
{
"incrCommand"
,(
unsigned
long
)
incrCommand
},
{
"incrDecrCommand"
,(
unsigned
long
)
incrDecrCommand
},
{
"incrDecrCommand"
,(
unsigned
long
)
incrDecrCommand
},
{
"incrRefCount"
,(
unsigned
long
)
incrRefCount
},
{
"incrRefCount"
,(
unsigned
long
)
incrRefCount
},
{
"incrbyCommand"
,(
unsigned
long
)
incrbyCommand
},
{
"incrbyCommand"
,(
unsigned
long
)
incrbyCommand
},
{
"incrementallyRehash"
,(
unsigned
long
)
incrementallyRehash
},
{
"infoCommand"
,(
unsigned
long
)
infoCommand
},
{
"infoCommand"
,(
unsigned
long
)
infoCommand
},
{
"initClientMultiState"
,(
unsigned
long
)
initClientMultiState
},
{
"initClientMultiState"
,(
unsigned
long
)
initClientMultiState
},
{
"initServer"
,(
unsigned
long
)
initServer
},
{
"initServer"
,(
unsigned
long
)
initServer
},
...
@@ -197,6 +220,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -197,6 +220,7 @@ static struct redisFunctionSym symsTable[] = {
{
"renameCommand"
,(
unsigned
long
)
renameCommand
},
{
"renameCommand"
,(
unsigned
long
)
renameCommand
},
{
"renameGenericCommand"
,(
unsigned
long
)
renameGenericCommand
},
{
"renameGenericCommand"
,(
unsigned
long
)
renameGenericCommand
},
{
"renamenxCommand"
,(
unsigned
long
)
renamenxCommand
},
{
"renamenxCommand"
,(
unsigned
long
)
renamenxCommand
},
{
"replicationFeedMonitors"
,(
unsigned
long
)
replicationFeedMonitors
},
{
"replicationFeedSlaves"
,(
unsigned
long
)
replicationFeedSlaves
},
{
"replicationFeedSlaves"
,(
unsigned
long
)
replicationFeedSlaves
},
{
"resetClient"
,(
unsigned
long
)
resetClient
},
{
"resetClient"
,(
unsigned
long
)
resetClient
},
{
"resetServerSaveParams"
,(
unsigned
long
)
resetServerSaveParams
},
{
"resetServerSaveParams"
,(
unsigned
long
)
resetServerSaveParams
},
...
@@ -211,6 +235,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -211,6 +235,7 @@ static struct redisFunctionSym symsTable[] = {
{
"sdiffCommand"
,(
unsigned
long
)
sdiffCommand
},
{
"sdiffCommand"
,(
unsigned
long
)
sdiffCommand
},
{
"sdiffstoreCommand"
,(
unsigned
long
)
sdiffstoreCommand
},
{
"sdiffstoreCommand"
,(
unsigned
long
)
sdiffstoreCommand
},
{
"sdsDictKeyCompare"
,(
unsigned
long
)
sdsDictKeyCompare
},
{
"sdsDictKeyCompare"
,(
unsigned
long
)
sdsDictKeyCompare
},
{
"sdscatrepr"
,(
unsigned
long
)
sdscatrepr
},
{
"segvHandler"
,(
unsigned
long
)
segvHandler
},
{
"segvHandler"
,(
unsigned
long
)
segvHandler
},
{
"selectCommand"
,(
unsigned
long
)
selectCommand
},
{
"selectCommand"
,(
unsigned
long
)
selectCommand
},
{
"selectDb"
,(
unsigned
long
)
selectDb
},
{
"selectDb"
,(
unsigned
long
)
selectDb
},
...
@@ -221,6 +246,7 @@ static struct redisFunctionSym symsTable[] = {
...
@@ -221,6 +246,7 @@ static struct redisFunctionSym symsTable[] = {
{
"setCommand"
,(
unsigned
long
)
setCommand
},
{
"setCommand"
,(
unsigned
long
)
setCommand
},
{
"setExpire"
,(
unsigned
long
)
setExpire
},
{
"setExpire"
,(
unsigned
long
)
setExpire
},
{
"setGenericCommand"
,(
unsigned
long
)
setGenericCommand
},
{
"setGenericCommand"
,(
unsigned
long
)
setGenericCommand
},
{
"setexCommand"
,(
unsigned
long
)
setexCommand
},
{
"setnxCommand"
,(
unsigned
long
)
setnxCommand
},
{
"setnxCommand"
,(
unsigned
long
)
setnxCommand
},
{
"setupSigSegvAction"
,(
unsigned
long
)
setupSigSegvAction
},
{
"setupSigSegvAction"
,(
unsigned
long
)
setupSigSegvAction
},
{
"shutdownCommand"
,(
unsigned
long
)
shutdownCommand
},
{
"shutdownCommand"
,(
unsigned
long
)
shutdownCommand
},
...
...
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