Repository: aurora Updated Branches: refs/heads/master 6c897e520 -> 4f0299b2a
Deprecated Ops re-added, perform no-op instead of throwing an exception. Bugs closed: AURORA-1959 Reviewed at https://reviews.apache.org/r/64459/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/4f0299b2 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/4f0299b2 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/4f0299b2 Branch: refs/heads/master Commit: 4f0299b2ada81932feb5c06fd223c0fdbd303c18 Parents: 6c897e5 Author: Jordan Ly <jordan....@gmail.com> Authored: Fri Dec 8 18:32:06 2017 -0800 Committer: Bill Farner <wfar...@apache.org> Committed: Fri Dec 8 18:32:06 2017 -0800 ---------------------------------------------------------------------- .../thrift/org/apache/aurora/gen/api.thrift | 21 ++++++++++++++++++++ .../thrift/org/apache/aurora/gen/storage.thrift | 14 +++++++++++-- .../storage/durability/DurableStorage.java | 6 ++++++ .../storage/durability/DurableStorageTest.java | 8 ++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/4f0299b2/api/src/main/thrift/org/apache/aurora/gen/api.thrift ---------------------------------------------------------------------- diff --git a/api/src/main/thrift/org/apache/aurora/gen/api.thrift b/api/src/main/thrift/org/apache/aurora/gen/api.thrift index c9f4210..ef754e3 100644 --- a/api/src/main/thrift/org/apache/aurora/gen/api.thrift +++ b/api/src/main/thrift/org/apache/aurora/gen/api.thrift @@ -115,6 +115,27 @@ struct JobKey { 3: string name } +// TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. +/** A unique lock key. */ +union LockKey { + 1: JobKey job +} + +// TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. +/** A generic lock struct to facilitate context specific resource/operation serialization. */ +struct Lock { + /** ID of the lock - unique per storage */ + 1: LockKey key + /** UUID - facilitating soft lock authorization */ + 2: string token + /** Lock creator */ + 3: string user + /** Lock creation timestamp in milliseconds */ + 4: i64 timestampMs + /** Optional message to record with the lock */ + 5: optional string message +} + /** A unique identifier for the active task within a job. */ struct InstanceKey { /** Key identifying the job. */ http://git-wip-us.apache.org/repos/asf/aurora/blob/4f0299b2/api/src/main/thrift/org/apache/aurora/gen/storage.thrift ---------------------------------------------------------------------- diff --git a/api/src/main/thrift/org/apache/aurora/gen/storage.thrift b/api/src/main/thrift/org/apache/aurora/gen/storage.thrift index 2210497..b79e204 100644 --- a/api/src/main/thrift/org/apache/aurora/gen/storage.thrift +++ b/api/src/main/thrift/org/apache/aurora/gen/storage.thrift @@ -28,6 +28,16 @@ struct SaveCronJob { 2: api.JobConfiguration jobConfig } +// TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. +struct SaveLock { + 1: api.Lock lock +} + +// TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. +struct RemoveLock { + 1: api.LockKey lockKey +} + struct RemoveJob { 2: api.JobKey jobKey } @@ -92,8 +102,8 @@ union Op { 9: RemoveQuota removeQuota 10: SaveHostAttributes saveHostAttributes // 11: removed - // 12: deleted - // 13: deleted + 12: SaveLock saveLock // TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. + 13: RemoveLock removeLock // TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. 14: SaveJobUpdate saveJobUpdate 15: SaveJobUpdateEvent saveJobUpdateEvent 16: SaveJobInstanceUpdateEvent saveJobInstanceUpdateEvent http://git-wip-us.apache.org/repos/asf/aurora/blob/4f0299b2/src/main/java/org/apache/aurora/scheduler/storage/durability/DurableStorage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/aurora/scheduler/storage/durability/DurableStorage.java b/src/main/java/org/apache/aurora/scheduler/storage/durability/DurableStorage.java index 85b2113..6a7c0ad 100644 --- a/src/main/java/org/apache/aurora/scheduler/storage/durability/DurableStorage.java +++ b/src/main/java/org/apache/aurora/scheduler/storage/durability/DurableStorage.java @@ -221,6 +221,12 @@ public class DurableStorage implements NonVolatileStorage { LOG.info("Dropping host attributes with no agent ID: " + attributes); } }) + .put( + Op._Fields.SAVE_LOCK, // TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. + op -> { /* no-op */ }) + .put( + Op._Fields.REMOVE_LOCK, // TODO(jly): Deprecated, remove in 0.21. See AURORA-1959. + op -> { /* no-op */ }) .put(Op._Fields.SAVE_JOB_UPDATE, op -> writeBehindJobUpdateStore.saveJobUpdate( thriftBackfill.backFillJobUpdate(op.getSaveJobUpdate().getJobUpdate()))) http://git-wip-us.apache.org/repos/asf/aurora/blob/4f0299b2/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java b/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java index 07912b6..3ad40ad 100644 --- a/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java +++ b/src/test/java/org/apache/aurora/scheduler/storage/durability/DurableStorageTest.java @@ -51,6 +51,7 @@ import org.apache.aurora.gen.storage.Op; import org.apache.aurora.gen.storage.PruneJobUpdateHistory; import org.apache.aurora.gen.storage.RemoveJob; import org.apache.aurora.gen.storage.RemoveJobUpdates; +import org.apache.aurora.gen.storage.RemoveLock; import org.apache.aurora.gen.storage.RemoveQuota; import org.apache.aurora.gen.storage.RemoveTasks; import org.apache.aurora.gen.storage.SaveCronJob; @@ -59,6 +60,7 @@ import org.apache.aurora.gen.storage.SaveHostAttributes; import org.apache.aurora.gen.storage.SaveJobInstanceUpdateEvent; import org.apache.aurora.gen.storage.SaveJobUpdate; import org.apache.aurora.gen.storage.SaveJobUpdateEvent; +import org.apache.aurora.gen.storage.SaveLock; import org.apache.aurora.gen.storage.SaveQuota; import org.apache.aurora.gen.storage.SaveTasks; import org.apache.aurora.scheduler.base.JobKeys; @@ -233,6 +235,12 @@ public class DurableStorageTest extends EasyMockTest { expect(storageUtil.attributeStore.saveHostAttributes( IHostAttributes.build(hostAttributes2.getHostAttributes()))).andReturn(true); + builder.add(Op.saveLock(new SaveLock())); + // TODO(jly): Deprecated, this is a no-op to be removed in 0.21. See AURORA-1959. + + builder.add(Op.removeLock(new RemoveLock())); + // TODO(jly): Deprecated, this is a no-op to be removed in 0.21. See AURORA-1959. + JobUpdate actualUpdate = new JobUpdate() .setSummary(new JobUpdateSummary().setKey(UPDATE_ID.newBuilder())) .setInstructions(new JobUpdateInstructions()