diff --git a/docs/ascii-protocol/ch02-collection-items.md b/docs/ascii-protocol/ch02-collection-items.md index 40da2417..7d0f2c64 100644 --- a/docs/ascii-protocol/ch02-collection-items.md +++ b/docs/ascii-protocol/ch02-collection-items.md @@ -73,7 +73,7 @@ B+tree collection에서 사용가능한 bkey 데이터 유형은 아래 두 가 "0x"로 시작하는 짝수 개의 hexadecimal 문자열로 표현하며, 대소문자 모두 사용 가능하다. ARCUS cache server는 두 hexadecimal 문자를 1 byte로 저장하며, - 1 ~ 31 길이의 variable length byte array로 저장한다. + 1 ~ 63 길이의 variable length byte array로 저장한다. hexadecimal 표현이 올바른 경우의 저장 바이트 수와 잘못된 경우의 이유는 아래와 같다. diff --git a/docs/ascii-protocol/ch03-item-attributes.md b/docs/ascii-protocol/ch03-item-attributes.md index 7d273926..761426d6 100644 --- a/docs/ascii-protocol/ch03-item-attributes.md +++ b/docs/ascii-protocol/ch03-item-attributes.md @@ -34,7 +34,7 @@ ARCUS Cache Server는 collection 기능 지원으로 인해, | readable | collection | readable/unreadable | "on", "off" | "on" | |-----------------------------------------------------------------------------------------------------------------| | maxbkeyrange | b+tree only | maximum bkey range | 8 bytes unsigned integer or | 0 | -| | | | hexadecimal (max 31 bytes) | | +| | | | hexadecimal (max 63 bytes) | | |-----------------------------------------------------------------------------------------------------------------| ``` diff --git a/engines/default/cmdlogrec.c b/engines/default/cmdlogrec.c index 94f8a65b..7c64f063 100644 --- a/engines/default/cmdlogrec.c +++ b/engines/default/cmdlogrec.c @@ -353,7 +353,7 @@ static void lrec_it_link_print(LogRec *logrec) struct lrec_item_common *cm = (struct lrec_item_common*)&body->cm; char *keyptr = body->data; - char metastr[180]; + char metastr[MAX_BKEY_LENG*2 + 90]; if (cm->ittype == ITEM_TYPE_KV) { sprintf(metastr, "cas=%"PRIu64, body->ptr.cas); } else { @@ -1042,8 +1042,8 @@ static void lrec_bt_elem_insert_print(LogRec *logrec) unsigned char *eflagptr = bkeyptr + real_nbkey; char *attrptr = (char*)(eflagptr + log->body.neflag + log->body.vallen); - char bkeystr[90]; - char eflagstr[90]; + char bkeystr[MAX_BKEY_LENG*2 + 20]; + char eflagstr[MAX_EFLAG_LENG*2 + 20]; char attrstr[180]; lrec_bkey_print(log->body.nbkey, bkeyptr, bkeystr); if (log->body.neflag > 0) { @@ -1110,7 +1110,7 @@ static void lrec_bt_elem_delete_print(LogRec *logrec) char *keyptr = log->body.data; unsigned char *bkeyptr = (unsigned char*)(keyptr + log->body.keylen); - char bkeystr[90]; + char bkeystr[MAX_BKEY_LENG*2 + 20]; lrec_bkey_print(log->body.nbkey, bkeyptr, bkeystr); lrec_header_print(&log->header); fprintf(stderr, "[BODY ] keylen=%u | keystr=%.*s | bkey=%s | drop=%s\r\n", @@ -1210,8 +1210,8 @@ static void lrec_bt_elem_delete_logical_print(LogRec *logrec) char *fbkeyptr = keyptr + log->body.keylen; char *tbkeyptr = fbkeyptr + BTREE_REAL_NBKEY(log->body.from_nbkey); - char fbkeystr[90]; - char tbkeystr[90]; + char fbkeystr[MAX_BKEY_LENG*2 + 20]; + char tbkeystr[MAX_BKEY_LENG*2 + 20]; lrec_bkey_print(log->body.from_nbkey, (unsigned char *)fbkeyptr, fbkeystr); lrec_bkey_print(log->body.to_nbkey, (unsigned char*)tbkeyptr, tbkeystr); @@ -1337,8 +1337,8 @@ static void lrec_snapshot_elem_link_print(LogRec *logrec) body->nekey, body->nekey, valptr, body->nbytes, (body->nbytes-2 <= 250 ? body->nbytes-2 : 250), (valptr + body->nekey)); } else if (log->header.updtype == UPD_BT_ELEM_INSERT) { - char bkeystr[90]; - char eflagstr[90]; + char bkeystr[MAX_BKEY_LENG*2 + 20]; + char eflagstr[MAX_EFLAG_LENG*2 + 20]; unsigned char *bkeyptr = (unsigned char*)valptr; unsigned char *eflagptr = (unsigned char*)(valptr + BTREE_REAL_NBKEY(body->nekey)); lrec_bkey_print(body->nekey, bkeyptr, bkeystr); diff --git a/include/memcached/types.h b/include/memcached/types.h index 97222863..aa828ee5 100644 --- a/include/memcached/types.h +++ b/include/memcached/types.h @@ -288,8 +288,8 @@ extern "C" { * bkey and eflag */ #define MIN_BKEY_LENG 1 -#define MAX_BKEY_LENG 31 -#define MAX_EFLAG_LENG 31 +#define MAX_BKEY_LENG 63 +#define MAX_EFLAG_LENG 63 #define MAX_FIELD_LENG 250 #define BKEY_NULL 255 #define EFLAG_NULL 255 diff --git a/lqdetect.c b/lqdetect.c index 57ce5113..0fe81753 100644 --- a/lqdetect.c +++ b/lqdetect.c @@ -10,7 +10,7 @@ #include "memcached/util.h" #define LQ_THRESHOLD_DEFAULT 4000 -#define LQ_QUERY_SIZE (64*2+64) /* bop get (longest query) : ".. efilter delete" */ +#define LQ_QUERY_SIZE (MAX_BKEY_LENG*2*2+64) /* bop get (longest query) : ".. efilter delete" */ #define LQ_KEY_SIZE 250 /* the max size of key string */ #define LQ_SAVE_CNT 20 /* save key count */ #define LQ_INPUT_SIZE 500 /* the size of input(time, ip, command, argument) */ diff --git a/memcached.c b/memcached.c index 22203951..67a76e7f 100644 --- a/memcached.c +++ b/memcached.c @@ -13272,10 +13272,9 @@ static int try_read_command_ascii(conn *c) } /* Check KEY_MAX_LENGTH and eflag filter length * - KEY_MAX_LENGTH : 16000 - * - IN eflag filter : > 6400 (64*100) + * - IN eflag filter : > 12800 (128*100) */ - if (c->rbytes > ((16+8)*1024)) { - /* The length of "stats prefixes" command cannot exceed 24 KB. */ + if (c->rbytes > ((16+16)*1024)) { if (strncmp(ptr, "get ", 4) && strncmp(ptr, "gets ", 5)) { char buffer[16]; memcpy(buffer, ptr, 15); buffer[15] = '\0'; diff --git a/t/coll_bop_delete.t b/t/coll_bop_delete.t index 9a15c166..25c92588 100644 --- a/t/coll_bop_delete.t +++ b/t/coll_bop_delete.t @@ -24,7 +24,7 @@ bop delete bkey1 0..0xFF: CLIENT_ERROR bad command line format bop delete bkey1 0x00..0xFFF: CLIENT_ERROR bad command line format bop delete bkey1 0x11..0xFFFF: NOT_FOUND_ELEMENT bop delete bkey1 0x00..0xFF 1 EQ 0x05: NOT_FOUND_ELEMENT -bop delete bkey1 0x00..0xFF 32 EQ 0x05: CLIENT_ERROR bad command line format +bop delete bkey1 0x00..0xFF 64 EQ 0x05: CLIENT_ERROR bad command line format bop delete bkey1 0x00..0xFF 1 XX 0x05: CLIENT_ERROR bad command line format bop delete bkey1 0x00..0xFF 0 & 0xFFFFFF EQ 0x03: CLIENT_ERROR bad command line format bop delete bkey1 0x00..0xFF 0 & 0xFFFFFF EQ 0x030303: NOT_FOUND_ELEMENT @@ -115,7 +115,7 @@ $cmd = "bop delete bkey1 0x11..0xFFFF"; $rst = "NOT_FOUND_ELEMENT"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop delete bkey1 0x00..0xFF 1 EQ 0x05"; $rst = "NOT_FOUND_ELEMENT"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop delete bkey1 0x00..0xFF 32 EQ 0x05"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop delete bkey1 0x00..0xFF 64 EQ 0x05"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop delete bkey1 0x00..0xFF 1 XX 0x05"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); diff --git a/t/coll_bop_insert.t b/t/coll_bop_insert.t index 83d96500..ad33a576 100644 --- a/t/coll_bop_insert.t +++ b/t/coll_bop_insert.t @@ -43,11 +43,11 @@ datum1 setattr bkey1 maxcount=4000 bop insert bkey1 0x020 6 datum2 -bop insert bkey1 0x0202020202020202020202020202020202020202020202020202020202020202 6 +bop insert bkey1 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6 datum2 bop insert bkey1 0x0202 0x020 6 datum2 -bop insert bkey1 0x0202 0x0202020202020202020202020202020202020202020202020202020202020202 6 +bop insert bkey1 0x0202 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6 datum2 bop insert bkey1 0x0202 02 6 datum2 @@ -130,11 +130,11 @@ $cmd = "setattr bkey1 maxcount=4000"; $rst = "OK"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop insert bkey1 0x020 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop insert bkey1 0x0202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop insert bkey1 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop insert bkey1 0x0202 0x020 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop insert bkey1 0x0202 0x0202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop insert bkey1 0x0202 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop insert bkey1 0x0202 02 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); diff --git a/t/coll_bop_update.t b/t/coll_bop_update.t index 206f0dd7..71eafb28 100644 --- a/t/coll_bop_update.t +++ b/t/coll_bop_update.t @@ -96,7 +96,7 @@ datum2 bop update bkey2 0x20 1 | 0xFF -1 bop update bkey2 0x0020 1 | 0xFF -1 bop update bkey2 0x0040 4 | 0xFF -1 -bop update bkey2 0x0040 32 | 0xFF -1 +bop update bkey2 0x0040 64 | 0xFF -1 delete bkey1 delete bkey2 @@ -325,7 +325,7 @@ $cmd = "bop update bkey2 0x0020 1 | 0xFF -1"; $rst = "EFLAG_MISMATCH"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop update bkey2 0x0040 4 | 0xFF -1"; $rst = "EFLAG_MISMATCH"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop update bkey2 0x0040 32 | 0xFF -1"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop update bkey2 0x0040 64 | 0xFF -1"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); # Finalize diff --git a/t/coll_bop_upsert.t b/t/coll_bop_upsert.t index f9ee8724..08f88431 100644 --- a/t/coll_bop_upsert.t +++ b/t/coll_bop_upsert.t @@ -44,11 +44,11 @@ datum1 setattr bkey1 maxcount=4000 bop upsert bkey1 0x020 6 datum2 -bop upsert bkey1 0x0202020202020202020202020202020202020202020202020202020202020202 6 +bop upsert bkey1 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6 datum2 bop upsert bkey1 0x0202 0x020 6 datum2 -bop upsert bkey1 0x0202 0x0202020202020202020202020202020202020202020202020202020202020202 6 +bop upsert bkey1 0x0202 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6 datum2 bop upsert bkey1 0x0202 02 6 datum2 @@ -131,11 +131,11 @@ $cmd = "setattr bkey1 maxcount=4000"; $rst = "OK"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop upsert bkey1 0x020 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop upsert bkey1 0x0202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop upsert bkey1 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop upsert bkey1 0x0202 0x020 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); -$cmd = "bop upsert bkey1 0x0202 0x0202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; +$cmd = "bop upsert bkey1 0x0202 0x02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst); $cmd = "bop upsert bkey1 0x0202 02 6"; $rst = "CLIENT_ERROR bad command line format"; mem_cmd_is($sock, $cmd, "", $rst);