mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-23 19:57:30 +01:00
add the upgradeTo field in the details
This commit is contained in:
parent
bfb57b22db
commit
acf8471f32
@ -291,8 +291,8 @@ fn snapshot_details(d: &Details) -> String {
|
|||||||
Details::IndexSwap { swaps } => {
|
Details::IndexSwap { swaps } => {
|
||||||
format!("{{ swaps: {swaps:?} }}")
|
format!("{{ swaps: {swaps:?} }}")
|
||||||
}
|
}
|
||||||
Details::UpgradeDatabase { from } => {
|
Details::UpgradeDatabase { from, to } => {
|
||||||
format!("{{ from: v{}.{}.{} }}", from.0, from.1, from.2)
|
format!("{{ from: {from:?}, to: {to:?} }}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ snapshot_kind: text
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
0 {uid: 0, status: enqueued, details: { primary_key: Some("mouse") }, kind: IndexCreation { index_uid: "catto", primary_key: Some("mouse") }}
|
||||||
1 {uid: 1, status: enqueued, details: { from: v1.12.0 }, kind: UpgradeDatabase { from: (1, 12, 0) }}
|
1 {uid: 1, status: enqueued, details: { from: (1, 12, 0), to: (1, 13, 0) }, kind: UpgradeDatabase { from: (1, 12, 0) }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Status:
|
### Status:
|
||||||
enqueued [0,1,]
|
enqueued [0,1,]
|
||||||
|
@ -75,7 +75,7 @@ pub fn upgrade_index_scheduler(
|
|||||||
finished_at: None,
|
finished_at: None,
|
||||||
error: None,
|
error: None,
|
||||||
canceled_by: None,
|
canceled_by: None,
|
||||||
details: Some(Details::UpgradeDatabase { from }),
|
details: Some(Details::UpgradeDatabase { from, to }),
|
||||||
status: Status::Enqueued,
|
status: Status::Enqueued,
|
||||||
kind: KindWithContent::UpgradeDatabase { from },
|
kind: KindWithContent::UpgradeDatabase { from },
|
||||||
},
|
},
|
||||||
|
@ -548,7 +548,7 @@ impl crate::IndexScheduler {
|
|||||||
Details::Dump { dump_uid: _ } => {
|
Details::Dump { dump_uid: _ } => {
|
||||||
assert_eq!(kind.as_kind(), Kind::DumpCreation);
|
assert_eq!(kind.as_kind(), Kind::DumpCreation);
|
||||||
}
|
}
|
||||||
Details::UpgradeDatabase { from: _ } => {
|
Details::UpgradeDatabase { from: _, to: _ } => {
|
||||||
assert_eq!(kind.as_kind(), Kind::UpgradeDatabase);
|
assert_eq!(kind.as_kind(), Kind::UpgradeDatabase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,8 @@ pub struct DetailsView {
|
|||||||
pub swaps: Option<Vec<IndexSwap>>,
|
pub swaps: Option<Vec<IndexSwap>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub upgrade_from: Option<String>,
|
pub upgrade_from: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub upgrade_to: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DetailsView {
|
impl DetailsView {
|
||||||
@ -236,10 +238,17 @@ impl DetailsView {
|
|||||||
Some(left)
|
Some(left)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// We want the earliest version
|
||||||
upgrade_from: match (self.upgrade_from.clone(), other.upgrade_from.clone()) {
|
upgrade_from: match (self.upgrade_from.clone(), other.upgrade_from.clone()) {
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
(None, Some(from)) | (Some(from), None) => Some(from),
|
(None, Some(from)) | (Some(from), None) => Some(from),
|
||||||
(Some(_), Some(from)) => Some(from),
|
(Some(from), Some(_)) => Some(from),
|
||||||
|
},
|
||||||
|
// And the latest
|
||||||
|
upgrade_to: match (self.upgrade_to.clone(), other.upgrade_to.clone()) {
|
||||||
|
(None, None) => None,
|
||||||
|
(None, Some(to)) | (Some(to), None) => Some(to),
|
||||||
|
(Some(_), Some(to)) => Some(to),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,8 +327,9 @@ impl From<Details> for DetailsView {
|
|||||||
Details::IndexSwap { swaps } => {
|
Details::IndexSwap { swaps } => {
|
||||||
DetailsView { swaps: Some(swaps), ..Default::default() }
|
DetailsView { swaps: Some(swaps), ..Default::default() }
|
||||||
}
|
}
|
||||||
Details::UpgradeDatabase { from } => DetailsView {
|
Details::UpgradeDatabase { from, to } => DetailsView {
|
||||||
upgrade_from: Some(format!("v{}.{}.{}", from.0, from.1, from.2)),
|
upgrade_from: Some(format!("v{}.{}.{}", from.0, from.1, from.2)),
|
||||||
|
upgrade_to: Some(format!("v{}.{}.{}", to.0, to.1, to.2)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ use crate::batches::BatchId;
|
|||||||
use crate::error::ResponseError;
|
use crate::error::ResponseError;
|
||||||
use crate::keys::Key;
|
use crate::keys::Key;
|
||||||
use crate::settings::{Settings, Unchecked};
|
use crate::settings::{Settings, Unchecked};
|
||||||
use crate::InstanceUid;
|
use crate::{versioning, InstanceUid};
|
||||||
|
|
||||||
pub type TaskId = u32;
|
pub type TaskId = u32;
|
||||||
|
|
||||||
@ -269,9 +269,14 @@ impl KindWithContent {
|
|||||||
}),
|
}),
|
||||||
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
||||||
KindWithContent::SnapshotCreation => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
KindWithContent::UpgradeDatabase { from } => {
|
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
|
||||||
Some(Details::UpgradeDatabase { from: (from.0, from.1, from.2) })
|
from: (from.0, from.1, from.2),
|
||||||
}
|
to: (
|
||||||
|
versioning::VERSION_MAJOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_MINOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_PATCH.parse().unwrap(),
|
||||||
|
),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,9 +335,14 @@ impl KindWithContent {
|
|||||||
}),
|
}),
|
||||||
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
||||||
KindWithContent::SnapshotCreation => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
KindWithContent::UpgradeDatabase { from } => {
|
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
|
||||||
Some(Details::UpgradeDatabase { from: *from })
|
from: *from,
|
||||||
}
|
to: (
|
||||||
|
versioning::VERSION_MAJOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_MINOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_PATCH.parse().unwrap(),
|
||||||
|
),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,9 +383,14 @@ impl From<&KindWithContent> for Option<Details> {
|
|||||||
}),
|
}),
|
||||||
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
KindWithContent::DumpCreation { .. } => Some(Details::Dump { dump_uid: None }),
|
||||||
KindWithContent::SnapshotCreation => None,
|
KindWithContent::SnapshotCreation => None,
|
||||||
KindWithContent::UpgradeDatabase { from } => {
|
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
|
||||||
Some(Details::UpgradeDatabase { from: *from })
|
from: *from,
|
||||||
}
|
to: (
|
||||||
|
versioning::VERSION_MAJOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_MINOR.parse().unwrap(),
|
||||||
|
versioning::VERSION_PATCH.parse().unwrap(),
|
||||||
|
),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,6 +645,7 @@ pub enum Details {
|
|||||||
},
|
},
|
||||||
UpgradeDatabase {
|
UpgradeDatabase {
|
||||||
from: (u32, u32, u32),
|
from: (u32, u32, u32),
|
||||||
|
to: (u32, u32, u32),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -8,7 +8,8 @@ snapshot_kind: text
|
|||||||
"uid": 20,
|
"uid": 20,
|
||||||
"progress": null,
|
"progress": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"totalNbTasks": 1,
|
"totalNbTasks": 1,
|
||||||
|
@ -8,7 +8,8 @@ snapshot_kind: text
|
|||||||
"uid": 20,
|
"uid": 20,
|
||||||
"progress": null,
|
"progress": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"totalNbTasks": 1,
|
"totalNbTasks": 1,
|
||||||
|
@ -8,7 +8,8 @@ snapshot_kind: text
|
|||||||
"uid": 20,
|
"uid": 20,
|
||||||
"progress": null,
|
"progress": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"totalNbTasks": 1,
|
"totalNbTasks": 1,
|
||||||
|
@ -12,7 +12,8 @@ snapshot_kind: text
|
|||||||
"type": "upgradeDatabase",
|
"type": "upgradeDatabase",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"error": null,
|
"error": null,
|
||||||
"duration": "[duration]",
|
"duration": "[duration]",
|
||||||
|
@ -12,7 +12,8 @@ snapshot_kind: text
|
|||||||
"type": "upgradeDatabase",
|
"type": "upgradeDatabase",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"error": null,
|
"error": null,
|
||||||
"duration": "[duration]",
|
"duration": "[duration]",
|
||||||
|
@ -12,7 +12,8 @@ snapshot_kind: text
|
|||||||
"type": "upgradeDatabase",
|
"type": "upgradeDatabase",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"error": null,
|
"error": null,
|
||||||
"duration": "[duration]",
|
"duration": "[duration]",
|
||||||
|
@ -8,7 +8,8 @@ snapshot_kind: text
|
|||||||
"uid": 20,
|
"uid": 20,
|
||||||
"progress": null,
|
"progress": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"totalNbTasks": 1,
|
"totalNbTasks": 1,
|
||||||
|
@ -12,7 +12,8 @@ snapshot_kind: text
|
|||||||
"type": "upgradeDatabase",
|
"type": "upgradeDatabase",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
"details": {
|
"details": {
|
||||||
"upgradeFrom": "v1.12.0"
|
"upgradeFrom": "v1.12.0",
|
||||||
|
"upgradeTo": "v1.13.0"
|
||||||
},
|
},
|
||||||
"error": null,
|
"error": null,
|
||||||
"duration": "[duration]",
|
"duration": "[duration]",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user