[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread sandhyasun
Github user sandhyasun commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102879034
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5485,9 +5485,13 @@ NABoolean createNAFileSets(TrafDesc * table_desc 
  /*IN*/,
 
Lng32 postCreateNATableWarnings = 
CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
 
+
if(postCreateNATableWarnings != preCreateNATableWarnings)
  tableConstructionHadWarnings_=TRUE;
-   const char *lobHdfsServer = 
CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+   char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+   memset(lobHdfsServer,0,256);
+   strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER), 
sizeof(lobHdfsServer));
--- End diff --

OK will add a null terminator or do a strncpy for 255 since we re allready 
memsetting the array. The length is supposed to be 255 max. We do want to limit 
it and not allow the CQD setting to be something aritrarily large. If it is we 
will get a hdfs connection error so it's ok. We do need better error reporting 
though. WIll address that separately. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread sandhyasun
Github user sandhyasun commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102879048
  
--- Diff: core/sql/sqlcomp/CmpSeabaseDDLtable.cpp ---
@@ -4275,7 +4275,10 @@ short CmpSeabaseDDL::dropSeabaseTable2(
   short *lobNumList = new (STMTHEAP) short[numCols];
   short *lobTypList = new (STMTHEAP) short[numCols];
   char  **lobLocList = new (STMTHEAP) char*[numCols];
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  
strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER),sizeof(lobHdfsServer));
--- End diff --

Will do. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #976: TRAFODION-2492 Support for native hiv...

2017-02-23 Thread zellerh
Github user zellerh commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/976#discussion_r102861976
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5008,541 +5009,546 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
  }
 
if (table_desc->tableDesc()->isInMemoryObject())
-   {
- setInMemoryObjectDefn( TRUE );
-   }
+ {
+   setInMemoryObjectDefn( TRUE );
+ }
 
if (table_desc->tableDesc()->isDroppable())
-   {
- setDroppableTable( TRUE );
-   }
+ {
+   setDroppableTable( TRUE );
+ }
 
if (corrName.isExternal())
-   {
- setIsExternalTable(TRUE);
-   }
+ {
+   setIsExternalTable(TRUE);
+ }
 
if (qualifiedName_.getQualifiedNameObj().isHistograms() || 
qualifiedName_.getQualifiedNameObj().isHistogramIntervals())
-   {
- setIsHistogramTable(TRUE);
-   }
+ {
+   setIsHistogramTable(TRUE);
+ }
  
-  insertMode_ = table_desc->tableDesc()->insertMode();
+   insertMode_ = table_desc->tableDesc()->insertMode();
 
-  setRecordLength(table_desc->tableDesc()->record_length);
-  //
-  // Add timestamp information.
-  //
-  createTime_ = table_desc->tableDesc()->createTime;
-  redefTime_  = table_desc->tableDesc()->redefTime;
-  cacheTime_  = table_desc->tableDesc()->cacheTime;
+   setRecordLength(table_desc->tableDesc()->record_length);
+   //
+   // Add timestamp information.
+   //
+   createTime_ = table_desc->tableDesc()->createTime;
+   redefTime_  = table_desc->tableDesc()->redefTime;
+   cacheTime_  = table_desc->tableDesc()->cacheTime;
 
-  catalogUID_ = table_desc->tableDesc()->catUID;
-  schemaUID_ = table_desc->tableDesc()->schemaUID;
-  objectUID_ = table_desc->tableDesc()->objectUID;
+   catalogUID_ = table_desc->tableDesc()->catUID;
+   schemaUID_ = table_desc->tableDesc()->schemaUID;
+   objectUID_ = table_desc->tableDesc()->objectUID;
 
-  // Set the objectUID_ for hbase Cell and Row tables, if the table has
-  // been defined in Trafodion use this value, otherwise, set to 0
-  if (isHbaseCell_ || isHbaseRow_)
-{
-  if ( !fetchObjectUIDForNativeTable(corrName) )
-return;
+   // Set the objectUID_ for hbase Cell and Row tables, if the table has
+   // been defined in Trafodion use this value, otherwise, set to 0
+   if (isHbaseCell_ || isHbaseRow_)
+ {
+   if ( !fetchObjectUIDForNativeTable(corrName) )
+ return;
 
-  if (objectUID_ > 0 )
-setHasExternalTable(TRUE);
-}
+   if (objectUID_ > 0 )
+ setHasExternalTable(TRUE);
+ }
 
