Bug #14100
Updated by Kefu Chai over 8 years ago
Now in ReplicatedPG::do_osd_ops, for CEPH_OSD_OP_ZERO, there are the following handle: a)if object din't exist, the op became no-op. b)if object existed <pre> if (offset + len >= ob.size) if (offset >= ob.size) op became no-op else op became truncate and the ob.size became offset else zero(offset, len) like normal write opeartions </pre> Those behaviors are ok for rbd. From the native semantics of zero, it write the data(off, len) w/ zero.Make later read data is zero. For rbd, we know the object size. If non-exist or smaller, we will append zero data in the end. rados has a api: rados_write_op_zero, it use zero as write which don't carry data from client to osd. But for a normal object, a)zero a non-exist object don't work b)zero(offset >= ob.size) don't work(but write(offset >= ob.size can work) c)zero(offset + len >= ob.size & offset < ob.size) don't work(zero become a truncate and ob.size=offset).Later read(offset, len) don't return any data. In fact, for rbd, zero mean discard. But for rados, zero is a speical write.