8313 Commits

Author SHA1 Message Date
artix
da852aa8b1 Cluster Manager: fix replica assigment anti-affinity (create)
Fix issue #5849
2019-02-20 15:36:15 +01:00
John Sully
627c19e02f Multithreading works! 2019-02-20 01:20:26 -05:00
antirez
94a9e27bb8 Use dictGetFairRandomKey() for RANDOMKEY as well. 2019-02-19 17:29:51 +01:00
antirez
0ad63de59d Set dictGetFairRandomKey() samples to 20 for final version.
Distribution improves dramatically: tests show it clearly. Better to
have a slower implementation than a wrong one, because random member
extraction should be correct or tends to be useless for a number of
tasks.
2019-02-19 17:27:42 +01:00
antirez
963da462fa showfreq.rb: collect more data for better graphs. 2019-02-19 17:25:58 +01:00
antirez
438688d956 Improve README of better-random-member directory. 2019-02-19 12:01:26 +01:00
John Sully
c1031e5f98 Prevent erroneously setting CLIENT_PENDING_WRITE when we have async writes 2019-02-19 01:37:16 -05:00
John Sully
3f4315125c Most tests failing, except some memory and number of PSYNC syncs 2019-02-19 01:11:00 -05:00
John Sully
e9a2b6f561 deadlock fixes 2019-02-18 23:52:21 -05:00
John Sully
0914b52ffa Thread safety fixes 2019-02-18 22:25:35 -05:00
John Sully
e9c1d30749 Extra AE functionality 2019-02-18 18:56:45 -05:00
antirez
c3b4760143 Add showfreq.rb to SRANDMEMBER analysis tools. 2019-02-18 18:47:49 +01:00
antirez
34982b0d0e Limit sampling size in dictGetFairRandomKey().
This way the implementation is almost as fast as the original one, but
the distribution is not too bad.
2019-02-18 18:38:40 +01:00
antirez
aae7e1bff0 Better distribution for set get-random-element operations. 2019-02-18 18:27:18 +01:00
antirez
85cdb79d14 showdist.rb utility for SRANDMEMBER analysis added. 2019-02-18 12:39:07 +01:00
John Sully
65e48b868e Load balance connections across threads (config NYI and hardcoded) 2019-02-16 14:26:19 -05:00
John Sully
c0eb2e5193 Fix recursive fastlock... 2019-02-16 14:25:14 -05:00
John Sully
90c6c37628 make headers C++ safe 2019-02-15 16:55:40 -05:00
John Sully
05685ed792 mitigate race condition in test 2019-02-15 16:55:19 -05:00
John Sully
aed915cebc make networking.c a C++ file 2019-02-15 14:11:34 -05:00
John Sully
8b7e441997 Make the lock recursive, this is because processEventsWhileBlocked may cause us to lock multiple times 2019-02-15 14:11:05 -05:00
John Sully
0f293d4fb0 Fix most failing tests 2019-02-15 10:53:32 -05:00
antirez
78a2115c4c redis-benchmark: default precision=1, integer ms after 2 milliseconds.
Reltaed to discussion and PR #5840.
2019-02-14 13:19:51 +01:00
Salvatore Sanfilippo
e58ed84589 Merge pull request #5840 from madolson/dev-unstable-benchmark-latency
Updated redis benchmark with us precision support
2019-02-14 13:01:26 +01:00
Madelyn Olson
5a1f8fd6f2 Rename variable 2019-02-13 21:03:31 +00:00
Madelyn Olson
b53eec3126 Updated redis benchmark with us precision support 2019-02-13 19:52:48 +00:00
Salvatore Sanfilippo
e973611e01 Merge pull request #5836 from soloestoy/fix-acl-warning
ACL: show categories in COMMAND reply
2019-02-13 18:59:59 +01:00
zhaozhao.zz
3eb2f4ca14 ACL: show categories in COMMAND reply
Adding another new filed categories at the end of
command reply, it's easy to read and distinguish
flags and categories, also compatible with old format.
2019-02-14 00:13:01 +08:00
antirez
ddff560cac ACL: tag LASTSAVE as dangerous.
That's not REALLY needed, but... right now with LASTSAVE being the only
command tagged as "admin" but not "dangerous" what happens is that after
rewrites the rewrite engine will produce from the rules:

    user default on +@all ~* -@dangerous nopass

The rewrite:

    user default on nopass ~* +@all -@admin -@dangerous +lastsave

Which is correct but will have users wondering about why LASTSAVE has
something special.

