Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mon: post-jewel cleanups #13150

Merged
merged 2 commits into from Jan 31, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+31 −81
Diff settings

Always

Just for now

Prev

mon: assert if pgmap's format_version < 1

we bump the pgmap's format_version to 1 and the monitor's protocol
version to 12 in 2d2aa00. and it is required to upgrade to jewel before
upgrading to kraken or luminous. so we can safely assume that the
PGMonitor's format_version is always greater or equal to 1.

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information...
tchaikov committed Jan 24, 2017
commit e5c256d12eb0de3f589738f64be16aa4daa18f58
@@ -168,93 +168,43 @@ void PGMonitor::update_from_paxos(bool *need_bootstrap)
return;

assert(version >= pg_map.version);

if (format_version == 0) {
// old format

/* Obtain latest full pgmap version, if available and whose version is
* greater than the current pgmap's version.
*/
version_t latest_full = get_version_latest_full();
if ((latest_full > 0) && (latest_full > pg_map.version)) {
bufferlist latest_bl;
int err = get_version_full(latest_full, latest_bl);
assert(err == 0);
dout(7) << __func__ << " loading latest full pgmap v"
<< latest_full << dendl;
try {
PGMap tmp_pg_map;
bufferlist::iterator p = latest_bl.begin();
tmp_pg_map.decode(p);
pg_map = tmp_pg_map;
} catch (const std::exception& e) {
dout(0) << __func__ << ": error parsing update: "
<< e.what() << dendl;
assert(0 == "update_from_paxos: error parsing update");
return;
}
}

// walk through incrementals
while (version > pg_map.version) {
bufferlist bl;
int err = get_version(pg_map.version+1, bl);
assert(err == 0);
assert(bl.length());

dout(7) << "update_from_paxos applying incremental " << pg_map.version+1 << dendl;
PGMap::Incremental inc;
try {
bufferlist::iterator p = bl.begin();
inc.decode(p);
} catch (const std::exception &e) {
dout(0) << "update_from_paxos: error parsing "
<< "incremental update: " << e.what() << dendl;
assert(0 == "update_from_paxos: error parsing incremental update");
return;
}

pg_map.apply_incremental(g_ceph_context, inc);

dout(10) << pg_map << dendl;

if (inc.pg_scan)
last_sent_pg_create.clear(); // reset pg_create throttle timer
if (format_version < 1) {
derr << __func__ << "unsupported monitor protocol: "
<< get_service_name() << ".format_version = "
<< format_version << dendl;
}
assert(format_version >= 1);

// pg/osd keys in leveldb
// read meta
epoch_t last_pg_scan = pg_map.last_pg_scan;

while (version > pg_map.version) {
// load full state?
if (pg_map.version == 0) {
dout(10) << __func__ << " v0, read_full" << dendl;
read_pgmap_full();
goto out;
}

} else if (format_version == 1) {
// pg/osd keys in leveldb

// read meta
epoch_t last_pg_scan = pg_map.last_pg_scan;

while (version > pg_map.version) {
// load full state?
if (pg_map.version == 0) {
dout(10) << __func__ << " v0, read_full" << dendl;
read_pgmap_full();
goto out;
}

// incremental state?
dout(10) << __func__ << " read_incremental" << dendl;
bufferlist bl;
int r = get_version(pg_map.version + 1, bl);
if (r == -ENOENT) {
dout(10) << __func__ << " failed to read_incremental, read_full" << dendl;
read_pgmap_full();
goto out;
}
assert(r == 0);
apply_pgmap_delta(bl);
// incremental state?
dout(10) << __func__ << " read_incremental" << dendl;
bufferlist bl;
int r = get_version(pg_map.version + 1, bl);
if (r == -ENOENT) {
dout(10) << __func__ << " failed to read_incremental, read_full" << dendl;
read_pgmap_full();
goto out;
}
assert(r == 0);
apply_pgmap_delta(bl);
}

read_pgmap_meta();
read_pgmap_meta();

out:
if (last_pg_scan != pg_map.last_pg_scan)
last_sent_pg_create.clear(); // reset pg_create throttle timer
}
if (last_pg_scan != pg_map.last_pg_scan)
last_sent_pg_create.clear(); // reset pg_create throttle timer

assert(version == pg_map.version);

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.