Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitmap feature merge #275

Closed
wants to merge 120 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
2a19ddf
roaring bitmap imp
VCgege1 Dec 13, 2023
f4dd7a7
roaring bitmap test
VCgege Dec 27, 2023
003b64d
bitmap swap imp
VCgege Jan 2, 2024
af89b51
bitmap swap imp0
VCgege Jan 23, 2024
5f4a164
bitmap swap imp1
VCgege Jan 25, 2024
f670dad
bitmap swap imp2
VCgege Jan 29, 2024
b769278
bitmap swap imp3
VCgege Feb 4, 2024
9f291ac
bitmap swap imp4 for rdb
VCgege Feb 20, 2024
315dc3b
bitmap swap imp5 for style modify
VCgege Feb 23, 2024
171478d
bitmap swap imp6 for style modify
VCgege Feb 23, 2024
6c0984d
bitmap swap imp7 for style modify
VCgege Feb 26, 2024
3aa3edf
bitmap swap imp8 for style modify
VCgege Feb 27, 2024
a607c80
bitmap swap imp9
VCgege Feb 28, 2024
5b4cbd5
bitmap rdb imp10
VCgege Feb 29, 2024
1c9d8c0
bitmap rdb imp11
VCgege Mar 11, 2024
0d00d3e
bitmap: extend swap framework to support bitmap&string type convert.
patpatbear Feb 22, 2024
e7b2e4f
minor fix
patpatbear Feb 22, 2024
0c7ed3e
bitmap type extension imp12
VCgege Mar 12, 2024
064c49c
bitmap type extension imp13
VCgege Mar 12, 2024
b6e8b10
bitmap save load modify imp14
VCgege Mar 12, 2024
3ddc084
bitmap save load modify imp15
VCgege Mar 13, 2024
461b6b1
bitmap meta_marker & switch info modify imp16
VCgege Mar 13, 2024
aed0db1
bitmap test modify imp17
VCgege Mar 14, 2024
b9c3619
bitmap test modify imp18
VCgege Mar 18, 2024
e619b47
bitmap debug imp19
VCgege Mar 20, 2024
0c960ad
bitmap refactor imp20
VCgege Mar 25, 2024
81d949f
bitmap load refactor imp21
VCgege Mar 25, 2024
d60a765
bitmap style refactor imp22
VCgege Mar 25, 2024
f602dda
Merge branch 'xredis_2_ror' into bitmap_push
VCgege Mar 25, 2024
0033361
bitmap unit test imp23
VCgege Mar 25, 2024
b6d2996
[wip]bitmap tcl test
adzfolc Mar 26, 2024
e119c54
bitmap unit test imp24
VCgege Mar 27, 2024
f64d54b
bitmap debug imp25
VCgege Mar 27, 2024
af1815f
[wip]bitmap tcl test: swap in/out data case
adzfolc Mar 26, 2024
1b13c14
bitmap debug imp26
VCgege Mar 27, 2024
37a2798
bitmap debug imp27
VCgege Mar 28, 2024
ca3a6b1
bitmap debug imp28
VCgege Mar 29, 2024
a66787e
[wip]tcl todo: warm case
adzfolc Mar 29, 2024
7cef9b9
bitmap debug imp29
VCgege Mar 29, 2024
d01b500
fix tcl test
adzfolc Apr 1, 2024
a8d4973
bitmap fix review imp30
VCgege Apr 1, 2024
1aa0b75
add conf to prevent auto evict
adzfolc Apr 1, 2024
749d153
fix bitmap chaos test
adzfolc Apr 1, 2024
4eabf5d
bitmap fix bitcount bitpos imp31
VCgege Apr 2, 2024
f146b05
bitmap fix tcl imp32
VCgege Apr 2, 2024
21e2fa4
bitmap fix bitpos imp33
VCgege Apr 3, 2024
405579b
bitmap tcl add imp34
VCgege Apr 3, 2024
728536e
bitmap tcl add & bugfix imp35
VCgege Apr 7, 2024
427e540
bitmap tcl add & bugfix swap in/out imp36
VCgege Apr 9, 2024
6a0b3c4
bitmap bugfix bitcount imp37
VCgege Apr 10, 2024
344c1f2
bitmap swap in modify imp38
VCgege Apr 10, 2024
e275827
add tcl bitmap pure hot test
adzfolc Apr 9, 2024
eb8a1aa
Merge branch 'xredis_2_ror' into bitmap_push
adzfolc Apr 10, 2024
4f6e170
bitmap bitcount bug fix & tcl add imp39
VCgege Apr 10, 2024
74b84c3
fix bitmap warm check
adzfolc Apr 12, 2024
467e0f0
bitmap tcl add imp40
VCgege Apr 11, 2024
6b92cab
persist: add tcl test & failed case
adzfolc Apr 12, 2024
7f2e7e3
persist: add tcl test
adzfolc Apr 13, 2024
8387d42
bitmap tcl add imp41
VCgege Apr 15, 2024
ce0f16f
bitmap tcl add small bitmap imp42
VCgege Apr 15, 2024
1ae1e64
bitmap persist.tcl
adzfolc Apr 12, 2024
ae7245d
bitmap rordb bug fix imp43
VCgege Apr 16, 2024
4781fb8
bitmap helper.tcl modify imp44
VCgege Apr 16, 2024
82b9333
fix: asan && warning, todo: asan && assert
adzfolc Apr 13, 2024
ea83986
bitmap tcl add & code modify imp45
VCgege Apr 16, 2024
57486e2
fix: memory leak
adzfolc Apr 17, 2024
c0fab1a
refactor
adzfolc Apr 23, 2024
cc84f45
bitmap chaos test assert failed bug fix imp46
VCgege Apr 23, 2024
67b053e
refactor
adzfolc Apr 23, 2024
3b6d451
fix
adzfolc Apr 24, 2024
c9dabac
refactor
adzfolc Apr 24, 2024
62c112e
refactor
adzfolc Apr 24, 2024
43128da
todo: func rename 0/1
adzfolc Apr 24, 2024
1d0efb5
todo: func rename 0/1
adzfolc Apr 24, 2024
c3c4a05
bitmap unit test fix imp47
VCgege Apr 24, 2024
b850aef
bitmap tcl modify test name imp48
VCgege Apr 24, 2024
0526564
bitmap tcl bug fix & chaos fix imp49
VCgege Apr 24, 2024
7826572
bitmap fix issue#131 & drop move cmd test & tcl modify imp50
VCgege Apr 25, 2024
e1dd920
bitmap clear warning imp51
VCgege Apr 25, 2024
3c0f2b3
bitmap revert wrong commit imp52
VCgege Apr 25, 2024
f4d8cb0
[refact] bitmap.tcl rename check_small_bitmap1_bitop
adzfolc Apr 25, 2024
a0cd810
[refact] bitmap.tcl rename check_extend_small_bitmap_bitop
adzfolc Apr 25, 2024
cda0a7a
[fix] typo
adzfolc Apr 25, 2024
678aca4
[refact] check_mybitmap_bitpos
adzfolc Apr 25, 2024
a93ddb0
[refact] check_mybitmap_bitcount & check_mybitmap_getbit
adzfolc Apr 25, 2024
7170255
revert chaos
adzfolc Apr 25, 2024
8be30bc
[refact] check_extend_small_bitmap_is_right
adzfolc Apr 26, 2024
ac97891
[refact] check_small_bitmap_is_right
adzfolc Apr 26, 2024
edb86d0
[refact] check_extend_mybitmap1_is_right
adzfolc Apr 26, 2024
31171af
[refact] check_mybitmap1_bitpos
adzfolc Apr 26, 2024
5bc48bb
[refact] check.*mybitmap_bitop_xor.*
adzfolc Apr 26, 2024
ba8a627
[refact] small_bitmap1_getbit && small_bitmap_bitcount
adzfolc Apr 26, 2024
6b63cb1
[refact] add pattern replace func
adzfolc Apr 26, 2024
7be1c0f
[refact] small_bitmap_bitpos & typo
adzfolc Apr 26, 2024
bad59cb
[refact] similar case
adzfolc Apr 28, 2024
4f8fca2
[refact] small bitmap swap & rdb case
adzfolc Apr 28, 2024
357a4f3
[refact] fix format error
adzfolc Apr 28, 2024
13090d5
[refact] fix typo && refact similar
adzfolc Apr 28, 2024
ac447cd
bitmap bug fix issue #135 imp54
VCgege Apr 28, 2024
40e712a
refactor
patpatbear Apr 25, 2024
8f500df
bitmap tcl fix imp53
VCgege Apr 26, 2024
99c4786
review bitmap load & save.
patpatbear May 6, 2024
a113273
bitmap fix get_info_property err in tcl imp55
VCgege May 11, 2024
eacbb18
bitmap add ror tcl imp56
VCgege May 17, 2024
266104f
bitmap fix issue#139 #140 imp57
VCgege May 25, 2024
47d5e96
Merge branch 'xredis_2_ror' into bitmap_push
VCgege Jun 4, 2024
c9710f6
bitmap fix #131 (1) imp58
VCgege Jun 4, 2024
65c5039
bitmap modify swap in imp59
VCgege Jun 4, 2024
4d893d1
bitmap little modify imp60
VCgege Jun 4, 2024
8bf2af2
bitmap empty bitmap object fix issue #131 imp61
VCgege Apr 29, 2024
7fcd1c0
bitmap bug in !! fix #131 imp61
VCgege Jun 4, 2024
0fa18ae
bitmap bug test #131 imp62
VCgege Jun 4, 2024
fc5b898
bitmap allow empty string trans to bitmap #131 imp63
VCgege Jun 4, 2024
d2d391e
bitmap delete useless code imp64
VCgege Jun 5, 2024
75dbe5e
bitmap fix #141 imp65
VCgege Jun 5, 2024
81f64ea
opt: refcount
May 30, 2024
3a13237
bitmap add tcl & unit case imp66
VCgege Jun 5, 2024
dc784d4
bitmap fix review @rdbSaveRawString imp67
VCgege Jun 5, 2024
f42e5cb
bitmap bitops modify imp68
VCgege Jun 5, 2024
6952f61
bitmap warning process imp69
VCgege Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions redis.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,11 @@ notify-keyspace-events ""
# gopher-enabled no

