• Narayanan Iyer's avatar
    [#25] Fix DATA RACE issues with easyAPIDefaultDataSize,... · c74a703c
    Narayanan Iyer authored
    [#25] Fix DATA RACE issues with easyAPIDefaultDataSize, easyAPIDefaultSubscrCnt and easyAPIDefaultSubscrSize variables in easy_api.go
    
    Background
    ----------
    * Running the `go/randomWalk` subtest hundreds of times showed a rare failure involving two types
      of DATA RACE identified by the Go race detector (randomly enabled by test framework).
    
    * The first type was a write/write data race. The race detector identified that line 407 below
      can be concurrently executed by multiple goroutines.
    
      ```go
      Writer goroutine
      ----------------
         387 func NodeNextE(tptoken uint64, errstr *BufferT, varname string, subary []string) ([]string, error) {
           .
         403     // Check if we had an INVSTRLEN error (too small an output buffer)
         404     errorcode := ErrorCode(err)
         405     if int(YDB_ERR_INSUFFSUBS) == errorcode {
         406             // This is INSUFFSUBS - pickup number of subscripts we actually need and reallocate
      -> 407             easyAPIDefaultSubscrCnt = dbsubs.ElemUsed()
         408       ...
    c74a703c
yottadb.go 4.58 KB