WIP: Fast transaction encode & decode

Current transaction use a bufferlist tbl to encode all actions and their data, so if object appears many times, it will be encoded many times. And when FileStore do this transaction, it must decode all actions and data from the tbl.

This patch follows BP: osd: update_Transaction_encoding, 

The transaction use two maps to keep all colls and objects appeared in the transaction, and each coll and object only need to be encoded once. On the other hand, FileStore don't need to decode actions, colls and objects anymore.
While current code still has bug about iterator destroy, maybe I still need
a sharedptr.

On 8 December 2014 at 10:38, Dong Yuan <yuandong1222@gmail.com> wrote:

> I tried that way, but Transaction::begin returns an instance instead of a
> pointer, while we can't construct a subclass instance and return it as a
> parent-class instance.
>
> So if we want to use inheritance, the Transaction::begin must return a
> pointer, but it is not in accord with std.
>
> I prefer current way since we don't need to care about the destroy of
> iterator. And after some releases (maybe some stable releases), we can
> remove tbl and related code totally, and there should be only one iterator
> at last. At that time, we don't need to change the Transaction::begin
> anymore.
>
> Or maybe there is some better idea?
>
> On 6 December 2014 at 02:42, Sage Weil <notifications@github.com> wrote:
>
>> In src/os/ObjectStore.h:
>>
>> > +      void decode_keyset(set<string> &keys){
>> > +        ::decode(keys, data_bl_p);
>> > +      }
>> > +
>> > +      ghobject_t get_oid(__le32 oid_id) {
>> > +        assert(oid_id < objects.size());
>> > +        return objects[oid_id];
>> > +      }
>> > +      coll_t get_cid(__le32 cid_id) {
>> > +        assert(cid_id < colls.size());
>> > +        return colls[cid_id];
>> > +      }
>> > +    };
>> > +
>> > +    class iterator {
>> > +      iterator_impl* impl;
>>
>> would it be simpler to make class iterator pure virtual and have two
>> child classes, instead of explictitly wrapping around each impl method
>> here? (don't really care)
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/ceph/ceph/pull/2991/files#r21390479>.
>>
>
>
>
> --
> Dong Yuan
> Email:yuandong1222@gmail.com
>



-- 
Dong Yuan
Email:yuandong1222@gmail.com