[GitHub] trafodion pull request #1448: TRAFODION-2962 : Enable LDAP authentication fl...

2018-02-15 Thread venkat1m
GitHub user venkat1m opened a pull request:

https://github.com/apache/trafodion/pull/1448

TRAFODION-2962 : Enable LDAP authentication flag at install time

Fix the code that sets the TRAF_AUTHENTICATION flag to YES if LDAP is 
enabled.

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

$ git pull https://github.com/venkat1m/trafodion TRAFODION-2962

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

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


commit a369f0c82299ff9feb59be59367c2da986d861bb
Author: venkat1m 
Date:   2018-02-16T02:35:33Z

Enable LDAP authentication flag at install time




---


[GitHub] trafodion pull request #1447: [TRAFODION-2727] Memory leak in the compiler p...

2018-02-15 Thread selvaganesang
GitHub user selvaganesang opened a pull request:

https://github.com/apache/trafodion/pull/1447

[TRAFODION-2727] Memory leak in the compiler part of the code in Traf…

…odion

It was found that CmpMessageReplyCode was not getting deleted at all times.
But, the handling of CmpMessageDescribe messages in the compiler code has 
some
mysterious issue that corrupts the memory causing unpredictable behavior 
when
CmpMessageReplyCode is deleted.  To circumvent this problem, the 
CmpStatement heap
is used for embedded compiler to allocate CmpMessageReplyCode and the 
Context heap
is used in case of standalone compiler. The handling of CmpMessageDescribe 
will
continue to leak memory in standalone compiler.

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

$ git pull https://github.com/selvaganesang/trafodion trafodion-2727

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

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


commit 52703c64dbca6af7f7ad17d7e0efe15d7f6afd0c
Author: selvaganesang 
Date:   2018-02-16T02:03:46Z

[TRAFODION-2727] Memory leak in the compiler part of the code in Trafodion

It was found that CmpMessageReplyCode was not getting deleted at all times.
But, the handling of CmpMessageDescribe messages in the compiler code has 
some
mysterious issue that corrupts the memory causing unpredictable behavior 
when
CmpMessageReplyCode is deleted.  To circumvent this problem, the 
CmpStatement heap
is used for embedded compiler to allocate CmpMessageReplyCode and the 
Context heap
is used in case of standalone compiler. The handling of CmpMessageDescribe 
will
continue to leak memory in standalone compiler.




---


[GitHub] trafodion pull request #1444: [TRAFODION-2157] add MySQL function unix_times...

2018-02-15 Thread traflm
Github user traflm commented on a diff in the pull request:

https://github.com/apache/trafodion/pull/1444#discussion_r168649121
  
--- Diff: core/sql/exp/exp_function.cpp ---
@@ -2501,6 +2518,100 @@ ex_expr::exp_return_type 
ExFunctionReverseStr::eval(char *op_data[],
   return ex_expr::EXPR_OK;
 };
 
