trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #889: [TRAFODION-2408] Changes to support "...
Date Tue, 03 Jan 2017 19:32:25 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/889#discussion_r94467477
  
    --- Diff: core/sql/exp/ExpLOBaccess.cpp ---
    @@ -1502,7 +1507,50 @@ Ex_Lob_Error ExLob::allocateDesc(ULng32 size, Int64 &descNum,
Int64 &dataOffset,
         char logBuf[4096];
         lobDebugInfo("In ExLob::allocateDesc",0,__LINE__,lobTrace_);
         Int32 openFlags = O_RDONLY ;   
    -    
    +    if (size == 0) //we are trying to empty this lob.
    +      {
    +        //rename lob datafile
    +        char * saveLobDataFile = new(getLobGlobalHeap()) char[MAX_LOB_FILE_NAME_LEN+6];
    +        str_sprintf(saveLobDataFile, "%s_save",lobDataFile_);
    +        Int32 rc2 = hdfsRename(fs_,lobDataFile_,saveLobDataFile);
    +        if (rc2 == -1)
    +          {
    +            lobDebugInfo("Problem renaming datafile to save data file",0,__LINE__,lobTrace_);
    +            NADELETEBASIC(saveLobDataFile,getLobGlobalHeap());
    +            return LOB_DATA_FILE_WRITE_ERROR;
    +          }
    +        //create a new file of the same name.
    +        hdfsFile fdNew = hdfsOpenFile(fs_, lobDataFile_,O_WRONLY|O_CREAT,0,0,0);
    +        if (!fdNew) 
    +          {
    +            str_sprintf(logBuf,"Could not create/open file:%s",lobDataFile_);
    +            lobDebugInfo(logBuf,0,__LINE__,lobTrace_);
    +            
    +            //restore previous version
    +            Int32 rc2 = hdfsRename(fs_,saveLobDataFile,lobDataFile_);
    +              if (rc2 == -1)
    +                {
    +                  lobDebugInfo("Problem restoring datafile . Will need to retry the update",0,__LINE__,lobTrace_);
    +                  NADELETEBASIC(saveLobDataFile,getLobGlobalHeap());
    +                  return LOB_DATA_FILE_WRITE_ERROR;
    +                }
    +            return LOB_DATA_FILE_OPEN_ERROR;
    --- End diff --
    
    But we don't reach the "else" part. If at line 1531, rc is not -1, we proceed to line
1537 and do a return. Unless I'm not reading this correctly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message