Repository: mesos Updated Branches: refs/heads/master 5c6d88262 -> 50d504931
Fixed incorrect enum value comparisons. Due to ADL the enum values found originally found in this function where from the v0 namespace while the value we compared to was from the v1 namespace. While this might work should the enum values in v0 and v1 map to the same enum values, it does not seem to have been the intention and is brittle. This patch uses slightly longer names to refer to the enum values which do not map onto symbols found via ADL. Review: https://reviews.apache.org/r/66903/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fc130f80 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fc130f80 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fc130f80 Branch: refs/heads/master Commit: fc130f8060d1499eec95608948ceaf03ed8efbba Parents: 5c6d882 Author: Benjamin Bannier <[email protected]> Authored: Wed May 2 14:00:10 2018 -0700 Committer: James Peach <[email protected]> Committed: Wed May 2 14:00:10 2018 -0700 ---------------------------------------------------------------------- .../org_apache_mesos_v1_scheduler_V0Mesos.cpp | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/fc130f80/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp ---------------------------------------------------------------------- diff --git a/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp b/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp index ea8d54f..1deeb08 100644 --- a/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp +++ b/src/java/jni/org_apache_mesos_v1_scheduler_V0Mesos.cpp @@ -560,7 +560,7 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) } switch (call.type()) { - case Call::SUBSCRIBE: { + case scheduler::Call::SUBSCRIBE: { subscribeCall = true; heartbeatTimer = process::delay(interval, self(), &Self::heartbeat); @@ -573,12 +573,12 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) break; } - case Call::TEARDOWN: { + case scheduler::Call::TEARDOWN: { driver->stop(false); break; } - case Call::ACCEPT: { + case scheduler::Call::ACCEPT: { vector<OfferID> offerIds; foreach (const OfferID& offerId, call.accept().offer_ids()) { offerIds.emplace_back(offerId); @@ -598,15 +598,15 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) break; } - case Call::ACCEPT_INVERSE_OFFERS: - case Call::DECLINE_INVERSE_OFFERS: - case Call::SHUTDOWN: { + case scheduler::Call::ACCEPT_INVERSE_OFFERS: + case scheduler::Call::DECLINE_INVERSE_OFFERS: + case scheduler::Call::SHUTDOWN: { // TODO(anand): Throw java error. LOG(ERROR) << "Received an unexpected " << call.type() << " call"; break; } - case Call::DECLINE: { + case scheduler::Call::DECLINE: { foreach (const OfferID& offerId, call.decline().offer_ids()) { if (call.decline().has_filters()) { driver->declineOffer(offerId, call.decline().filters()); @@ -618,17 +618,17 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) break; } - case Call::REVIVE: { + case scheduler::Call::REVIVE: { driver->reviveOffers(); break; } - case Call::KILL: { + case scheduler::Call::KILL: { driver->killTask(call.kill().task_id()); break; } - case Call::ACKNOWLEDGE: { + case scheduler::Call::ACKNOWLEDGE: { TaskStatus status; status.mutable_task_id()->CopyFrom(call.acknowledge().task_id()); status.mutable_slave_id()->CopyFrom(call.acknowledge().slave_id()); @@ -639,10 +639,10 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) } // TODO(greggomann): Implement operation status acknowledgement. - case Call::ACKNOWLEDGE_OPERATION_STATUS: + case scheduler::Call::ACKNOWLEDGE_OPERATION_STATUS: break; - case Call::RECONCILE: { + case scheduler::Call::RECONCILE: { vector<TaskStatus> statuses; foreach (const scheduler::Call::Reconcile::Task& task, @@ -657,10 +657,10 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) } // TODO(greggomann): Implement operation reconciliation. - case Call::RECONCILE_OPERATIONS: + case scheduler::Call::RECONCILE_OPERATIONS: break; - case Call::MESSAGE: { + case scheduler::Call::MESSAGE: { driver->sendFrameworkMessage( call.message().executor_id(), call.message().slave_id(), @@ -668,7 +668,7 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) break; } - case Call::REQUEST: { + case scheduler::Call::REQUEST: { vector<Request> requests; foreach (const Request& request, call.request().requests()) { @@ -679,12 +679,12 @@ void V0ToV1AdapterProcess::send(SchedulerDriver* driver, const Call& _call) break; } - case Call::SUPPRESS: { + case scheduler::Call::SUPPRESS: { driver->suppressOffers(); break; } - case Call::UNKNOWN: { + case scheduler::Call::UNKNOWN: { EXIT(EXIT_FAILURE) << "Received an unexpected " << call.type() << " call"; break;
