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
0f18d8e0
Commit
0f18d8e0
authored
Oct 22, 2018
by
antirez
Browse files
Merge branch 'unstable' of github.com:/antirez/redis into unstable
parents
c33ef454
3f6893a4
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/atomicvar.h
View file @
0f18d8e0
/* This file implements atomic counters using __atomic or __sync macros if
/* This file implements atomic counters using __atomic or __sync macros if
* available, otherwise synchronizing different threads using a mutex.
* available, otherwise synchronizing different threads using a mutex.
*
*
* The exported inter
a
face is composed of three macros:
* The exported interface is composed of three macros:
*
*
* atomicIncr(var,count) -- Increment the atomic counter
* atomicIncr(var,count) -- Increment the atomic counter
* atomicGetIncr(var,oldvalue_var,count) -- Get and increment the atomic counter
* atomicGetIncr(var,oldvalue_var,count) -- Get and increment the atomic counter
...
...
src/cluster.c
View file @
0f18d8e0
...
@@ -5164,10 +5164,10 @@ try_again:
...
@@ -5164,10 +5164,10 @@ try_again:
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkLongLong
(
&
cmd
,
dbid
));
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkLongLong
(
&
cmd
,
dbid
));
}
}
int
expired
=
0
;
/* Number of keys that we'll find
already
expired.
int
non_
expired
=
0
;
/* Number of keys that we'll find
non
expired.
Note that serializing large keys may take some time
Note that serializing large keys may take some time
so certain keys that were found non expired by the
so certain keys that were found non expired by the
lookupKey() function, may be expired later. */
lookupKey() function, may be expired later. */
/* Create RESTORE payload and generate the protocol to call the command. */
/* Create RESTORE payload and generate the protocol to call the command. */
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
...
@@ -5177,11 +5177,12 @@ try_again:
...
@@ -5177,11 +5177,12 @@ try_again:
if
(
expireat
!=
-
1
)
{
if
(
expireat
!=
-
1
)
{
ttl
=
expireat
-
mstime
();
ttl
=
expireat
-
mstime
();
if
(
ttl
<
0
)
{
if
(
ttl
<
0
)
{
expired
++
;
continue
;
continue
;
}
}
if
(
ttl
<
1
)
ttl
=
1
;
if
(
ttl
<
1
)
ttl
=
1
;
}
}
kv
[
non_expired
++
]
=
kv
[
j
];
serverAssertWithInfo
(
c
,
NULL
,
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkCount
(
&
cmd
,
'*'
,
replace
?
5
:
4
));
rioWriteBulkCount
(
&
cmd
,
'*'
,
replace
?
5
:
4
));
...
@@ -5208,6 +5209,7 @@ try_again:
...
@@ -5208,6 +5209,7 @@ try_again:
if
(
replace
)
if
(
replace
)
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkString
(
&
cmd
,
"REPLACE"
,
7
));
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkString
(
&
cmd
,
"REPLACE"
,
7
));
}
}
num_keys
=
non_expired
;
/* Transfer the query to the other node in 64K chunks. */
/* Transfer the query to the other node in 64K chunks. */
errno
=
0
;
errno
=
0
;
...
@@ -5250,7 +5252,7 @@ try_again:
...
@@ -5250,7 +5252,7 @@ try_again:
* command name itself. */
* command name itself. */
if
(
!
copy
)
newargv
=
zmalloc
(
sizeof
(
robj
*
)
*
(
num_keys
+
1
));
if
(
!
copy
)
newargv
=
zmalloc
(
sizeof
(
robj
*
)
*
(
num_keys
+
1
));
for
(
j
=
0
;
j
<
num_keys
-
expired
;
j
++
)
{
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
if
(
syncReadLine
(
cs
->
fd
,
buf2
,
sizeof
(
buf2
),
timeout
)
<=
0
)
{
if
(
syncReadLine
(
cs
->
fd
,
buf2
,
sizeof
(
buf2
),
timeout
)
<=
0
)
{
socket_error
=
1
;
socket_error
=
1
;
break
;
break
;
...
...
src/config.c
View file @
0f18d8e0
...
@@ -120,7 +120,7 @@ const char *configEnumGetName(configEnum *ce, int val) {
...
@@ -120,7 +120,7 @@ const char *configEnumGetName(configEnum *ce, int val) {
return
NULL
;
return
NULL
;
}
}
/* Wrapper for configEnumGetName() returning "unknown" ins
e
tad of NULL if
/* Wrapper for configEnumGetName() returning "unknown" inst
e
ad of NULL if
* there is no match. */
* there is no match. */
const
char
*
configEnumGetNameOrUnknown
(
configEnum
*
ce
,
int
val
)
{
const
char
*
configEnumGetNameOrUnknown
(
configEnum
*
ce
,
int
val
)
{
const
char
*
name
=
configEnumGetName
(
ce
,
val
);
const
char
*
name
=
configEnumGetName
(
ce
,
val
);
...
...
src/db.c
View file @
0f18d8e0
...
@@ -206,7 +206,7 @@ void dbOverwrite(redisDb *db, robj *key, robj *val) {
...
@@ -206,7 +206,7 @@ void dbOverwrite(redisDb *db, robj *key, robj *val) {
* 2) clients WATCHing for the destination key notified.
* 2) clients WATCHing for the destination key notified.
* 3) The expire time of the key is reset (the key is made persistent).
* 3) The expire time of the key is reset (the key is made persistent).
*
*
* All the new keys in the database should be cr
a
eted via this interface. */
* All the new keys in the database should be creted via this interface. */
void
setKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
)
{
void
setKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
)
{
if
(
lookupKeyWrite
(
db
,
key
)
==
NULL
)
{
if
(
lookupKeyWrite
(
db
,
key
)
==
NULL
)
{
dbAdd
(
db
,
key
,
val
);
dbAdd
(
db
,
key
,
val
);
...
...
src/intset.c
View file @
0f18d8e0
...
@@ -123,7 +123,7 @@ static uint8_t intsetSearch(intset *is, int64_t value, uint32_t *pos) {
...
@@ -123,7 +123,7 @@ static uint8_t intsetSearch(intset *is, int64_t value, uint32_t *pos) {
}
else
{
}
else
{
/* Check for the case where we know we cannot find the value,
/* Check for the case where we know we cannot find the value,
* but do know the insert position. */
* but do know the insert position. */
if
(
value
>
_intsetGet
(
is
,
intrev32ifbe
(
is
->
length
)
-
1
))
{
if
(
value
>
_intsetGet
(
is
,
max
))
{
if
(
pos
)
*
pos
=
intrev32ifbe
(
is
->
length
);
if
(
pos
)
*
pos
=
intrev32ifbe
(
is
->
length
);
return
0
;
return
0
;
}
else
if
(
value
<
_intsetGet
(
is
,
0
))
{
}
else
if
(
value
<
_intsetGet
(
is
,
0
))
{
...
...
src/object.c
View file @
0f18d8e0
...
@@ -185,7 +185,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
...
@@ -185,7 +185,7 @@ robj *createStringObjectFromLongDouble(long double value, int humanfriendly) {
/* Duplicate a string object, with the guarantee that the returned object
/* Duplicate a string object, with the guarantee that the returned object
* has the same encoding as the original one.
* has the same encoding as the original one.
*
*
* This function also guarantees that duplicating a small integer
e
object
* This function also guarantees that duplicating a small integer object
* (or a string object that contains a representation of a small integer)
* (or a string object that contains a representation of a small integer)
* will always result in a fresh object that is unshared (refcount == 1).
* will always result in a fresh object that is unshared (refcount == 1).
*
*
...
...
src/quicklist.h
View file @
0f18d8e0
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
* container: 2 bits, NONE=1, ZIPLIST=2.
* container: 2 bits, NONE=1, ZIPLIST=2.
* recompress: 1 bit, bool, true if node is temporarry decompressed for usage.
* recompress: 1 bit, bool, true if node is temporarry decompressed for usage.
* attempted_compress: 1 bit, boolean, used for verifying during testing.
* attempted_compress: 1 bit, boolean, used for verifying during testing.
* extra: 1
2
bits, free for future use; pads out the remainder of 32 bits */
* extra: 1
0
bits, free for future use; pads out the remainder of 32 bits */
typedef
struct
quicklistNode
{
typedef
struct
quicklistNode
{
struct
quicklistNode
*
prev
;
struct
quicklistNode
*
prev
;
struct
quicklistNode
*
next
;
struct
quicklistNode
*
next
;
...
...
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