Branch: Tag:

2018-06-02

2018-06-02 11:10:37 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Release lock on collision with another thread on the same portal.

516: Inside #if defined(PG_DEBUGRACE)
   PD("Nostash locked by %s\n",    describe_backtrace(nostash->current_locking_thread()->backtrace()));   #endif -  if (lock = (waitforreal ? nostash->lock : nostash->trylock)(1)) { +  while (lock = (waitforreal ? nostash->lock : nostash->trylock)(1)) { +  int mode; +  if (sizeof(stash) && (mode = getstash(KEEP)) > KEEP) +  sendcmd(mode); // Force out stash to the server +  if (!stashcount->drained()) { +  lock = 0; // Unlock while we wait    stashcount->wait_till_drained(); -  +  continue; // Try again +  }   #ifdef PG_DEBUGRACE    conxsess sess = conxsess(this);   #endif -  int mode; -  if (sizeof(stash) && (mode = getstash(KEEP)) > KEEP) -  sendcmd(mode); // Force out stash to the server +     started = lock; // sendcmd() clears started, so delay assignment   #ifdef PG_DEBUGRACE    return sess;