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
712db71e
Commit
712db71e
authored
Jun 04, 2020
by
antirez
Browse files
TCC: fix SPOP unwanted threaded execution.
parent
561dc2bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_set.c
View file @
712db71e
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
*----------------------------------------------------------------------------*/
*----------------------------------------------------------------------------*/
void
sunionDiffGenericCommand
(
client
*
c
,
robj
**
setkeys
,
int
setnum
,
void
sunionDiffGenericCommand
(
client
*
c
,
robj
**
setkeys
,
int
setnum
,
robj
*
dstkey
,
int
op
);
robj
*
dstkey
,
int
op
,
int
sync
);
/* Factory method to return a set that *can* hold "value". When the object has
/* Factory method to return a set that *can* hold "value". When the object has
* an integer-encodable value, an intset will be returned. Otherwise a regular
* an integer-encodable value, an intset will be returned. Otherwise a regular
...
@@ -436,7 +436,7 @@ void spopWithCountCommand(client *c) {
...
@@ -436,7 +436,7 @@ void spopWithCountCommand(client *c) {
* the number of elements inside the set: simply return the whole set. */
* the number of elements inside the set: simply return the whole set. */
if
(
count
>=
size
)
{
if
(
count
>=
size
)
{
/* We just return the entire set */
/* We just return the entire set */
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
1
,
NULL
,
SET_OP_UNION
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
1
,
NULL
,
SET_OP_UNION
,
1
);
/* Delete the set as it is now empty */
/* Delete the set as it is now empty */
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
...
@@ -663,7 +663,7 @@ void srandmemberWithCountCommand(client *c) {
...
@@ -663,7 +663,7 @@ void srandmemberWithCountCommand(client *c) {
* The number of requested elements is greater than the number of
* The number of requested elements is greater than the number of
* elements inside the set: simply return the whole set. */
* elements inside the set: simply return the whole set. */
if
(
count
>=
size
)
{
if
(
count
>=
size
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
1
,
NULL
,
SET_OP_UNION
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
1
,
NULL
,
SET_OP_UNION
,
0
);
return
;
return
;
}
}
...
@@ -1091,9 +1091,9 @@ void sunionDiffThreadedHalf(client *c, void *options) {
...
@@ -1091,9 +1091,9 @@ void sunionDiffThreadedHalf(client *c, void *options) {
}
}
void
sunionDiffGenericCommand
(
client
*
c
,
robj
**
setkeys
,
int
setnum
,
void
sunionDiffGenericCommand
(
client
*
c
,
robj
**
setkeys
,
int
setnum
,
robj
*
dstkey
,
int
op
)
{
robj
*
dstkey
,
int
op
,
int
sync
)
{
robj
**
sets
=
zmalloc
(
sizeof
(
robj
*
)
*
setnum
);
robj
**
sets
=
zmalloc
(
sizeof
(
robj
*
)
*
setnum
);
int
threaded
=
(
dstkey
==
NULL
);
int
threaded
=
(
dstkey
==
NULL
&&
!
sync
);
for
(
int
j
=
0
;
j
<
setnum
;
j
++
)
{
for
(
int
j
=
0
;
j
<
setnum
;
j
++
)
{
robj
*
setobj
=
dstkey
?
robj
*
setobj
=
dstkey
?
...
@@ -1136,19 +1136,19 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
...
@@ -1136,19 +1136,19 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
}
}
void
sunionCommand
(
client
*
c
)
{
void
sunionCommand
(
client
*
c
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
c
->
argc
-
1
,
NULL
,
SET_OP_UNION
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
c
->
argc
-
1
,
NULL
,
SET_OP_UNION
,
0
);
}
}
void
sunionstoreCommand
(
client
*
c
)
{
void
sunionstoreCommand
(
client
*
c
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
SET_OP_UNION
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
SET_OP_UNION
,
1
);
}
}
void
sdiffCommand
(
client
*
c
)
{
void
sdiffCommand
(
client
*
c
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
c
->
argc
-
1
,
NULL
,
SET_OP_DIFF
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
1
,
c
->
argc
-
1
,
NULL
,
SET_OP_DIFF
,
0
);
}
}
void
sdiffstoreCommand
(
client
*
c
)
{
void
sdiffstoreCommand
(
client
*
c
)
{
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
SET_OP_DIFF
);
sunionDiffGenericCommand
(
c
,
c
->
argv
+
2
,
c
->
argc
-
2
,
c
->
argv
[
1
],
SET_OP_DIFF
,
1
);
}
}
void
sscanCommand
(
client
*
c
)
{
void
sscanCommand
(
client
*
c
)
{
...
...
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