nonstop-qfchen commented on a change in pull request #1821: [TRAFODION-3291] 
Fix core when multi-column stats are done on lots of columns
URL: https://github.com/apache/trafodion/pull/1821#discussion_r271853717
 
 

 ##########
 File path: core/sql/ustat/hs_globals.cpp
 ##########
 @@ -994,7 +994,8 @@ void HSGlobalsClass::formGroupSets()
       {
          if (LM->LogNeeded())
          {
-            sprintf(LM->msg, "\tMC: GROUP (%s) has state DONT_TRY, is 
skipped", mgroup_set->colNames->data());
+            sprintf(LM->msg, "\tMC: GROUP (%s) has state DONT_TRY, is 
skipped", 
+              LM->truncate(mgroup_set->colNames->data(),sizeof(LM->msg-200)));
 
 Review comment:
   I wonder if there is a slightly better way to do this so that the total msg 
length is exactly 2000. 
   
   One way to do so would be to compute the the skeleton string length L (such 
as strlen("\MC: GROUP () has state DONT_TRY, is skipped"), and then set the 
truncation length to 2000 - L. 
   
   When L is available, we can supply it to sprint() as follows. See 
https://stackoverflow.com/questions/2239519/is-there-a-way-to-specify-how-many-characters-of-a-string-to-print-out-using-pri.
   
   printf ("Here are the first %d chars: %.*s\n", L, L, "A string that is more 
than 8 chars");

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to