-  if (table_desc->tableDesc()->owner)
-{
-  Int32 userInfo (table_desc->tableDesc()->owner);
-  owner_ = userInfo;
-}
-  if (table_desc->tableDesc()->schemaOwner)
-{
-  Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
-  schemaOwner_ = schemaUser;
-}
+   if (table_desc->tableDesc()->owner)
+ {
+   Int32 userInfo (table_desc->tableDesc()->owner);
+   owner_ = userInfo;
+ }
+   if (table_desc->tableDesc()->schemaOwner)
+ {
+   Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
+   schemaOwner_ = schemaUser;
+ }
 
-  objectType_ = table_desc->tableDesc()->objectType();
-  partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
+   objectType_ = table_desc->tableDesc()->objectType();
+   partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
 
-  // Set up privs
-  if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
-  (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
+   // Set up privs
+   if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
+   (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
  getPrivileges(table_desc->tableDesc()->priv_desc);
 
-  if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
-  (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 0)
-setIsExternalTable(TRUE);
-
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_COL_ATTRS))
-setHiveExtColAttrs(TRUE);
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_KEY_ATTRS))
-setHiveExtKeyAttrs(TRUE);
+   if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
+   (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 0)

[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread zellerh
Github user zellerh commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102860953
  
--- Diff: core/sql/sqlcomp/CmpSeabaseDDLtable.cpp ---
@@ -4275,7 +4275,10 @@ short CmpSeabaseDDL::dropSeabaseTable2(
   short *lobNumList = new (STMTHEAP) short[numCols];
   short *lobTypList = new (STMTHEAP) short[numCols];
   char  **lobLocList = new (STMTHEAP) char*[numCols];
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  
strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER),sizeof(lobHdfsServer));
--- End diff --

Just a small, optional, addition: We could also get rid of the (char *) 
lobHdfsServer cast on line 4334 below, now that lobHdfsServer is a non-const. 
Same for line 5538 in file NATable.cpp.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102857664
  
--- Diff: core/sql/sqlcomp/CmpSeabaseDDLtable.cpp ---
@@ -4275,7 +4275,10 @@ short CmpSeabaseDDL::dropSeabaseTable2(
   short *lobNumList = new (STMTHEAP) short[numCols];
   short *lobTypList = new (STMTHEAP) short[numCols];
   char  **lobLocList = new (STMTHEAP) char*[numCols];
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  
strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER),sizeof(lobHdfsServer));
--- End diff --

Same comment as above.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102857640
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5485,9 +5485,13 @@ NABoolean createNAFileSets(TrafDesc * table_desc 
  /*IN*/,
 
Lng32 postCreateNATableWarnings = 
CmpCommon::diags()->getNumber(DgSqlCode::WARNING_);
 
+
if(postCreateNATableWarnings != preCreateNATableWarnings)
  tableConstructionHadWarnings_=TRUE;
-   const char *lobHdfsServer = 
CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+   char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+   memset(lobHdfsServer,0,256);
+   strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER), 
sizeof(lobHdfsServer));
--- End diff --

If strlen(CmpCommon::getDefaultString(LOB_HDFS_SERVER)) is greater than or 
equal to sizeof(lobHdfsServer), then lobHdfsServer will not be null-terminated. 
So you might get some garbage characters on the end.

Consider nulling out the last byte. (You might want to make your buffer 
256+1 bytes if the maximum length supported is 256.)

If strlen(CmpCommon::getDefaultString(LOB_HDFS_SERVER)) is greater than 256 
bytes, this code will truncate it. Is that OK?

If not, consider using a dynamically sized array instead.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #976: TRAFODION-2492 Support for native hiv...

2017-02-23 Thread anoopsharma00
Github user anoopsharma00 commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/976#discussion_r102809220
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5008,541 +5009,546 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
  }
 
