Signed-off-by: Sage Weil <sage@redhat.com>
pg->read_state(store, bl);
if (pg->must_upgrade()) {
+ if (!pg->can_upgrade()) {
+ derr << "PG needs upgrade, but on-disk data is too old; upgrade to"
+ << " an older version first." << dendl;
+ assert(0 == "PG too old to upgrade");
+ }
if (!has_upgraded) {
derr << "PGs are upgrading" << dendl;
has_upgraded = true;
pg_info_t info;
__u8 info_struct_v;
static const __u8 cur_struct_v = 8;
+ // v7 was SnapMapper addition in 86658392516d5175b2756659ef7ffaaf95b0f8ad
+ // (first appeared in cuttlefish).
+ static const __u8 compat_struct_v = 7;
bool must_upgrade() {
- return info_struct_v < 8;
+ return info_struct_v < cur_struct_v;
+ }
+ bool can_upgrade() {
+ return info_struct_v >= compat_struct_v;
}
void upgrade(
ObjectStore *store,
ret = 1;
goto out;
}
+ if (struct_ver < PG::compat_struct_v) {
+ cerr << "PG is too old to upgrade, use older Ceph version" << std::endl;
+ ret = 1;
+ goto out;
+ }
if (debug)
cerr << "struct_v " << (int)struct_ver << std::endl;