/*
check_rotate();
*/
-
- upgrade_format();
}
void AuthMonitor::create_initial()
if (last_allocated_id == 0)
last_allocated_id = max_global_id;
- format_version = get_value("format_version");
-
dout(10) << "update_from_paxos() last_allocated_id=" << last_allocated_id
<< " max_global_id=" << max_global_id
<< " format_version " << format_version
for (p = pending_auth.begin(); p != pending_auth.end(); ++p)
p->encode(bl, mon->get_quorum_features());
- if (format_version > 0) {
- t->put(get_service_name(), "format_version", format_version);
- }
-
version_t version = get_last_committed() + 1;
put_version(t, version, bl);
put_last_committed(t, version);
uint64_t max_global_id;
uint64_t last_allocated_id;
- version_t format_version;
-
void upgrade_format();
void export_keyring(KeyRing& keyring);
bool check_rotate();
public:
AuthMonitor(Monitor *mn, Paxos *p, const string& service_name)
- : PaxosService(mn, p, service_name), last_rotating_ver(0),
- max_global_id(0), last_allocated_id(0),
- format_version(0)
+ : PaxosService(mn, p, service_name),
+ last_rotating_ver(0),
+ max_global_id(0),
+ last_allocated_id(0)
{}
void pre_auth(MAuth *m);
// update cached versions
cached_first_committed = mon->store->get(get_service_name(), first_committed_name);
cached_last_committed = mon->store->get(get_service_name(), last_committed_name);
+ format_version = get_value("format_version");
dout(10) << __func__ << dendl;
encode_pending(&t);
have_pending = false;
+ if (format_version > 0) {
+ t.put(get_service_name(), "format_version", format_version);
+ }
+
dout(30) << __func__ << " transaction dump:\n";
JSONFormatter f(true);
t.dump(&f);
// on this list; it is on Paxos's.
finish_contexts(g_ceph_context, waiting_for_finished_proposal, 0);
+ if (is_active() && mon->is_leader())
+ upgrade_format();
+
// NOTE: it's possible that this will get called twice if we commit
// an old paxos value. Implementations should be mindful of that.
if (is_active())
version_t trim_version;
protected:
+
+ /**
+ * format of our state in leveldb, 0 for default
+ */
+ version_t format_version;
+
+
+
/**
* @defgroup PaxosService_h_callbacks Callback classes
* @{
proposing(false),
service_version(0), proposal_timer(0), have_pending(false),
trim_version(0),
+ format_version(0),
last_committed_name("last_committed"),
first_committed_name("first_committed"),
full_prefix_name("full"), full_latest_name("latest"),
*/
virtual void on_active() { }
+ /**
+ * this is called when activating on the leader
+ *
+ * it should conditionally upgrade the on-disk format by proposing a transaction
+ */
+ virtual void upgrade_format() { }
+
/**
* Called when the Paxos system enters a Leader election.
*