gpdb icon indicating copy to clipboard operation
gpdb copied to clipboard

Resolve Deadlock: Allow Concurrent Creation of Non-First Index on AO

Open ashwinstar opened this issue 1 year ago • 0 comments
trafficstars

AlterTableCreateAoBlkdirTable() is being called unconditionally, it upgrades ShareLock to ShareRowExclusiveLock hence may result in deadlock for concurrent index creation even if block directory is present on the append-optimized table. This is regression in 7X compared to 6X. As a fix avoiding call to AlterTableCreateAoBlkdirTable() if block directory is present which is checked already in DefineIndex() with ShareLock held.

Just note: the deadlock case for concurrent index creations in absence of block directory (which is initial index) still exists, as in absence of block directory, lock upgrade from ShareLock to ShareRowExclusiveLock in DefineIndex() still exists and is hard to resolve. Existing test concurrent_index_creation_should_not_deadlock wasn't testing the case correctly. Hence modifying that test to only validate for now non-first index creation case.

Here are some reminders before you submit the pull request

  • [ ] Add tests for the change
  • [ ] Document changes
  • [ ] Communicate in the mailing list if needed
  • [ ] Pass make installcheck
  • [ ] Review a PR in return to support the community

ashwinstar avatar Apr 29 '24 16:04 ashwinstar