############################### ADVANCED CONFIG ###############################
# Bitmap object are processed as subkey during swap-in or swap-out in ROR. Different size of subkey
# may have an impact on performance. Which size is best may depends on the hardware. It's recommended to
# keep same as the minimum read/write unit of SSD or HDD. Default size is 4096 bytes. Do not modify it
# during the server running!!!
bitmap-subkey-size 4096

# Hashes are encoded using a memory efficient data structure when they have a
# small number of entries, and the biggest entry does not exceed a given
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ endif

REDIS_SERVER_NAME=redis-server$(PROG_SUFFIX)
REDIS_SENTINEL_NAME=redis-sentinel$(PROG_SUFFIX)
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o gopher.o tracking.o connection.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o ctrip.o ctrip_swap.o ctrip_swap_adlist.o ctrip_lru_cache.o ctrip_swap_async.o ctrip_swap_batch.o ctrip_swap_cmd.o ctrip_swap_data.o ctrip_swap_debug.o ctrip_swap_evict.o ctrip_swap_exec.o ctrip_swap_expire.o ctrip_swap_hash.o ctrip_swap_set.o ctrip_swap_list.o ctrip_swap_iter.o ctrip_swap_zset.o ctrip_swap_meta.o ctrip_swap_object.o ctrip_swap_rdb.o ctrip_swap_repl.o ctrip_swap_rio.o ctrip_swap_rocks.o ctrip_swap_stat.o ctrip_swap_sync.o ctrip_swap_thread.o ctrip_swap_util.o ctrip_swap_lock.o ctrip_swap_string.o ctrip_swap_compact.o ctrip_swap_slowlog.o ctrip_swap_blocked.o ../deps/xredis-gtid/xredis_gtid.o ctrip_cuckoo_hash.o ctrip_cuckoo_filter.o ctrip_swap_filter.o ctrip_absent_cache.o ctrip_swap_load.o ctrip_swap_dirty.o ctrip_swap_persist.o ctrip_swap_rordb.o
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o gopher.o tracking.o connection.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o ctrip.o ctrip_swap.o ctrip_swap_adlist.o ctrip_lru_cache.o ctrip_swap_async.o ctrip_swap_batch.o ctrip_swap_cmd.o ctrip_swap_data.o ctrip_swap_debug.o ctrip_swap_evict.o ctrip_swap_exec.o ctrip_swap_expire.o ctrip_swap_hash.o ctrip_swap_set.o ctrip_swap_list.o ctrip_swap_iter.o ctrip_swap_zset.o ctrip_swap_meta.o ctrip_swap_object.o ctrip_swap_rdb.o ctrip_swap_repl.o ctrip_swap_rio.o ctrip_swap_rocks.o ctrip_swap_stat.o ctrip_swap_sync.o ctrip_swap_thread.o ctrip_swap_util.o ctrip_swap_lock.o ctrip_swap_string.o ctrip_swap_bitmap.o ctrip_swap_compact.o ctrip_swap_slowlog.o ctrip_swap_blocked.o ../deps/xredis-gtid/xredis_gtid.o ctrip_cuckoo_hash.o ctrip_cuckoo_filter.o ctrip_swap_filter.o ctrip_absent_cache.o ctrip_swap_load.o ctrip_swap_dirty.o ctrip_swap_persist.o ctrip_roaring_bitmap.o ctrip_swap_rordb.o
REDIS_CLI_NAME=redis-cli$(PROG_SUFFIX)
REDIS_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o ae.o crcspeed.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o
REDIS_BENCHMARK_NAME=redis-benchmark$(PROG_SUFFIX)
Expand Down
141 changes: 105 additions & 36 deletions src/bitops.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,21 @@ robj *lookupStringForBitCommand(client *c, uint64_t maxbit) {
if (o == NULL) {
o = createObject(OBJ_STRING,sdsnewlen(NULL, byte+1));
dbAdd(c->db,c->argv[1],o);
dbAddMeta(c->db,c->argv[1],createBitmapObjectMarker()); /* add meta to distinguish between bitmap and string types. */
} else {
o = dbUnshareStringValue(c->db,c->argv[1],o);
o->ptr = sdsgrowzero(o->ptr,byte+1);
objectMeta *om = lookupMeta(c->db,c->argv[1]);
metaBitmap meta_bitmap;
if (server.swap_mode == SWAP_MODE_DISK) {
serverAssert(om->swap_type == SWAP_TYPE_BITMAP);
metaBitmapInit(&meta_bitmap, objectMetaGetPtr(om), o);
} else {
//TODO confirm fixed how?
/* maybe it is a empty string object. */
/* it is never processed as bitmap in ror. */
metaBitmapInit(&meta_bitmap, NULL, o);
}
metaBitmapGrow(&meta_bitmap, byte+1);
}
return o;
}
Expand Down Expand Up @@ -768,7 +780,9 @@ void bitopCommand(client *c) {
/* Store the computed value into the target key */
if (maxlen) {
o = createObject(OBJ_STRING,res);
bitmapClearObjectMarkerIfNeeded(c->db,targetkey);
setKey(c,c->db,targetkey,o);
bitmapSetObjectMarkerIfNeeded(c->db,targetkey);
notifyKeyspaceEventDirty(NOTIFY_STRING,"set",targetkey,c->db->id,o,NULL);
decrRefCount(o);
server.dirty++;
Expand All @@ -780,18 +794,18 @@ void bitopCommand(client *c) {
addReplyLongLong(c,maxlen); /* Return the output string length in bytes. */
}

/* BITCOUNT key [start end] */
void bitcountCommand(client *c) {
robj *o;
void metaBitmapBitcount(metaBitmap *meta_bitmap, client *c)
{
long start, end, strlen;
unsigned char *p;
char llbuf[LONG_STR_SIZE];
robj *o = meta_bitmap->bitmap;

/* Lookup, check for type, and return 0 for non existing keys. */
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,OBJ_STRING)) return;
p = getObjectReadOnlyString(o,&strlen,llbuf);

/* maybe it is no hole in object. */
long bitmap_size = meta_bitmap->meta == NULL? strlen:(long)metaBitmapGetSize(meta_bitmap);

/* Parse start/end range if any. */
if (c->argc == 4) {
if (getLongFromObjectOrReply(c,c->argv[2],&start,NULL) != C_OK)
Expand All @@ -803,15 +817,15 @@ void bitcountCommand(client *c) {
addReply(c,shared.czero);
return;
}
if (start < 0) start = strlen+start;
if (end < 0) end = strlen+end;
if (start < 0) start = bitmap_size+start;
if (end < 0) end = bitmap_size+end;
if (start < 0) start = 0;
if (end < 0) end = 0;
if (end >= strlen) end = strlen-1;
if (end >= bitmap_size) end = bitmap_size-1;
} else if (c->argc == 2) {
/* The whole string. */
start = 0;
end = strlen-1;
end = bitmap_size-1;
} else {
/* Syntax error. */
addReplyErrorObject(c,shared.syntaxerr);
Expand All @@ -823,39 +837,49 @@ void bitcountCommand(client *c) {
if (start > end) {
addReply(c,shared.czero);
} else {
unsigned long cold_subkeys_size = metaBitmapGetColdSubkeysSize(meta_bitmap, start);

start -= cold_subkeys_size;
end -= cold_subkeys_size;

long bytes = end-start+1;

addReplyLongLong(c,redisPopcount(p+start,bytes));
}
}

/* BITPOS key bit [start [end]] */
void bitposCommand(client *c) {
/* BITCOUNT key [start end] */
void bitcountCommand(client *c) {
robj *o;
long bit, start, end, strlen;

/* Lookup, check for type, and return 0 for non existing keys. */
if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,o,OBJ_STRING)) return;

objectMeta *om = lookupMeta(c->db,c->argv[1]);
metaBitmap meta_bitmap;
if (server.swap_mode == SWAP_MODE_DISK) {
serverAssert(om->swap_type == SWAP_TYPE_BITMAP);
metaBitmapInit(&meta_bitmap, objectMetaGetPtr(om), o);
} else {
/* it is never processed as bitmap in ror. */
metaBitmapInit(&meta_bitmap, NULL, o);
}
metaBitmapBitcount(&meta_bitmap, c);
}

void metaBitmapBitpos(metaBitmap *meta_bitmap, client *c, unsigned long bit)
{
long start, end, strlen;
unsigned char *p;
char llbuf[LONG_STR_SIZE];
int end_given = 0;
robj *o = meta_bitmap->bitmap;

/* Parse the bit argument to understand what we are looking for, set
* or clear bits. */
if (getLongFromObjectOrReply(c,c->argv[2],&bit,NULL) != C_OK)
return;
if (bit != 0 && bit != 1) {
addReplyError(c, "The bit argument must be 1 or 0.");
return;
}

/* If the key does not exist, from our point of view it is an infinite
* array of 0 bits. If the user is looking for the fist clear bit return 0,
* If the user is looking for the first set bit, return -1. */
if ((o = lookupKeyRead(c->db,c->argv[1])) == NULL) {
addReplyLongLong(c, bit ? -1 : 0);
return;
}
if (checkType(c,o,OBJ_STRING)) return;
p = getObjectReadOnlyString(o,&strlen,llbuf);

/* maybe it is no hole in object. */
long bitmap_size = meta_bitmap->meta == NULL? strlen:(long)metaBitmapGetSize(meta_bitmap);
/* Parse start/end range if any. */
if (c->argc == 4 || c->argc == 5) {
if (getLongFromObjectOrReply(c,c->argv[3],&start,NULL) != C_OK)
Expand All @@ -865,18 +889,18 @@ void bitposCommand(client *c) {
return;
end_given = 1;
} else {
end = strlen-1;
end = bitmap_size-1;
}
/* Convert negative indexes */
if (start < 0) start = strlen+start;
if (end < 0) end = strlen+end;
if (start < 0) start = bitmap_size+start;
if (end < 0) end = bitmap_size+end;
if (start < 0) start = 0;
if (end < 0) end = 0;
if (end >= strlen) end = strlen-1;
if (end >= bitmap_size) end = bitmap_size-1;
} else if (c->argc == 3) {
/* The whole string. */
start = 0;
end = strlen-1;
end = bitmap_size-1;
} else {
/* Syntax error. */
addReplyErrorObject(c,shared.syntaxerr);
Expand All @@ -888,6 +912,12 @@ void bitposCommand(client *c) {
if (start > end) {
addReplyLongLong(c, -1);
} else {

unsigned long cold_subkeys_size = metaBitmapGetColdSubkeysSize(meta_bitmap, start);

start -= cold_subkeys_size;
end -= cold_subkeys_size;

long bytes = end-start+1;
long long pos = redisBitpos(p+start,bytes,bit);

Expand All @@ -903,8 +933,47 @@ void bitposCommand(client *c) {
return;
}
if (pos != -1) pos += (long long)start<<3; /* Adjust for the bytes we skipped. */

pos += cold_subkeys_size * 8;
addReplyLongLong(c,pos);
}
return;
}

/* BITPOS key bit [start [end]] */
void bitposCommand(client *c) {
robj *o;
long bit;

/* Parse the bit argument to understand what we are looking for, set
* or clear bits. */
if (getLongFromObjectOrReply(c,c->argv[2],&bit,NULL) != C_OK)
return;
if (bit != 0 && bit != 1) {
addReplyError(c, "The bit argument must be 1 or 0.");
return;
}

/* If the key does not exist, from our point of view it is an infinite
* array of 0 bits. If the user is looking for the fist clear bit return 0,
* If the user is looking for the first set bit, return -1. */
if ((o = lookupKeyRead(c->db,c->argv[1])) == NULL) {
addReplyLongLong(c, bit ? -1 : 0);
return;
}
if (checkType(c,o,OBJ_STRING)) return;

objectMeta *om = lookupMeta(c->db,c->argv[1]);
metaBitmap meta_bitmap;
if (server.swap_mode == SWAP_MODE_DISK) {
serverAssert(om->swap_type == SWAP_TYPE_BITMAP);
metaBitmapInit(&meta_bitmap, objectMetaGetPtr(om), o);
} else {
/* it is never processed as bitmap in ror. */
metaBitmapInit(&meta_bitmap, NULL, o);
}

metaBitmapBitpos(&meta_bitmap, c, bit);
}

/* BITFIELD key subcommmand-1 arg ... subcommand-2 arg ... subcommand-N ...
Expand Down
2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,7 @@ standardConfig configs[] = {
createBoolConfig("swap-dirty-subkeys-enabled", NULL, MODIFIABLE_CONFIG, server.swap_dirty_subkeys_enabled, 0, NULL, NULL),
createBoolConfig("swap-persist-enabled", NULL, IMMUTABLE_CONFIG, server.swap_persist_enabled, 0, NULL, NULL),
createBoolConfig("swap-repl-rordb-sync", NULL, MODIFIABLE_CONFIG, server.swap_repl_rordb_sync, 1, NULL, NULL),
createBoolConfig("swap-rdb-bitmap-encode-enabled", NULL, MODIFIABLE_CONFIG, server.swap_rdb_bitmap_encode_enabled, 1, NULL, NULL),
createBoolConfig("rocksdb.data.cache_index_and_filter_blocks", "rocksdb.cache_index_and_filter_blocks", IMMUTABLE_CONFIG, server.rocksdb_data_cache_index_and_filter_blocks, 0, NULL, NULL),
createBoolConfig("rocksdb.meta.cache_index_and_filter_blocks", NULL, IMMUTABLE_CONFIG, server.rocksdb_meta_cache_index_and_filter_blocks, 0, NULL, NULL),
createBoolConfig("rocksdb.enable_pipelined_write", NULL, IMMUTABLE_CONFIG, server.rocksdb_enable_pipelined_write, 0, NULL, NULL),
Expand Down Expand Up @@ -3095,6 +3096,7 @@ standardConfig configs[] = {
createSizeTConfig("hll-sparse-max-bytes", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.hll_sparse_max_bytes, 3000, MEMORY_CONFIG, NULL, NULL),
createSizeTConfig("tracking-table-max-keys", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.tracking_table_max_keys, 1000000, INTEGER_CONFIG, NULL, NULL), /* Default: 1 million keys max. */
createSizeTConfig("client-query-buffer-limit", NULL, MODIFIABLE_CONFIG, 1024*1024, LONG_MAX, server.client_max_querybuf_len, 1024*1024*1024, MEMORY_CONFIG, NULL, NULL), /* Default: 1GB max query buffer. */
createSizeTConfig("bitmap-subkey-size", NULL, MODIFIABLE_CONFIG, 256, 16*1024, server.swap_bitmap_subkey_size, 4*1024, MEMORY_CONFIG, NULL, NULL), /* Default: 4096 bytes. */

/* Other configs */
createTimeTConfig("repl-backlog-ttl", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.repl_backlog_time_limit, 60*60, INTEGER_CONFIG, NULL, NULL), /* Default: 1 hour */
Expand Down
Loading
Loading