if (table_desc->tableDesc()->isInMemoryObject())
-   {
- setInMemoryObjectDefn( TRUE );
-   }
+ {
+   setInMemoryObjectDefn( TRUE );
+ }
 
if (table_desc->tableDesc()->isDroppable())
-   {
- setDroppableTable( TRUE );
-   }
+ {
+   setDroppableTable( TRUE );
+ }
 
if (corrName.isExternal())
-   {
- setIsExternalTable(TRUE);
-   }
+ {
+   setIsExternalTable(TRUE);
+ }
 
if (qualifiedName_.getQualifiedNameObj().isHistograms() || 
qualifiedName_.getQualifiedNameObj().isHistogramIntervals())
-   {
- setIsHistogramTable(TRUE);
-   }
+ {
+   setIsHistogramTable(TRUE);
+ }
  
-  insertMode_ = table_desc->tableDesc()->insertMode();
+   insertMode_ = table_desc->tableDesc()->insertMode();
 
-  setRecordLength(table_desc->tableDesc()->record_length);
-  //
-  // Add timestamp information.
-  //
-  createTime_ = table_desc->tableDesc()->createTime;
-  redefTime_  = table_desc->tableDesc()->redefTime;
-  cacheTime_  = table_desc->tableDesc()->cacheTime;
+   setRecordLength(table_desc->tableDesc()->record_length);
+   //
+   // Add timestamp information.
+   //
+   createTime_ = table_desc->tableDesc()->createTime;
+   redefTime_  = table_desc->tableDesc()->redefTime;
+   cacheTime_  = table_desc->tableDesc()->cacheTime;
 
-  catalogUID_ = table_desc->tableDesc()->catUID;
-  schemaUID_ = table_desc->tableDesc()->schemaUID;
-  objectUID_ = table_desc->tableDesc()->objectUID;
+   catalogUID_ = table_desc->tableDesc()->catUID;
+   schemaUID_ = table_desc->tableDesc()->schemaUID;
+   objectUID_ = table_desc->tableDesc()->objectUID;
 
-  // Set the objectUID_ for hbase Cell and Row tables, if the table has
-  // been defined in Trafodion use this value, otherwise, set to 0
-  if (isHbaseCell_ || isHbaseRow_)
-{
-  if ( !fetchObjectUIDForNativeTable(corrName) )
-return;
+   // Set the objectUID_ for hbase Cell and Row tables, if the table has
+   // been defined in Trafodion use this value, otherwise, set to 0
+   if (isHbaseCell_ || isHbaseRow_)
+ {
+   if ( !fetchObjectUIDForNativeTable(corrName) )
+ return;
 
-  if (objectUID_ > 0 )
-setHasExternalTable(TRUE);
-}
+   if (objectUID_ > 0 )
+ setHasExternalTable(TRUE);
+ }
 
-  if (table_desc->tableDesc()->owner)
-{
-  Int32 userInfo (table_desc->tableDesc()->owner);
-  owner_ = userInfo;
-}
-  if (table_desc->tableDesc()->schemaOwner)
-{
-  Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
-  schemaOwner_ = schemaUser;
-}
+   if (table_desc->tableDesc()->owner)
+ {
+   Int32 userInfo (table_desc->tableDesc()->owner);
+   owner_ = userInfo;
+ }
+   if (table_desc->tableDesc()->schemaOwner)
+ {
+   Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
+   schemaOwner_ = schemaUser;
+ }
 
-  objectType_ = table_desc->tableDesc()->objectType();
-  partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
+   objectType_ = table_desc->tableDesc()->objectType();
+   partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
 
-  // Set up privs
-  if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
-  (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
+   // Set up privs
+   if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
+   (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
  getPrivileges(table_desc->tableDesc()->priv_desc);
 
-  if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
-  (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 0)
-setIsExternalTable(TRUE);
-
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_COL_ATTRS))
-setHiveExtColAttrs(TRUE);
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_KEY_ATTRS))
-setHiveExtKeyAttrs(TRUE);
+   if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
+   (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 

[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread sandhyasun
Github user sandhyasun commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102805003
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5481,7 +5481,9 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
 
   if(postCreateNATableWarnings != preCreateNATableWarnings)
  tableConstructionHadWarnings_=TRUE;
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER), 
strlen(CmpCommon::getDefaultString(LOB_HDFS_SERVER)));
--- End diff --

