facebook/presto — pull request #1747 by dain (2014-10-01 23:01:42+00:00)
Title: Fix race condition in SqlTask createTaskInfo

This fixes a race condition in the task info management of SqlTask. When a
SqlTask finishes the TaskInfo is permanently, and all calls to getTaskInfo
return the final instance. The problem is while the final task info is being
updated another thread may create a new task info with a higher version number
in the running state. The client will receive the higher version number and
reject the final task info with a lower version number. The query will never
finish because it the final task info version number never increases.

The fix changes the SqlTask to always return a new TaskInfo for each call to
getTaskInfo with a new version number.