Fix deletion propagation
This commit is contained in:
parent
9cb870f950
commit
0a283e4e70
@ -163,11 +163,17 @@ impl TableSchema for ObjectTable {
|
|||||||
if let (Some(old_v), Some(new_v)) = (old, new) {
|
if let (Some(old_v), Some(new_v)) = (old, new) {
|
||||||
// Propagate deletion of old versions
|
// Propagate deletion of old versions
|
||||||
for v in old_v.versions.iter() {
|
for v in old_v.versions.iter() {
|
||||||
if new_v
|
let newly_deleted = match new_v
|
||||||
.versions
|
.versions
|
||||||
.binary_search_by(|nv| nv.cmp_key().cmp(&v.cmp_key()))
|
.binary_search_by(|nv| nv.cmp_key().cmp(&v.cmp_key()))
|
||||||
.is_err()
|
|
||||||
{
|
{
|
||||||
|
Err(_) => true,
|
||||||
|
Ok(i) => {
|
||||||
|
new_v.versions[i].state == ObjectVersionState::Aborted
|
||||||
|
&& v.state != ObjectVersionState::Aborted
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if newly_deleted {
|
||||||
let deleted_version = Version::new(
|
let deleted_version = Version::new(
|
||||||
v.uuid,
|
v.uuid,
|
||||||
old_v.bucket.clone(),
|
old_v.bucket.clone(),
|
||||||
|
@ -4,6 +4,7 @@ use tokio::sync::watch;
|
|||||||
|
|
||||||
use garage_core::block_ref_table::*;
|
use garage_core::block_ref_table::*;
|
||||||
use garage_core::garage::Garage;
|
use garage_core::garage::Garage;
|
||||||
|
use garage_core::object_table::*;
|
||||||
use garage_core::version_table::*;
|
use garage_core::version_table::*;
|
||||||
use garage_table::*;
|
use garage_table::*;
|
||||||
use garage_util::error::Error;
|
use garage_util::error::Error;
|
||||||
@ -105,7 +106,10 @@ impl Repair {
|
|||||||
.get(&version.bucket, &version.key)
|
.get(&version.bucket, &version.key)
|
||||||
.await?;
|
.await?;
|
||||||
let version_exists = match object {
|
let version_exists = match object {
|
||||||
Some(o) => o.versions().iter().any(|x| x.uuid == version.uuid),
|
Some(o) => o
|
||||||
|
.versions()
|
||||||
|
.iter()
|
||||||
|
.any(|x| x.uuid == version.uuid && x.state != ObjectVersionState::Aborted),
|
||||||
None => {
|
None => {
|
||||||
warn!(
|
warn!(
|
||||||
"Repair versions: object for version {:?} not found",
|
"Repair versions: object for version {:?} not found",
|
||||||
|
Loading…
Reference in New Issue
Block a user