You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by HowardQin <gi...@git.apache.org> on 2015/07/02 15:52:56 UTC

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

GitHub user HowardQin opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/17

    OSIM REWORK JIRA TRAFODION-16

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HowardQin/incubator-trafodion master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/17.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17
    
----
commit 05f038f6663b17e220a9fbae26c629eff1c155b4
Author: qinhao <ha...@hp.com>
Date:   2015-07-02T10:30:16Z

    Rework on OSIM

commit 4ed201f06214a10bea8d99210994b435a5420522
Author: qinhao <ha...@hp.com>
Date:   2015-07-02T10:30:16Z

    Rework on OSIM [TRAFODION-16]

commit 002c83f68ea59c8ab78e78f3c53eb2e204daf027
Author: qinhao <ha...@hp.com>
Date:   2015-07-02T13:50:21Z

    Merge branch 'master' of github.com:HowardQin/incubator-trafodion

----


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by zellerh <gi...@git.apache.org>.
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r33944499
  
    --- Diff: core/sql/optimizer/NAClusterInfo.cpp ---
    @@ -296,13 +299,13 @@ NAClusterInfo::NAClusterInfo(CollHeap * heap)
           // Hash Map to store NodeName and NoideIds
           nodeNameToNodeIdMap_ = new (heap) NAHashDictionary<NAString, Int32>
               (NAString::hash, 101, TRUE, heap_);
    -      dp2NameToInfoMap_ = new(heap) NAHashDictionary<DP2name,DP2info>
    -          (&dp2DescHashFunc, 101,TRUE,heap);
    +          
           clusterToCPUMap_ = new(heap) NAHashDictionary<CollIndex,maps>
    -          (&clusterNumHashFunc,17,TRUE, heap);
    -      tableToClusterMap_ = new(heap) NAHashDictionary<CollIndex, maps> 
    -          (&tableIdentHashFunc, 13, TRUE, heap);
    -
    +                                                          (&clusterNumHashFunc,17,TRUE, heap);
    +                                                          
    +      nodeIdToNodeNameMap_ = new(heap) NAHashDictionary<Int32, NAString>
    +                                                          (&intHashFunc, 101,TRUE,heap);
    +                                                          
    --- End diff --
    
    This is ok, but I'm wondering whether an array wouldn't be easier, since this translates integer node ids into node names?


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by zellerh <gi...@git.apache.org>.
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r34153508
  
    --- Diff: core/sql/optimizer/OptimizerSimulator.cpp ---
    @@ -278,9 +277,10 @@ OptimizerSimulator::OptimizerSimulator(CollHeap *heap)
         sysCallLogFilePath_[sc]=NULL;
         writeSysCallStream_[sc]=NULL;
       }
    +  // Init log4cxx logging
    +  CommonLogger::instance().initLog4cxx("log4cxx.trafodion.osim.config");
    --- End diff --
    
    Great, thanks for removing it.


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by HowardQin <gi...@git.apache.org>.
Github user HowardQin commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r34025968
  
    --- Diff: core/sql/optimizer/OptimizerSimulator.cpp ---
    @@ -278,9 +277,10 @@ OptimizerSimulator::OptimizerSimulator(CollHeap *heap)
         sysCallLogFilePath_[sc]=NULL;
         writeSysCallStream_[sc]=NULL;
       }
    +  // Init log4cxx logging
    +  CommonLogger::instance().initLog4cxx("log4cxx.trafodion.osim.config");
    --- End diff --
    
    Yes, OSIM is running in compiler.
    The initialization process is not necessary, but we do need a separate logger to print OSIM message to console. 