+ex_expr::exp_return_type ex_function_sleep::eval(char *op_data[],
+  CollHeap* heap,
+  ComDiagsArea** diagsArea)
+{
+   Int32 sec = 0;
+  switch (getOperand(1)->getDatatype())
+  {
+case REC_BIN8_SIGNED:
+  sec = *(Int8 *)op_data[1] ;
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+case REC_BIN16_SIGNED:
+  sec = *(short *)op_data[1] ; 
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+case REC_BIN32_SIGNED:
+  *(Lng32 *)sec = labs(*(Lng32 *)op_data[1]);
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+ 
+case REC_BIN64_SIGNED:
+  sec = *(Int64 *)op_data[1];
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+default:
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+  return ex_expr::EXPR_ERROR;
+  break;
+  }
+  //get the seconds to sleep
+  return ex_expr::EXPR_OK;
+}
+
+ex_expr::exp_return_type ex_function_unixtime::eval(char *op_data[],
+  CollHeap* heap,
+  ComDiagsArea** diagsArea)
+{
+  char *opData = op_data[1];
+  //if there is input value
+  if(opData[0] != 0 &&  getNumOperands() == 2)
+  {
+struct tm* ptr;
+char* r = strptime(opData, "%Y-%m-%d %H:%M:%S", ptr);
+if( r == NULL)
--- End diff --

Thanks Dave, you are correct. We want to be very strict here. I will add 
this checking.


---


[GitHub] trafodion pull request #1427: TRAFODION-2940 In HA env, one node lose networ...

2018-02-15 Thread svarnau
Github user svarnau commented on a diff in the pull request:

https://github.com/apache/trafodion/pull/1427#discussion_r168625988
  
--- Diff: dcs/bin/scripts/dcsunbind.sh ---
@@ -51,6 +51,31 @@ function check_node {
 done
 }
 
+function check_self_node {
+for myinterface in `/sbin/ip link show|cut -d: -f1- | cut -c1- | awk 
-F': ' '/^[0-9]+:.*/ {print $2;}'`; do
+ip_output=$(/sbin/ip addr show $myinterface | cut -d: -f1- | cut 
-c1-)
+
+myifport=`echo "$ip_output" | grep -w $gv_float_external_ip`
+status=$?
+if [ $status -eq 0 ]; then
+tempinterface=`echo $gv_float_interface:$gv_port`
+# check if another interface is bound to this virtual ip 
address
+echo "$myifport" | grep "$tempinterface"  > /dev/null
+if [ $? -eq 0 ]; then
+unbindip=`echo "$myifport" | awk '{print $2}'`
+unbindlb=`echo "$myifport"|awk '{print $NF}'`
+echo "Virtual ip $gv_float_external_ip is in use on node 
$HOSTNAME bound to interface $myinterface($unbindlb) - unbinding..."
+sudo /sbin/ip addr del $unbindip dev $myinterface
+status=$?
--- End diff --

It seems unnecessary to duplicate entire function just to change whether 
commands run locally or remotely. That can be done with a variable, so that we 
don't have two copies of this code to maintain.


---


[GitHub] trafodion pull request #1444: [TRAFODION-2157] add MySQL function unix_times...

2018-02-15 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:

https://github.com/apache/trafodion/pull/1444#discussion_r168606746
  
--- Diff: core/sql/exp/exp_function.cpp ---
@@ -2501,6 +2518,100 @@ ex_expr::exp_return_type 
ExFunctionReverseStr::eval(char *op_data[],
   return ex_expr::EXPR_OK;
 };
 
+ex_expr::exp_return_type ex_function_sleep::eval(char *op_data[],
+  CollHeap* heap,
+  ComDiagsArea** diagsArea)
+{
+   Int32 sec = 0;
+  switch (getOperand(1)->getDatatype())
+  {
+case REC_BIN8_SIGNED:
+  sec = *(Int8 *)op_data[1] ;
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+case REC_BIN16_SIGNED:
+  sec = *(short *)op_data[1] ; 
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+case REC_BIN32_SIGNED:
+  *(Lng32 *)sec = labs(*(Lng32 *)op_data[1]);
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+ 
+case REC_BIN64_SIGNED:
+  sec = *(Int64 *)op_data[1];
+  if(sec < 0 )
+  {
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+return ex_expr::EXPR_ERROR;
+  }
+  sleep(sec);
+  *(Int64 *)op_data[0] = 1;
+  break;
+  
+default:
+ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+*(*diagsArea) << DgString0("SLEEP");
+  return ex_expr::EXPR_ERROR;
+  break;
+  }
+  //get the seconds to sleep
+  return ex_expr::EXPR_OK;
+}
+
+ex_expr::exp_return_type ex_function_unixtime::eval(char *op_data[],
+  CollHeap* heap,
+  ComDiagsArea** diagsArea)
+{
+  char *opData = op_data[1];
+  //if there is input value
+  if(opData[0] != 0 &&  getNumOperands() == 2)
+  {
+struct tm* ptr;
+char* r = strptime(opData, "%Y-%m-%d %H:%M:%S", ptr);
+if( r == NULL)
--- End diff --

Should we also test for *r pointing to a null character? See the man page 
for strptime. If there is garbage data after the seconds field, r will point to 
the first byte of the garbage. I'm guessing we want to raise an error in that 
case.  Consider a test of the form "if ((r == NULL) || (*r != '\0'))" 


---


[GitHub] trafodion pull request #1446: [TRAFODION-2840] Update expected results for t...

2018-02-15 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

https://github.com/apache/trafodion/pull/1446

[TRAFODION-2840] Update expected results for test hive/TEST018

A side effect of https://github.com/apache/trafodion/pull/1414 is that 
[first n] + ORDER BY queries are now considered non-cacheable. (Queries with 
[first n] but without ORDER BY have always been non-cacheable.) This caused a 
failure in hive/TEST018, as a query that was formerly cacheable is now not.

This change updates the expected results for hive/TEST018.

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

$ git pull https://github.com/DaveBirdsall/trafodion hiveTest018

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

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


commit e13919aa7360e2ddd9c630f77c49ea1f13ca465e
Author: Dave Birdsall 
Date:   2018-02-15T20:00:46Z

[TRAFODION-2840] Update expected results for test hive/TEST018




---


[GitHub] trafodion pull request #1445: [TRAFODION-2959] Change download URLs for old ...

2018-02-15 Thread svarnau
GitHub user svarnau opened a pull request:

https://github.com/apache/trafodion/pull/1445

[TRAFODION-2959] Change download URLs for old releases

Old releases need to be from archives site.

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

$ git pull https://github.com/svarnau/trafodion j2959

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

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


commit 59e2c8e457f14b6721a4582a629c82aa277f6d87
Author: Steve Varnau 
Date:   2018-02-15T20:00:28Z

[TRAFODION-2959] Change download URLs for old releases

Old releases need to be from archives site.




---


[GitHub] trafodion pull request #1443: [TRAFODION-2645] Fixes to MDAM costing code fo...

2018-02-15 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/trafodion/pull/1443


---