]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/dbstore: DBOpPrepareInfo::query_str is a view 45109/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 21 Feb 2022 17:07:26 +0000 (12:07 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 21 Feb 2022 18:18:25 +0000 (13:18 -0500)
in `SQLiteDB::InitPrepareParams()`, `DBOpInfo::query_str` is assigned to
`DBOpPrepareInfo::query_str`:

  p_params.op.query_str = params->op.query_str;

by making `DBOpPrepareInfo::query_str` a view, we avoid allocating a
copy of the `std::string`

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/store/dbstore/common/dbstore.h

index 553bf74a14bc4f0de7c6eaf2da3f75bf131157f4..4ef758e14d2f6c11487f19de2e3336fb00bfe19d 100644 (file)
@@ -310,7 +310,7 @@ struct DBOpLCHeadPrepareInfo {
 
 struct DBOpPrepareInfo {
   DBOpUserPrepareInfo user;
-  std::string query_str = ":query_str";
+  std::string_view query_str; // view into DBOpInfo::query_str
   DBOpBucketPrepareInfo bucket;
   DBOpObjectPrepareInfo obj;
   DBOpObjectDataPrepareInfo obj_data;