You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by sandhyasun <gi...@git.apache.org> on 2018/06/01 07:38:13 UTC

[GitHub] trafodion pull request #1586: [TRAFODION-2946] Support to provide a locking ...

Github user sandhyasun commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1586#discussion_r192318454
  
    --- Diff: core/sql/runtimestats/sscpipc.cpp ---
    @@ -907,3 +910,53 @@ void SscpNewIncomingConnectionStream::processSecInvReq()
       request->decrRefCount();
     }
     
    +void SscpNewIncomingConnectionStream::processLobLockReq()
    +{
    +  IpcMessageObjVersion msgVer = getNextObjVersion();
    +
    +  ex_assert(msgVer <= currRtsStatsReqVersionNumber, "Up-rev message received.");
    +  NAHeap *statsHeap = NULL;
    +  LobLockRequest *request = new(getHeap())
    +    LobLockRequest(getHeap());
    +
    +  *this >> *request;
    +  ex_assert( !moreObjects(), "unknown object follows LobLockRequest.");
    +  SscpGlobals *sscpGlobals = getSscpGlobals();
    +  StatsGlobals *statsGlobals = sscpGlobals->getStatsGlobals();
    +  int error = statsGlobals->getStatsSemaphore(sscpGlobals->getSemId(),
    +                  sscpGlobals->myPin());
    +  statsHeap = statsGlobals->getStatsHeap();
    +  char *ll = new (statsHeap) char [LOB_LOCK_ID_SIZE];
    +  memcpy(ll,request->getLobLockId(),LOB_LOCK_ID_SIZE+1);
    +  SyncHashQueue *lobLockList = statsGlobals->getLobLocks();
    +  if (ll[0] == '+') // If it's a positive value, we are supposed to insert it.
    --- End diff --
    
    To address the scenario where 2 clients on different nodes check for a lock and being the process of setting it, instead of simply setting/inserting into the HashQueue, we should do an extra check for existence here before setting . If it's already there, some other process on another node may have propagated the same lockLockId first . So we should send a diagsArea back here to indicate the set  for this client/process failed. 


---