mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
journal: change omap remove func to handle multiple keys at once
For any function that removes more than one key on a single oid removing them as a batch will be more efficient. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
0ac5f40d09
commit
a8409eccc8
@ -77,10 +77,10 @@ func getOMapValues(
|
|||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeOneOMapKey(
|
func removeMapKeys(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
conn *Connection,
|
conn *Connection,
|
||||||
poolName, namespace, oMapName, oMapKey string) error {
|
poolName, namespace, oid string, keys []string) error {
|
||||||
// fetch and configure the rados ioctx
|
// fetch and configure the rados ioctx
|
||||||
ioctx, err := conn.conn.GetIoctx(poolName)
|
ioctx, err := conn.conn.GetIoctx(poolName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -92,15 +92,15 @@ func removeOneOMapKey(
|
|||||||
ioctx.SetNamespace(namespace)
|
ioctx.SetNamespace(namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioctx.RmOmapKeys(oMapName, []string{oMapKey})
|
err = ioctx.RmOmapKeys(oid, keys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(
|
klog.Errorf(
|
||||||
util.Log(ctx, "failed removing omap key (pool=%q, namespace=%q, name=%q, key=%q): %v"),
|
util.Log(ctx, "failed removing omap keys (pool=%q, namespace=%q, name=%q): %v"),
|
||||||
poolName, namespace, oMapName, oMapKey, err)
|
poolName, namespace, oid, err)
|
||||||
} else {
|
} else {
|
||||||
klog.Infof(
|
klog.V(4).Infof(
|
||||||
util.Log(ctx, "XXX removed omap key (pool=%q, namespace=%q, name=%q, key=%q, ): %v"),
|
util.Log(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v"),
|
||||||
poolName, namespace, oMapName, oMapKey, err)
|
poolName, namespace, oid, keys)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -411,8 +411,8 @@ func (conn *Connection) UndoReservation(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete the request name key (last, inverse of create order)
|
// delete the request name key (last, inverse of create order)
|
||||||
err := removeOneOMapKey(ctx, conn, csiJournalPool, cj.namespace, cj.csiDirectory,
|
err := removeMapKeys(ctx, conn, csiJournalPool, cj.namespace, cj.csiDirectory,
|
||||||
cj.csiNameKeyPrefix+reqName)
|
[]string{cj.csiNameKeyPrefix + reqName})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf(util.Log(ctx, "failed removing oMap key %s (%s)"), cj.csiNameKeyPrefix+reqName, err)
|
klog.Errorf(util.Log(ctx, "failed removing oMap key %s (%s)"), cj.csiNameKeyPrefix+reqName, err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user