Key-value pair retrieval method and apparatus, and storage medium
AssigneesHuawei Technologies Co., Ltd., University of Science and Technology of China
InventorsYun Xu, Pengcheng Wang, Fei Chen, Long Yan, Lei Han
Life of this patent
Estimating the term…
Abstract
A key is divided into a plurality of key fields. Then, a corresponding first bit is determined from a bitmap top (BT) based on a first key field in a front part. Finally, a target bitmap bottom (BB) is determined, based on a second key field in a rear part, from a plurality of BBs corresponding to the first bit. In this way, for keys having a same first key field, a plurality of same BBs can be located through the BT.
Claims20
A key-value pair retrieval method, wherein the method comprises:
- obtaining, by a key-value pair retrieval device, a processing request, wherein the processing request comprises a target key and a subscript index value of a target value corresponding to the target key, wherein the target key comprises a first key field and a second key field, and wherein the first key field is located before the second key field;
- obtaining, by the key-value pair retrieval device, from a bitmap top (BT) based on the first key field, a bit value of a first bit corresponding to the first key field;
- based on the bit value of the first bit being a first value, determining, by the key-value pair retrieval device, based on the second key field and in a plurality of bitmap bottoms (BBs) corresponding to the first bit, a target bitmap bottom (BB) corresponding to the target key, wherein each BB stores a plurality of values;
- and
- performing, by the key-value pair retrieval device, a value operation in the target BB based on the subscript index value;
- wherein before performing the value operation in the target BB, the method further comprises:
- obtaining, from a lock pool based on a read-write lock label of the target BB, a read-write lock corresponding to the target BB, wherein the read-write lock corresponding to the target BB indicates to perform read-write locking on the target BB in a process of performing the value operation in the target BB based on the subscript index value, wherein the lock pool comprises a plurality of read-write locks, and wherein at least one of the plurality of read-write locks corresponds to at least two BBs.
A key-value pair retrieval device, comprising:
- a processor;
- and
- a memory having a computer program stored thereon;
- wherein the processor is configured to execute the computer program stored in the memory to facilitate performance of the following by the key-value pair retrieval device:
- obtaining a processing request, wherein the processing request comprises a target key and a subscript index value of a target value corresponding to the target key, wherein the target key comprises a first key field and a second key field, and wherein the first key field is located before the second key field;
- obtaining, from a bitmap top (BT) based on the first key field, a bit value of a first bit corresponding to the first key field;
- based on the bit value of the first bit being a first value, determining, based on the second key field and in a plurality of bitmap bottoms (BBs) corresponding to the first bit, a target bitmap bottom (BB) corresponding to the target key, wherein each BB stores a plurality of values;
- and
- performing a value operation in the target BB based on the subscript index value;
- wherein the processor is further configured to execute the computer program stored in the memory to facilitate performance of the following by the key-value pair retrieval device before performing the value operation in the target BB:
- obtaining, from a lock pool based on a read-write lock label of the target BB, a read-write lock corresponding to the target BB, wherein the read-write lock corresponding to the target BB indicates to perform read-write locking on the target BB in a process of performing the value operation in the target BB based on the subscript index value, wherein the lock pool comprises a plurality of read-write locks, and wherein at least one of the plurality of read-write locks corresponds to at least two BBs.
A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium has processor-executable instructions stored thereon, wherein the processor-executable instructions, when executed, facilitate performance of the following:
- obtaining a processing request, wherein the processing request comprises a target key and a subscript index value of a target value corresponding to the target key, wherein the target key comprises a first key field and a second key field, and wherein the first key field is located before the second key field;
- obtaining, from a bitmap top (BT) based on the first key field, a bit value of a first bit corresponding to the first key field;
- based on the bit value of the first bit being a first value, determining, based on the second key field and in a plurality of bitmap bottoms (BBs) corresponding to the first bit, a target bitmap bottom (BB) corresponding to the target key, wherein each BB stores a plurality of values;
- and
- performing a value operation in the target BB based on the subscript index value;
- wherein the processor-executable instructions, when executed, further facilitate performance of the following before performing the value operation in the target BB:
- obtaining, from a lock pool based on a read-write lock label of the target BB, a read-write lock corresponding to the target BB, wherein the read-write lock corresponding to the target BB indicates to perform read-write locking on the target BB in a process of performing the value operation in the target BB based on the subscript index value, wherein the lock pool comprises a plurality of read-write locks, and wherein at least one of the plurality of read-write locks corresponds to at least two BBs.
Dependencies are inferred from the claim text.