Patch with tests for table retry/timeout problem