Commit Graph

8590 Commits

Author SHA1 Message Date
Salvatore Sanfilippo
065872e001
Merge pull request #6551 from pvalsecc/sentinel_kill_pubsub
Redis sentinel kill pubsub client connections as well
2019-11-19 11:53:10 +01:00
antirez
446f24e66d Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-11-19 11:52:40 +01:00
Salvatore Sanfilippo
b311a368e0
Merge pull request #6558 from oranagra/module_testrdb_leak
fix leak in module api rdb test
2019-11-19 11:49:43 +01:00
antirez
936e01e5bb Fix stream test after addition of 0-0 ID test. 2019-11-19 11:49:05 +01:00
Salvatore Sanfilippo
2151b82be9
Merge pull request #6571 from wangzhione/patch-2
Update adlist.h
2019-11-19 11:42:46 +01:00
Salvatore Sanfilippo
06a24b9cfa
Merge pull request #6597 from yossigo/rm-call-extended-errors
Improve RM_Call() errno classification.
2019-11-19 11:41:32 +01:00
Salvatore Sanfilippo
8e95064408
Merge pull request #6134 from zhouyuan/fix_aof
aof: fix assignment for aof_fsync_offset
2019-11-19 11:40:34 +01:00
Salvatore Sanfilippo
397a8b57cc
Merge pull request #6513 from oranagra/test_assertions
test infra: improve prints on failed assertions
2019-11-19 11:34:11 +01:00
antirez
ce03d68332 Rename var to fixed_time_expire now that is more general. 2019-11-19 11:28:04 +01:00
antirez
b42466b925 Fix patch provided in #6554. 2019-11-19 11:23:43 +01:00
Salvatore Sanfilippo
6a9851c7f8
Merge pull request #6554 from soloestoy/unblock-as-call
expires & blocking: handle ready keys as call()
2019-11-19 11:14:05 +01:00
Yossi Gottlieb
2d1e893b3e Improve RM_Call() errno classification.
RM_Call() will now use EBADF and ENONET in addition to EINVAL in order
to provide more information about errors (i.e. when return value is
NULL).
2019-11-19 12:10:48 +02:00
antirez
77ad9aaafe Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-11-19 11:10:35 +01:00
Salvatore Sanfilippo
2f41c8d518
Merge pull request #6512 from MeirShpilraien/scan_module_impl
Added scan implementation to module api.
2019-11-19 11:08:15 +01:00
Salvatore Sanfilippo
656e40eed2
Merge branch 'unstable' into scan_module_impl 2019-11-19 11:08:02 +01:00
antirez
5b80a41cad Remove additional space from comment. 2019-11-19 11:05:55 +01:00
Salvatore Sanfilippo
1530a3cfc6
Merge pull request #6577 from oranagra/module_doc
module docs, missing LOADING flag
2019-11-19 11:02:58 +01:00
Salvatore Sanfilippo
32a8301073
Merge pull request #4076 from yossigo/add_mt_replacevalue
Add RM_ModuleTypeReplaceValue.
2019-11-19 11:00:01 +01:00
Salvatore Sanfilippo
3d89210477
Merge pull request #3383 from yossigo/datatype_load_save
Redis Module API calls to allow re-use of data type RDB save/load.
2019-11-19 10:55:42 +01:00
Salvatore Sanfilippo
a7122f4518
Merge pull request #6579 from oranagra/rm_reply_string_opt
Slightly more efficient RM_ReplyWithEmptyString
2019-11-19 10:54:00 +01:00
Salvatore Sanfilippo
70016f7861
Merge pull request #6574 from guybe7/fix_xadd_empty_id
XADD with ID 0-0 stores an empty key
2019-11-19 10:50:45 +01:00
Salvatore Sanfilippo
64a78f5ba3
Merge pull request #6596 from wangzhione/patch-5
Update mkreleasehdr.sh
2019-11-19 10:48:32 +01:00
喜欢兰花山丘
7c95e89ec3
Update mkreleasehdr.sh
fix date +%s errata
2019-11-19 17:23:47 +08:00
antirez
3243252cb0 Expire cycle: document expire effort in redis.conf. 2019-11-18 18:11:38 +01:00
antirez
e8ceba4e64 Expire cycle: set a buckets limit as well. 2019-11-18 17:47:19 +01:00
antirez
2ab51a644d Expire cycle: fix parameters computation. 2019-11-18 11:43:42 +01:00
antirez
1ccc270a2c Expire cycle: make expire effort configurable. 2019-11-18 11:33:44 +01:00
antirez
84b01f63db Expire cycle: introduce configurable effort. 2019-11-18 11:30:05 +01:00
antirez
2766805680 Expire cycle: tollerate less stale keys, expire cycle CPU in INFO. 2019-11-15 11:29:34 +01:00
antirez
ffc7e509aa Expire cycle: scan hash table buckets directly. 2019-11-15 10:53:19 +01:00
antirez
2f6fe5ce3a Expire cycle: introduce the new state needed for the new algo. 2019-11-14 18:28:01 +01:00
antirez
8d50a8327e Rax library updated. 2019-11-14 12:48:54 +01:00
Oran Agra
c426bbf3a5 Slightly more efficient RM_ReplyWithEmptyString
trimming talk about RESP protocol from API docs (should be independent to that anyway)
2019-11-14 09:46:46 +02:00
Oran Agra
2d30afc45f module docs, missing LOADING flag 2019-11-14 09:09:10 +02:00
Yossi Gottlieb
9c76875f41 Add RM_ModuleTypeReplaceValue.
This is a light-weight replace function, useful for use cases such as
realloc()ing an existing value, etc.  Using RM_ModuleTypeSetValue() in
such cases is wasteful and complex as it attempts to delete the old
value, call its destructor, etc.
2019-11-14 08:50:11 +02:00
Guy Benoish
4a12047c61 XADD with ID 0-0 stores an empty key
Calling XADD with 0-0 or 0 would result in creating an
empty key and storing it in the database.
Even worse, because XADD will reply with error the action
will not be replicated, creating a master-replica
inconsistency
2019-11-13 16:47:30 +05:30
喜欢兰花山丘
253d9d6d12
Update adlist.h
Update listGetFree keep format consistent
2019-11-13 10:14:45 +08:00
Oran Agra
0f8692b464 Add RM_ScanKey to scan hash, set, zset, changes to RM_Scan API
- Adding RM_ScanKey
- Adding tests for RM_ScanKey
- Refactoring RM_Scan API

