datastore: add tuning option for chunk order

currently, we sort chunks by inode when verifying or backing up to tape.
we get the inode# by stat'ing each chunk, which may be more expensive
than the gains of reading the chunks in order

Since that is highly dependent on the underlying storage of the datastore,
introduce a tuning option  so that the admin can tune that behaviour
for each datastore.

The default stays the same (sorting by inode)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2022-02-22 15:57:49 +01:00
committed by Dietmar Maurer
parent 118f8589a9
commit fef61684b4
3 changed files with 72 additions and 8 deletions

View File

@ -167,6 +167,38 @@ pub struct PruneOptions {
pub keep_yearly: Option<u64>,
}
#[api]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
/// The order to sort chunks by
pub enum ChunkOrder {
/// Iterate chunks in the index order
None,
/// Iterate chunks in inode order
Inode,
}
#[api(
properties: {
"chunk-order": {
type: ChunkOrder,
optional: true,
},
},
)]
#[derive(Serialize, Deserialize, Default)]
#[serde(rename_all = "kebab-case")]
/// Datastore tuning options
pub struct DatastoreTuning {
/// Iterate chunks in this order
pub chunk_order: Option<ChunkOrder>,
}
pub const DATASTORE_TUNING_STRING_SCHEMA: Schema = StringSchema::new(
"Datastore tuning options")
.format(&ApiStringFormat::PropertyString(&DatastoreTuning::API_SCHEMA))
.schema();
#[api(
properties: {
name: {
@ -224,6 +256,10 @@ pub struct PruneOptions {
optional: true,
type: bool,
},
tuning: {
optional: true,
schema: DATASTORE_TUNING_STRING_SCHEMA,
},
}
)]
#[derive(Serialize,Deserialize,Updater)]
@ -261,6 +297,9 @@ pub struct DataStoreConfig {
/// Send notification only for job errors
#[serde(skip_serializing_if="Option::is_none")]
pub notify: Option<String>,
/// Datastore tuning options
#[serde(skip_serializing_if="Option::is_none")]
pub tuning: Option<String>,
}
#[api(