---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by HowardQin <gi...@git.apache.org>.
Github user HowardQin commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r34120569
  
    --- Diff: core/sql/optimizer/OptimizerSimulator.cpp ---
    @@ -278,9 +277,10 @@ OptimizerSimulator::OptimizerSimulator(CollHeap *heap)
         sysCallLogFilePath_[sc]=NULL;
         writeSysCallStream_[sc]=NULL;
       }
    +  // Init log4cxx logging
    +  CommonLogger::instance().initLog4cxx("log4cxx.trafodion.osim.config");
    --- End diff --
    
    Hi Hans, I know your concern, in this latest commit, I will only use fprintf for OSIM logging, actually, fprintf was prefered in the first place, and messages weren't shown in trafci client, OSIM logger is not going to impact logging of other modules.


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by zellerh <gi...@git.apache.org>.
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r33945048
  
    --- Diff: core/sql/optimizer/OptimizerSimulator.cpp ---
    @@ -278,9 +277,10 @@ OptimizerSimulator::OptimizerSimulator(CollHeap *heap)
         sysCallLogFilePath_[sc]=NULL;
         writeSysCallStream_[sc]=NULL;
       }
    +  // Init log4cxx logging
    +  CommonLogger::instance().initLog4cxx("log4cxx.trafodion.osim.config");
    --- End diff --
    
    Isn't this running in the Trafodion process, master executor or compiler? If so, won't that interfere with the logger already established for the process? I'm wondering whether we need a separate logger for OSIM or whether we could just reuse the existing one?


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/17


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by HowardQin <gi...@git.apache.org>.
Github user HowardQin commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r34027278
  
    --- Diff: core/sql/export/NAStringDef.cpp ---
    @@ -347,6 +347,143 @@ NAString::resize(size_t N)
       fbstring_.resize(N, ' ');			// Shrank; truncate the string
     }
     
    +NAList<NAString> & NAString::split(char delim, NAList<NAString> & elems)
    +{
    +  int begin = 0;
    +  int end = 0;
    +  bool delim_found = false;
    +  elems.clear();
    +  end = fbstring_.find_first_of(delim, begin);
    +  while(end >= begin)
    +  {
    +     NAString word(fbstring_.data() + begin,  end - begin);
    +     elems.insert(word);
    +     begin = end + 1;
    +     end = fbstring_.find_first_of(delim, begin);
    +     delim_found = true;
    +  }
    +
    +  if(fbstring_.size() > 0)
    +  {
    +    NAString end_word(fbstring_.data()+begin, fbstring_.size()-begin);
    +    elems.insert(end_word);
    +  }
    +  
    +  return elems;
    +}
    +
    +Int32 NAString::readFile(ifstream& in) // Read to EOF or null character.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readLine(ifstream& in)   // Read to EOF or newline.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!='\n' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readToDelim(ifstream& in, char delim) // Read to EOF or delimitor.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=delim && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +//This static function calculates and allocates buffer for the printf-like formatted string,
    +//and the formatted string is copied to buffer.
    +char* NAString::buildBuffer(const char* formatTemplate, va_list args)
    +{
    +  // calculate needed bytes to allocate memory from system heap.
    +  int bufferSize = 20049;
    +  int msgSize = 0;
    +  //buffer is managed by this static function
    +  static __thread char *buffer = NULL;
    --- End diff --
    
    reworked see last commit.


---
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.
---

[GitHub] incubator-trafodion pull request: OSIM REWORK JIRA TRAFODION-16

Posted by zellerh <gi...@git.apache.org>.
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r33946746
  
    --- Diff: core/sql/export/NAStringDef.cpp ---
    @@ -347,6 +347,143 @@ NAString::resize(size_t N)
       fbstring_.resize(N, ' ');			// Shrank; truncate the string
     }
     
    +NAList<NAString> & NAString::split(char delim, NAList<NAString> & elems)
    +{
    +  int begin = 0;
    +  int end = 0;
    +  bool delim_found = false;
    +  elems.clear();
    +  end = fbstring_.find_first_of(delim, begin);
    +  while(end >= begin)
    +  {
    +     NAString word(fbstring_.data() + begin,  end - begin);
    +     elems.insert(word);
    +     begin = end + 1;
    +     end = fbstring_.find_first_of(delim, begin);
    +     delim_found = true;
    +  }
    +
    +  if(fbstring_.size() > 0)
    +  {
    +    NAString end_word(fbstring_.data()+begin, fbstring_.size()-begin);
    +    elems.insert(end_word);
    +  }
    +  
    +  return elems;
    +}
    +
    +Int32 NAString::readFile(ifstream& in) // Read to EOF or null character.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readLine(ifstream& in)   // Read to EOF or newline.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!='\n' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readToDelim(ifstream& in, char delim) // Read to EOF or delimitor.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=delim && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +//This static function calculates and allocates buffer for the printf-like formatted string,
    +//and the formatted string is copied to buffer.
    +char* NAString::buildBuffer(const char* formatTemplate, va_list args)
    +{
    +  // calculate needed bytes to allocate memory from system heap.
    +  int bufferSize = 20049;
    +  int msgSize = 0;
    +  //buffer is managed by this static function
    +  static __thread char *buffer = NULL;
    --- End diff --
    
    Should use the THREAD_P macro defined in Platform.h here instead of __thread.


---
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.
---