Identify and handle race conditions | Databricks Interview Question