Since LASTSAVE after all also leaks information about the underlying
server configuration, that may not be great for SAAS vendors, let's tag
it as dangerous as well and forget about this issue :-)
2019-02-13 16:30:44 +01:00
zhaozhao.zz
0eee72b620 ACL: fix cat type format warning 2019-02-13 11:47:10 +08:00
antirez
2c38dc6831 ACL: Document masteruser option in redis.conf. 2019-02-12 18:23:00 +01:00
antirez
1c15e0ff20 ACL: fix setting of FAST flag. 2019-02-12 17:06:26 +01:00
antirez
d78a6fdcbd ACL: CAT subcommand implemented. 2019-02-12 17:02:45 +01:00
Guy Benoish
9cd3b12cdf Trim SDS free space of retained module strings
In some cases processMultibulkBuffer uses sdsMakeRoomFor to
expand the querybuf, but later in some cases it uses that query
buffer as is for an argv element (see "Optimization"), which means
that the sds in argv may have a lot of wasted space, and then in case
modules keep that argv RedisString inside their data structure, this
space waste will remain for long (until restarted from rdb).
2019-02-12 14:21:21 +01:00
Salvatore Sanfilippo
19696ba011 Merge pull request #5833 from soloestoy/masteruser
ACL: add masteruser configuration for replication
2019-02-12 10:27:59 +01:00
zhaozhao.zz
de0f42bff3 ACL: add masteruser configuration for replication
In mostly production environment, normal user's behavior should be
limited.

Now in redis ACL mechanism we can do it like that:

    user default on +@all ~* -@dangerous nopass
    user admin on +@all ~* >someSeriousPassword

Then the default normal user can not execute dangerous commands like
FLUSHALL/KEYS.

But some admin commands are in dangerous category too like PSYNC,
and the configurations above will forbid replica from sync with master.

Finally I think we could add a new configuration for replication,
it is masteruser option, like this:

    masteruser admin
    masterauth someSeriousPassword

Then replica will try AUTH admin someSeriousPassword and get privilege
to execute PSYNC. If masteruser is NULL, replica would AUTH with only
masterauth like before.
2019-02-12 17:12:37 +08:00
antirez
34f11c811d ACL: when client->user is NULL the client is a superuser.
Related to #5832.
2019-02-12 09:44:30 +01:00
antirez
bece806662 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-02-12 09:43:50 +01:00
Salvatore Sanfilippo
be28ee2258 Merge pull request #5832 from soloestoy/show-client-user
ACL: show client's user
2019-02-12 09:42:14 +01:00
zhaozhao.zz
9150d9246e ACL: show client's user 2019-02-12 16:03:58 +08:00
Salvatore Sanfilippo
da3fcfae0b Merge pull request #5831 from lamby/x32-warnings
Don't assume the __x86_64__ pointer size to avoid warnings on x32
2019-02-11 17:17:14 +01:00
Chris Lamb
d2c38031dc Don't assume the __x86_64__ pointer size to avoid warnings on x32.
__x86_64__ is defined on the on the x32 architecture and the conditionals in
debug.c therefore assume the size of (void*) etc:

  debug.c: In function 'getMcontextEip':
  debug.c:757:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       return (void*) uc->uc_mcontext.gregs[16]; /* Linux 64 */
              ^
  debug.c: In function 'logRegisters':
  debug.c:920:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       logStackContent((void**)uc->uc_mcontext.gregs[15]);

We can remedy this by checking for __ILP32__ first. See:

  https://wiki.debian.org/ArchitectureSpecificsMemo

... for more info.
2019-02-11 17:12:27 +01:00
antirez
7983f6e884 ACL: return error when removing a non existing password.
Otherwise it's very simple for an human mistake to think a password is
removed because of a typo in the ACL SETUSER myuser <somepass command
line.
2019-02-11 17:01:58 +01:00
antirez
46243329d4 ACL: refactor+fix AUTH check in processCommand().
The part that is fixed is that now if the default user is off whatever
is its configuration the user is not considered authenticated.
2019-02-11 16:47:02 +01:00
antirez
3822a465f2 ACL: ACLFreeUserAndKillClients(): free user later.
Soon or later we may have code in freeClient() that may have to deal
with ACLs. Imagine for instance the command proposed multiple times (not
sure if this will ever be accepted but still...):

    ONCLOSE DEL mykey

Accumulating commands to run when a client is disconnected. Now the
function is compatible with such use cases.

Related to #5829.
2019-02-11 16:28:31 +01:00
zhaozhao.zz
5cfa46fd14 ACL: kill the old users clients after load aclfile 2019-02-11 16:26:00 +01:00
John Sully
6059bc7e67 Initial work of multithreaded key-db. Note: Fails tests 2019-02-11 03:36:18 -05:00
John Sully
3751d2b737 Fastlock fixes
Former-commit-id: da84b26785b82672ed8217b74464fa294049bc2b
2019-02-10 22:00:19 -05:00
John Sully
eefa3e9168 Fastlock fixes 2019-02-10 22:00:19 -05:00
John Sully
ffad5f32bc move ae to C++
Former-commit-id: eb9070c8333ebe7d6e0d622f90e904c1b17e9710
2019-02-10 20:24:11 -05:00