Remove race condition (in TaskLog)

Delete all duplicate rows with same (task_name, host, period_beginning,
period_ending) expect one with the biggest value in `id` column.

Create UC on fields (task_name, host, period_beginning, period_ending)

Replace Select then Insert -> Try to Insert.

blueprint db-unique-keys

Change-Id: I99f45a6de6630482e9c56738f894cc55a37fffaf
Merge "Remove race condition (in TaskLog)"