Changes in RM_Scan
- cleanup in docs and coding convention
- Moving out of experimantal Api
- Adding ctx to scan callback
- Dont use cursor of -1 as an indication of done (can be a valid cursor)
- Set errno when returning 0 for various reasons
- Rename Cursor to ScanCursor
- Test filters key that are not strings, and opens a key if NULL
2019-11-11 16:05:55 +02:00
meir@redislabs.com
11c6ce812a Added scan implementation to module api.
The implementation expose the following new functions:
1. RedisModule_CursorCreate - allow to create a new cursor object for
keys scanning
2. RedisModule_CursorRestart - restart an existing cursor to restart the
scan
3. RedisModule_CursorDestroy - destroy an existing cursor
4. RedisModule_Scan - scan keys

The RedisModule_Scan function gets a cursor object, a callback and void*
(used as user private data).
The callback will be called for each key in the database proving the key
name and the value as RedisModuleKey.
2019-11-11 16:01:41 +02:00
Oran Agra
02f21113ab fix leak in module api rdb test
recently added more reads into that function, if a later read fails, i must
either free what's already allocated, or return the pointer so that the free
callback will release it.
2019-11-10 09:21:19 +02:00
zhaozhao.zz
7059eceeb0 expires & blocking: handle ready keys as call() 2019-11-08 19:06:51 +08:00
Patrick Valsecchi
9593ffde2e
Redis sentinel kill pubsub client connections as well
When a redis instance becomes a slave, sentinel also kills pubsub
clients.

Closes #6545
2019-11-07 08:49:19 +01:00
antirez
0f026af185 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-11-06 17:44:42 +01:00
antirez
8b2c0f9044 Update PR #6537: use a fresh time outside call().
One problem with the solution proposed so far in #6537 is that key
lookups outside a command execution via call(), still used a cached
time. The cached time needed to be refreshed in multiple places,
especially because of modules callbacks from timers, cluster bus, and
thread safe contexts, that may use RM_Open().

In order to avoid this problem, this commit introduces the ability to
detect if we are inside call(): this way we can use the reference fixed
time only when we are in the context of a command execution or Lua
script, but for the asynchronous lookups, we can still use mstime() to
get a fresh time reference.
2019-11-06 09:57:29 +01:00
antirez
824f5f0b7a Update PR #6537 patch to for generality.
After the thread in #6537 and thanks to the suggestions received, this
commit updates the original patch in order to:

1. Solve the problem of updating the time in multiple places by updating
it in call().
2. Avoid introducing a new field but use our cached time.

This required some minor refactoring to the function updating the time,
and the introduction of a new cached time in microseconds in order to
use less gettimeofday() calls.
2019-11-05 10:14:34 +01:00
zhaozhao.zz
e542132b07 expires: refactoring judgment about whether a key is expired
Calling lookupKey*() many times to search a key in one command
may get different result.

That's because lookupKey*() calls expireIfNeeded(), and delete
the key when reach the expire time. So we can get an robj before
the expire time, but a NULL after the expire time.

The worst is that may lead to Redis crash, for example
`RPOPLPUSH foo foo` the first time we get a list form `foo` and
hold the pointer, but when we get `foo` again it's expired and
deleted. Now we hold a freed memory, when execute rpoplpushHandlePush()
redis crash.

To fix it, we can refactor the judgment about whether a key is expired,
using the same basetime `server.cmd_start_mstime` instead of calling
mstime() everytime.
2019-11-05 09:56:39 +01:00
Yossi Gottlieb
5350e7669e Add ModuleDataType to/from string serialization.
Add two new functions that leverage the RedisModuleDataType mechanism
for RDB serialization/deserialization and make it possible to use it
to/from arbitrary strings:

* RM_SaveDataTypeToString()
* RM_LoadDataTypeFromString()
2019-11-04 21:53:59 +02:00
Salvatore Sanfilippo
a15a5d7097
Merge pull request #6540 from oranagra/simple_module_api_tests
Test coverage for new module APIs: dbsize, flushall, randomkey, lru get/set
2019-11-04 18:52:31 +01:00
Oran Agra
3adf10b809 Test coverage for new module APIs: dbsize, flushall, randomkey, lru get/set 2019-11-04 19:30:31 +02:00
Salvatore Sanfilippo
576a7b8caf
Merge pull request #6539 from kristoff-it/unstable
fix unreported overflow in autogerenared stream IDs
2019-11-04 17:37:28 +01:00