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.
I already added this line at the bottom of the file, but I still can't use
::encode(data, bl) to encode TransactionData in Transaction::encode.

Did I missed something?

On 6 December 2014 at 02:53, Sage Weil <notifications@github.com> wrote:

> In src/os/ObjectStore.h:
>
> > +      uint32_t pad; //we use pad to make TransactionData multiple of uint64_t
> > +
> > +      TransactionData() :
> > +        ops(0),
> > +	pad_unused_bytes(0),
> > +	largest_data_len(0),
> > +	largest_data_off(0),
> > +	largest_data_off_in_tbl(0) { }
> > +
> > +      void encode(bufferlist& bl) const {
> > +	bl.append((char*)this, sizeof(TransactionData));
> > +      }
> > +      void decode(bufferlist::iterator &bl) {
> > +	bl.copy(sizeof(TransactionData), (char*)this);
> > +      }
> > +    } __attribute__ ((packed)) ;
>
> WRITE_CLASS_ENCODER(TransactionData);
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ceph/ceph/pull/2991/files#r21391106>.
>



-- 
Dong Yuan
Email:yuandong1222@gmail.com