Browse code

Merge pull request #306 from thaJeztah/19.03_bump_swarmkit

[19.03] bump swarmkit to 4fb9e961aba635f0240a140e89ece6d6c2082585 (bump_v19.03)

Andrew Hsu authored on 2019/08/09 14:52:52
Showing 2 changed files
... ...
@@ -130,7 +130,7 @@ github.com/containerd/ttrpc                         f02858b1457c5ca3aaec3a0803eb
130 130
 github.com/gogo/googleapis                          d31c731455cb061f42baff3bda55bad0118b126b # v1.2.0
131 131
 
132 132
 # cluster
133
-github.com/docker/swarmkit                          961ec3a56b7b6c311a2137b6a398f9d778fba94b # bump_v19.03 branch
133
+github.com/docker/swarmkit                          4fb9e961aba635f0240a140e89ece6d6c2082585 # bump_v19.03 branch
134 134
 github.com/gogo/protobuf                            ba06b47c162d49f2af050fb4c75bcbc86a159d5c # v1.2.1
135 135
 github.com/cloudflare/cfssl                         5d63dbd981b5c408effbb58c442d54761ff94fbd # 1.3.2
136 136
 github.com/fernet/fernet-go                         1b2437bc582b3cfbb341ee5a29f8ef5b42912ff2
... ...
@@ -265,12 +265,23 @@ func orphanNodeTasks(tx store.Tx, nodeID string) error {
265 265
 		return err
266 266
 	}
267 267
 	for _, task := range tasks {
268
-		task.Status = api.TaskStatus{
269
-			Timestamp: gogotypes.TimestampNow(),
270
-			State:     api.TaskStateOrphaned,
271
-			Message:   "Task belonged to a node that has been deleted",
268
+		// this operation must occur within the same transaction boundary. If
269
+		// we cannot accomplish this task orphaning in the same transaction, we
270
+		// could crash or die between transactions and not get a chance to do
271
+		// this. however, in cases were there is an exceptionally large number
272
+		// of tasks for a node, this may cause the transaction to exceed the
273
+		// max message size.
274
+		//
275
+		// therefore, we restrict updating to only tasks in a non-terminal
276
+		// state. Tasks in a terminal state do not need to be updated.
277
+		if task.Status.State < api.TaskStateCompleted {
278
+			task.Status = api.TaskStatus{
279
+				Timestamp: gogotypes.TimestampNow(),
280
+				State:     api.TaskStateOrphaned,
281
+				Message:   "Task belonged to a node that has been deleted",
282
+			}
283
+			store.UpdateTask(tx, task)
272 284
 		}
273
-		store.UpdateTask(tx, task)
274 285
 	}
275 286
 	return nil
276 287
 }