Yes the length param , I will change to 256.  That shoudl be sufficient 
wouldn't it. It would copy the strlen of CmpCommon::getDeafulatString(...) 
length upto a max of 256.  To answer Suresh,The corruption is caused not by 
passing in, the  lobHdfsServer.  But to be safe, I will do a strcpy into a hap 
allocated string within the CLI function of the passed in param. The corruption 
was  caused by the code a few lines below : 
ComString newSchName = "\"";
  newSchName += catalogNamePart;
  newSchName.append("\".\"");
  newSchName.append(schemaNamePart);
  newSchName += "\"";
  NABoolean lobTrace = FALSE;
The ComString's small_  data member overwrote what loHdfsServer was 
pointing to. So what got passed into the LOB ddl function instead of "default"  
was "TRAFODION.SEABASE"! . But I can make the cli call opy over the passed in 
param right away.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread sureshsubbiah
Github user sureshsubbiah commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102784331
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5481,7 +5481,9 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
 
   if(postCreateNATableWarnings != preCreateNATableWarnings)
  tableConstructionHadWarnings_=TRUE;
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER), 
strlen(CmpCommon::getDefaultString(LOB_HDFS_SERVER)));
--- End diff --

The comment in the next file tells us that there is expectation the max 
valid string length will be 255 bytes for this attribute. However with user 
error there could be a longer invalid string. Maybe some error handling code 
that checks if the specifies string is less that 255 bytes will address the 
concern above.

I do have another question.
We are passing a pointer to a local variable (lobHdfsSever) to the CLI call 
SQL_EXEC_LobddlInterface(). Is there a guarantee that this call will NOT save 
the pointer somewhere that could cause the pointer to be accessed after the 
call has returned. I suppose I am not clear on changing the storage of this 
actual data from system heap used by NAString (old code) to stack used by newly 
created char array will avoid the corruption problem. I am often confused by 
such question, so consider this a question, rather than a issue to be resolved.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #976: TRAFODION-2492 Support for native hiv...

2017-02-23 Thread zellerh
Github user zellerh commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/976#discussion_r102769335
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5008,541 +5009,546 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
  }
 
if (table_desc->tableDesc()->isInMemoryObject())
-   {
- setInMemoryObjectDefn( TRUE );
-   }
+ {
+   setInMemoryObjectDefn( TRUE );
+ }
 
if (table_desc->tableDesc()->isDroppable())
-   {
- setDroppableTable( TRUE );
-   }
+ {
+   setDroppableTable( TRUE );
+ }
 
if (corrName.isExternal())
-   {
- setIsExternalTable(TRUE);
-   }
+ {
+   setIsExternalTable(TRUE);
+ }
 
if (qualifiedName_.getQualifiedNameObj().isHistograms() || 
qualifiedName_.getQualifiedNameObj().isHistogramIntervals())
-   {
- setIsHistogramTable(TRUE);
-   }
+ {
+   setIsHistogramTable(TRUE);
+ }
  
-  insertMode_ = table_desc->tableDesc()->insertMode();
+   insertMode_ = table_desc->tableDesc()->insertMode();
 
-  setRecordLength(table_desc->tableDesc()->record_length);
-  //
-  // Add timestamp information.
-  //
-  createTime_ = table_desc->tableDesc()->createTime;
-  redefTime_  = table_desc->tableDesc()->redefTime;
-  cacheTime_  = table_desc->tableDesc()->cacheTime;
+   setRecordLength(table_desc->tableDesc()->record_length);
+   //
+   // Add timestamp information.
+   //
+   createTime_ = table_desc->tableDesc()->createTime;
+   redefTime_  = table_desc->tableDesc()->redefTime;
+   cacheTime_  = table_desc->tableDesc()->cacheTime;
 
