librados: remove extra advance from objects_begin(position)

ObjectIterator::seek() already calls get_next() to update the
iterator's state. Calling it again goes one past where it should be.

When the iterator reached the end of the list, it deleted the ListCtx,
causing a segfault on further accesses.

Fixes: #7491
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librados: don't destroy ObjListCtx when iterator reaches the end

There's no need to destroy it when we've used it once. It'll get destroyed
by the destructor anyway. Now that there's a seek method, we might want seek
and iterate again anyway, which is not possible if the ObjListCtx is gone.

Change get_next() to check the underlying ObjListCtx for the end of iteration
instead of deleting ObjListCtx, and modify the equality operator to count
the end marker (with ctx == NULL) as equal to having a ObjListCtx at the
end of its list.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librados: implement ObjectIterator copying and assignment

Copied iterators should be independent of each other, and not
rely on the same underlying ListContext or ObjListCtx.

Add some tests for this to make sure they work in various
circumstances.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Added a note that the ceph-osd command requires the cluster option.

Signed-off-by: Christopher O'Connell <jwriteclub@gmail.com>
Merge pull request #1293 from jwriteclub/doc-update-ceph-osd-note

Added a note that the ceph-osd command requires the cluster option.

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Fix deadlock caused by hold collection obj

Collection is a special object in KeyValueStore, if exists collection modify,
this object will be hold. When exists check collection, it will be dead lock to
try to access this object.

Now lookup transaction cache first to ensure no collection object exists
already.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Move perf counter and add op queue reserve throttle

The perf counter of FileStore can shared with other ObjectStore backend, so move
it to ObjectStore and adjust position to let other KeyValueStore refer to.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add test for omap interface

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add get_*_with_header to StripObjectHeader

In some situations, we need to ensure header is held and try to read, so read
interfaces need to accept header argument to allow.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Use rename operation to make colection_move atomic

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Adjust some interfaces to optimize caller codes

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add read/write operation to store_test.cc

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Return 0 when the offset of read exceed the length of object

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Fix incorrect read and truncate

If the first chunk of object is not read entirely, the current implementation
will contain it entirely which make wrong.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Unify object level lock in GenericObjectMap

Before we copy lock implementation from DBObjectMap which provide with two locks
for header. Here just unify it to make ease.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Optimize write call add enhance error detect

A single write call may need several keys in the backend kv store. Let get these
keys one time.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Remove unnecessary "check_coll" check

The goal of "check_coll" is aimed to ensure the collection is exists. But
the create and delete of collection already ensured by OSD, just remove check.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Implement collection_rename interface in KeyValueStore

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Make SequencePosition sync by each transaction

Each object modify will increase SequencePosition and sync it to disk

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Remove m_eio in KeyValueStore

KeyValueStore use kv backend to detect errors and nearly can't know the actual
reason for error.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>