]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
KeyValueStore: Add KEY_ENDING sign to the end of key
authorHaomai Wang <haomaiwang@gmail.com>
Wed, 19 Nov 2014 06:34:52 +0000 (14:34 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Wed, 19 Nov 2014 07:07:16 +0000 (15:07 +0800)
commitb4fa384fc023558b0c4af781cbe34a35315f4967
treea356cb0d99c6a103b34840e5da6cb20486e762d6
parent9c1b199aee54ca891e014859fe4edc2d8f7f11d1
KeyValueStore: Add KEY_ENDING sign to the end of key

Keys stored in alphabetical order and need to follow ghobject_t comparison
rule. "generation" and "shard_id" are optional fields for object key, but
a default ghobject with UINT64_MAX generation(by default) will larger than
the same ghobject with other generation. GenericObjectMap rejects to store
generation if generation is UINT64_MAX in order to reduce too much words
in key. So we need to add a MAX sign to the end of key to make ordering
is same with ghobject's comparison rule.

For example:

_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head
_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head!78!0

The first key should larger than the second in ghobject_t ordering because
of generation. But the first key less than the second in GenericObjectMap.

_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head
_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head!78!0

After we add KEY_ENDING, '!' is (21) in hexadecimal:

_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head(21)78!0(FF)
_GHOBJTOSEQ_:1%e1ds0_head!D168A7E8!!1!!benchmark_last_metadata!head(FF)

Fix bug #10119
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/os/GenericObjectMap.cc
src/os/GenericObjectMap.h