-  catalogUID_ = table_desc->tableDesc()->catUID;
-  schemaUID_ = table_desc->tableDesc()->schemaUID;
-  objectUID_ = table_desc->tableDesc()->objectUID;
+   catalogUID_ = table_desc->tableDesc()->catUID;
+   schemaUID_ = table_desc->tableDesc()->schemaUID;
+   objectUID_ = table_desc->tableDesc()->objectUID;
 
-  // Set the objectUID_ for hbase Cell and Row tables, if the table has
-  // been defined in Trafodion use this value, otherwise, set to 0
-  if (isHbaseCell_ || isHbaseRow_)
-{
-  if ( !fetchObjectUIDForNativeTable(corrName) )
-return;
+   // Set the objectUID_ for hbase Cell and Row tables, if the table has
+   // been defined in Trafodion use this value, otherwise, set to 0
+   if (isHbaseCell_ || isHbaseRow_)
+ {
+   if ( !fetchObjectUIDForNativeTable(corrName) )
+ return;
 
-  if (objectUID_ > 0 )
-setHasExternalTable(TRUE);
-}
+   if (objectUID_ > 0 )
+ setHasExternalTable(TRUE);
+ }
 
-  if (table_desc->tableDesc()->owner)
-{
-  Int32 userInfo (table_desc->tableDesc()->owner);
-  owner_ = userInfo;
-}
-  if (table_desc->tableDesc()->schemaOwner)
-{
-  Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
-  schemaOwner_ = schemaUser;
-}
+   if (table_desc->tableDesc()->owner)
+ {
+   Int32 userInfo (table_desc->tableDesc()->owner);
+   owner_ = userInfo;
+ }
+   if (table_desc->tableDesc()->schemaOwner)
+ {
+   Int32 schemaUser(table_desc->tableDesc()->schemaOwner);
+   schemaOwner_ = schemaUser;
+ }
 
-  objectType_ = table_desc->tableDesc()->objectType();
-  partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
+   objectType_ = table_desc->tableDesc()->objectType();
+   partitioningScheme_ = table_desc->tableDesc()->partitioningScheme();
 
