Skip to content

Commit

Permalink
AER-6775 - don't e-flag partitions if fresh drives were added, only i…
Browse files Browse the repository at this point in the history
…f drives were wiped.
  • Loading branch information
gooding470 committed Oct 24, 2024
1 parent b3162d0 commit e777b29
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 40 deletions.
3 changes: 1 addition & 2 deletions as/include/storage/drv_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ COMPILER_ASSERT(offsetof(drv_header, generic.prefix) == 0);
// Public API - shared code between storage engines.
//

void drv_adjust_versions(struct as_namespace_s* ns, drv_pmeta* pmeta);
void drv_auto_revive(struct as_namespace_s* ns, drv_pmeta* pmeta);
void drv_adjust_sc_version_flags(struct as_namespace_s* ns, drv_pmeta* pmeta, bool wiped_drives, bool dirty);
bool drv_is_set_evictable(const struct as_namespace_s* ns, const struct as_flat_opt_meta_s* opt_meta);
void drv_apply_opt_meta(struct as_index_s* r, struct as_namespace_s* ns, const struct as_flat_opt_meta_s* opt_meta);
bool pread_all(int fd, void* buf, size_t size, off_t offset);
Expand Down
22 changes: 7 additions & 15 deletions as/src/storage/drv_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ init_synchronous(drv_mems* mems)
headers[i]->unique.device_id = (uint32_t)i;
}

drv_adjust_versions(ns, mems->generic->pmeta);
drv_adjust_sc_version_flags(ns, mems->generic->pmeta, true, false);

flush_header(mems, headers);

Expand All @@ -1229,7 +1229,7 @@ init_synchronous(drv_mems* mems)

// At least one device is not fresh. Check that all non-fresh devices match.

bool fresh_drive = false;
uint32_t n_fresh_drives = 0;
bool non_commit_drive = false;
drv_prefix* prefix_first = &headers[first_used]->generic.prefix;

Expand All @@ -1246,7 +1246,7 @@ init_synchronous(drv_mems* mems)
if (prefix_i->random == 0) {
cf_info(AS_DRV_MEM, "{%s} device %s is empty", ns->name,
mem->name);
fresh_drive = true;
n_fresh_drives++;
continue;
}

Expand Down Expand Up @@ -1279,23 +1279,15 @@ init_synchronous(drv_mems* mems)
mems->generic = cf_valloc(ROUND_UP_GENERIC);
memcpy(mems->generic, &headers[first_used]->generic, ROUND_UP_GENERIC);

mems->generic->prefix.n_devices = n_mems; // may have added fresh drives
mems->generic->prefix.n_devices = n_mems; // may have added/removed drives
mems->generic->prefix.random = random;
mems->generic->prefix.flags &= ~DRV_HEADER_FLAG_TRUSTED;

flush_flags(mems);

if (fresh_drive || n_mems < prefix_first->n_devices) {
drv_adjust_versions(ns, mems->generic->pmeta);
}
else if (ns->dirty_restart && non_commit_drive) {
if (ns->auto_revive) {
drv_auto_revive(ns, mems->generic->pmeta);
}
else {
drv_adjust_versions(ns, mems->generic->pmeta);
}
}
drv_adjust_sc_version_flags(ns, mems->generic->pmeta,
n_mems < prefix_first->n_devices + n_fresh_drives,
ns->dirty_restart && non_commit_drive);

flush_header(mems, headers);
flush_final_cfg(ns);
Expand Down
22 changes: 7 additions & 15 deletions as/src/storage/drv_ssd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3289,7 +3289,7 @@ ssd_init_synchronous(drv_ssds *ssds)
headers[i]->unique.device_id = (uint32_t)i;
}

drv_adjust_versions(ns, ssds->generic->pmeta);
drv_adjust_sc_version_flags(ns, ssds->generic->pmeta, true, false);

ssd_flush_header(ssds, headers);

Expand All @@ -3307,7 +3307,7 @@ ssd_init_synchronous(drv_ssds *ssds)

// At least one device is not fresh. Check that all non-fresh devices match.

bool fresh_drive = false;
uint32_t n_fresh_drives = 0;
bool non_commit_drive = false;
drv_prefix *prefix_first = &headers[first_used]->generic.prefix;

Expand All @@ -3323,7 +3323,7 @@ ssd_init_synchronous(drv_ssds *ssds)
// Skip fresh devices.
if (prefix_i->random == 0) {
cf_info(AS_DRV_SSD, "{%s} device %s is empty", ns->name, ssd->name);
fresh_drive = true;
n_fresh_drives++;
continue;
}

Expand Down Expand Up @@ -3356,21 +3356,13 @@ ssd_init_synchronous(drv_ssds *ssds)
ssds->generic = cf_valloc(ROUND_UP_GENERIC);
memcpy(ssds->generic, &headers[first_used]->generic, ROUND_UP_GENERIC);

ssds->generic->prefix.n_devices = n_ssds; // may have added fresh drives
ssds->generic->prefix.n_devices = n_ssds; // may have added/removed drives
ssds->generic->prefix.random = random;
ssds->generic->prefix.flags &= ~DRV_HEADER_FLAG_TRUSTED;

if (fresh_drive || n_ssds < prefix_first->n_devices) {
drv_adjust_versions(ns, ssds->generic->pmeta);
}
else if (ns->dirty_restart && non_commit_drive) {
if (ns->auto_revive) {
drv_auto_revive(ns, ssds->generic->pmeta);
}
else {
drv_adjust_versions(ns, ssds->generic->pmeta);
}
}
drv_adjust_sc_version_flags(ns, ssds->generic->pmeta,
n_ssds < prefix_first->n_devices + n_fresh_drives,
ns->dirty_restart && non_commit_drive);

ssd_flush_header(ssds, headers);
ssd_flush_final_cfg(ns);
Expand Down
10 changes: 2 additions & 8 deletions as/src/storage/drv_ssd_ce.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@ ssd_cold_start_drop_cenotaphs(as_namespace* ns)

// TODO - move to drv_common_ce.c in 8.0!
void
drv_adjust_versions(as_namespace* ns, drv_pmeta* pmeta)
{
// Nothing to do - relevant for enterprise version only.
}

// TODO - move to drv_common_ce.c in 8.0!
void
drv_auto_revive(as_namespace* ns, drv_pmeta* pmeta)
drv_adjust_sc_version_flags(as_namespace* ns, drv_pmeta* pmeta,
bool wiped_drives, bool dirty)
{
// Nothing to do - relevant for enterprise version only.
}
Expand Down

0 comments on commit e777b29

Please sign in to comment.