Failure to detect error in allocating transcation_prealloc_size

Bug #377826 reported by Lee Bieber
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
High
fmpwizard

Bug Description

Two problems with the variables-big.test in the big test suite.

1. Error is not detected when running the command:

set session transaction_prealloc_size=1024*1024*1024*5;

2. Incorrect error message is being produced when running the command:

set session transaction_prealloc_size=1024*1024*1024*4; The error message says:

Error 1292 Truncated incorrect transaction_prealloc_size value: '0'

and it should say:

Error 1292 Truncated incorrect transaction_prealloc_size value: '4294967296'

The big test suite is being run from on Hudson on drizzle-os (OpenSolaris x86) machine, see http://gorf.tangent.org/hudson/job/drizzle-drizzle-os-test-big/

% diff suite/big/r/variables-big.re*
15c15
< Error 1292 Truncated incorrect transaction_prealloc_size value: '0'
---
> Warning 1292 Truncated incorrect transaction_prealloc_size value: '4294967296'
19a20,21
> Warnings:
> Warning 1292 Truncated incorrect transaction_prealloc_size value: '5368709120'

Related branches

Changed in drizzle:
assignee: nobody → Stewart Smith (stewart-flamingspork)
importance: Undecided → High
milestone: none → aloha
status: New → Confirmed
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

Bug when reported in MySQL http://lists.mysql.com/commits/24309. Looks like we have this fix in our source base

Revision history for this message
Stewart Smith (stewart) wrote :

probably a % in format somewhere.

or another lovely artifact of the horrible variable system....

Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

Test case has been commented out for now in variables-big test, please make sure this is uncommented after the bug is fixed

Changed in drizzle:
milestone: aloha → bell
Revision history for this message
Joe Daly (skinny.moey) wrote :

this looks to be happening in set_var.cc in the cast to (uint32_t) for values greater then 4294967295 in the test case. The result of this cast is then passed through to throw_bounds_warning() and fails with a value of 0 for setting a transaction_prealloc_size to 4294967296. Other larger values dont throw warnings although their values are bogus from the cast they are still within range.

static bool get_unsigned32(Session *, set_var *var)
{
  if (var->value->unsigned_flag)
    var->save_result.uint32_t_value= (uint32_t) var->value->val_int();
  else
  {
    int64_t v= var->value->val_int();
    var->save_result.uint32_t_value= (uint32_t) ((v < 0) ? 0 : v); <----- possibly bad cast
  }
  return 0;
}

Revision history for this message
Jay Pipes (jaypipes) wrote :

Seems like a pretty straightforward fix:

Either change the transaction_prealloc_size to a uint64_t or fix the throw_bounds_warning() function to not truncate/change the actual value returned by val_int() (which is of type int64_t...

Joe, care to give it a try?

-jay

Revision history for this message
fmpwizard (diego-fmpwizard) wrote : Re: [Bug 377826] Re: Failure to detect error in allocating transcation_prealloc_size

Sure, I'll give it a try!

Thanks

   -Diego

On Wed, Aug 26, 2009 at 12:56 PM, Jay Pipes<email address hidden> wrote:
> Seems like a pretty straightforward fix:
>
> Either change the transaction_prealloc_size to a uint64_t or fix the
> throw_bounds_warning() function to not truncate/change the actual value
> returned by val_int() (which is of type int64_t...
>
> Joe, care to give it a try?
>
> -jay
>
> --
> Failure to detect error in allocating transcation_prealloc_size
> https://bugs.launchpad.net/bugs/377826
> You received this bug notification because you are a member of Drizzle-
> developers, which is subscribed to Drizzle.
>
> Status in A Lightweight SQL Database for Cloud and Web: Confirmed
>
> Bug description:
> Two problems with the variables-big.test in the big test suite.
>
> 1. Error is not detected when running the command:
>
> set session transaction_prealloc_size=1024*1024*1024*5;
>
> 2. Incorrect error message is being produced when running the command:
>
> set session transaction_prealloc_size=1024*1024*1024*4; The error message says:
>
> Error   1292    Truncated incorrect transaction_prealloc_size value: '0'
>
> and it should say:
>
> Error   1292    Truncated incorrect transaction_prealloc_size value: '4294967296'
>
> The big test suite is being run from on Hudson on drizzle-os (OpenSolaris x86) machine, see http://gorf.tangent.org/hudson/job/drizzle-drizzle-os-test-big/
>
> % diff suite/big/r/variables-big.re*
> 15c15
> < Error 1292    Truncated incorrect transaction_prealloc_size value: '0'
> ---
>> Warning       1292    Truncated incorrect transaction_prealloc_size value: '4294967296'
> 19a20,21
>> Warnings:
>> Warning       1292    Truncated incorrect transaction_prealloc_size value: '5368709120'
>

--
Diego Medina
Web Developer
http://www.fmpwizard.com

Revision history for this message
fmpwizard (diego-fmpwizard) wrote :

Will be pushing the fix soon

Changed in drizzle:
assignee: Stewart Smith (stewart-flamingspork) → fmpwizard (diego-fmpwizard)
Changed in drizzle:
status: Confirmed → In Progress
Changed in drizzle:
status: In Progress → Fix Committed
Revision history for this message
Monty Taylor (mordred) wrote :

Migrating trans_prealloc_size to uint64_t causes an incredible slowdown on solaris sparc... so I made it back into a uint32_t and then added a bounds check in get_unsigned32.

Changed in drizzle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.