-  // Set up privs
-  if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
-  (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
+   // Set up privs
+   if ((corrName.getSpecialType() == ExtendedQualName::SG_TABLE) ||
+   (!(corrName.isSeabaseMD() || corrName.isSpecialTable(
  getPrivileges(table_desc->tableDesc()->priv_desc);
 
-  if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
-  (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 0)
-setIsExternalTable(TRUE);
-
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_COL_ATTRS))
-setHiveExtColAttrs(TRUE);
-  if (CmpSeabaseDDL::isMDflagsSet
-  (table_desc->tableDesc()->tablesFlags, MD_TABLES_HIVE_EXT_KEY_ATTRS))
-setHiveExtKeyAttrs(TRUE);
+   if ((table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HIVE) != 0 ||
+   (table_desc->tableDesc()->objectFlags & 
SEABASE_OBJECT_IS_EXTERNAL_HBASE) != 0)

[GitHub] incubator-trafodion pull request #976: TRAFODION-2492 Support for native hiv...

2017-02-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #977: Fix for a potential stack memory corr...

2017-02-23 Thread zellerh
Github user zellerh commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/977#discussion_r102766436
  
--- Diff: core/sql/optimizer/NATable.cpp ---
@@ -5481,7 +5481,9 @@ NABoolean createNAFileSets(TrafDesc * table_desc  
 /*IN*/,
 
   if(postCreateNATableWarnings != preCreateNATableWarnings)
  tableConstructionHadWarnings_=TRUE;
-  const char *lobHdfsServer = CmpCommon::getDefaultString(LOB_HDFS_SERVER);
+  char  lobHdfsServer[256] ; // max length determined by 
dfs.namenode.fs-limits.max-component-length(255)
+  memset(lobHdfsServer,0,256);
+  strncpy(lobHdfsServer,CmpCommon::getDefaultString(LOB_HDFS_SERVER), 
strlen(CmpCommon::getDefaultString(LOB_HDFS_SERVER)));
--- End diff --

Doesn't that make the problem worse? If the string is larger than 256 
bytes, it will overrun the lobHdfsServer buffer? Should the length passed in be 
MINOF(strlen(...), 256)?

Also, I use sizeof(lobHdfsServer) instead of 256 in these cases, but others 
have disagreed with me on that.

Also, shouldn't there be a global constant for the max. length of a server?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #975: TRAFODION-2441 user has only select p...

2017-02-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #974: [TRAFODION-2481] Improve ambari secti...

2017-02-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #970: [TRAFODION-2489] [TRAFODION-2490] fix...

2017-02-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #973: [TRAFODION-2482] documentation for py...

2017-02-23 Thread mkby
Github user mkby commented on a diff in the pull request:

https://github.com/apache/incubator-trafodion/pull/973#discussion_r102673703
  
--- Diff: docs/provisioning_guide/src/asciidoc/_chapters/quickstart.adoc ---
@@ -48,60 +48,55 @@ NOTE: You can download and install the {project-name} 
Clients once you've instal
 
 *Example*
 
+Download the Trafodion Installer and Server binaries:
 ```
 $ mkdir $HOME/trafodion-download
 $ cd $HOME/trafodion-download
 $ # Download the Trafodion Installer binaries
-$ wget 
http://apache.cs.utah.edu/incubator/trafodion/trafodion-1.3.0.incubating/apache-trafodion-installer-1.3.0-incubating-bin.tar.gz
+$ wget 
http://apache.cs.utah.edu/incubator/trafodion/trafodion-2.1.0.incubating/apache-trafodion-pyinstaller-2.1.0-incubating.tar.gz
 Resolving http://apache.cs.utah.edu... 192.168.1.56
 Connecting to http://apache.cs.utah.edu|192.168.1.56|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 68813 (67K) [application/x-gzip]
-Saving to: "apache-trafodion-installer-1.3.0-incubating-bin.tar.gz"
+Saving to: "apache-trafodion-pyinstaller-2.1.0-incubating.tar.gz"
 
 
100%[=>]
 68,813   124K/s   in 0.5s
 
-2016-02-14 04:19:42 (124 KB/s) - 
"apache-trafodion-installer-1.3.0-incubating-bin.tar.gz" saved [68813/68813]
-```
+2016-02-14 04:19:42 (124 KB/s) - 
"apache-trafodion-pyinstaller-2.1.0-incubating.tar.gz" saved [68813/68813]
 
-<<<
-```
-$ # Download the Trafodion Server binaries
-$ wget 
http://apache.cs.utah.edu/incubator/trafodion/trafodion-1.3.0.incubating/apache-trafodion-1.3.0-incubating-bin.tar.gz
+$ wget 
http://apache.cs.utah.edu/incubator/trafodion/trafodion-2.1.0.incubating/apache-trafodion_server-2.1.0-RH-x86_64-incubating.tar.gz
 Resolving http://apache.cs.utah.edu... 192.168.1.56
 Connecting to http://apache.cs.utah.edu|192.168.1.56|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 214508243 (205M) [application/x-gzip]
-Saving to: "apache-trafodion-1.3.0-incubating-bin.tar.gz"
+Saving to: "apache-trafodion_server-2.1.0-RH-x86_64-incubating.tar.gz"
 
--- End diff --

This is the package name after `make package` on my system, is there 
anything wrong with my environment?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafodion pull request #978: [TRAFODION-2496] pyinstaller - better...

2017-02-23 Thread mkby
GitHub user mkby opened a pull request:

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

[TRAFODION-2496] pyinstaller - better handle constants

Put constants together into a new constants.py file. It will be easy to 
modify them to fit new Hadoop environment.

along with some minor fixes:
1. kill krb5service and delete status file in uninstall script
2. fix hbase_lib_path issue while install trafodion on apache hadoop
3. typo in db_config_default

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

$ git pull https://github.com/mkby/incubator-trafodion r21-2496

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

https://github.com/apache/incubator-trafodion/pull/978.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 #978


commit dc58c85d3b0c7364461129ac7973c5f97b6576a8
Author: Eason 
Date:   2017-02-23T08:04:48Z

[TRAFODION-2496] pyinstaller - better handle constants




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---