|
Sybase WTF
Last post 11-20-2008 10:58 PM by Weng. 20 replies.
-
11-12-2008 9:54 PM
|
|
-
danixdefcon5


- Joined on 01-09-2007
- Mexico City, DF, Mexico
- Posts 608
|
So, this morning one of the production DB's went down. The DBA's didn't tell us what happened, but it was down until sometime around lunch time. About 2 hours after everything had been restored to normal, I got a call from my boss, telling me that my app had barfed for unknown reasons. After checking out the appserver logs, I found this: </p><p>com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '1568316946041014268' to a NUMERIC field . </p><p> Shit. No way that field could get so high, it was around 1984 last time I checked. This was on an insert, and the overflowed field came from a related table. So I trace that value back to the source, and I find this "value" on the identity PK: 50000000000000000000000000000002007 Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt. I don't even know how to read the damn number (50 million yotta-somethings?) and I'm pretty sure this is the problem. Sure enough, I find that this is way over the upper limit for a signed Long (64-bit integer) so we take action. The sad thing is that Sybase likes to do this whenever it goes down, and this identity had been already limited in its jump increments. This "jump" should've been in 10,000 increments, not ... whatever that number is. What irks me is that it isn't the only issue with this DBMS. PreparedStatements sometimes fail silently without any errors, or convert numbers to 0's. Urrrgh....
|
|
-
-
morbiuswilters


- Joined on 01-15-2008
- East Coast Represent!
- Posts 4,982
|
danixdefcon5:50000000000000000000000000000002007 Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt.
Or the number of Pesos in a Dollar. Or the number of Dollars in an Amero. Oh, and this should probably be in Sidebar, not GD.
|
|
-
-
tster


- Joined on 04-11-2006
- Natick, MA
- Posts 1,765
|
morbiuswilters: danixdefcon5:50000000000000000000000000000002007 Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt.
Or the number of Pesos in a Dollar. Or the number of Dollars in an Amero. Oh, and this should probably be in Sidebar, not GD. it's obviously the number of fetish sites on the internet.
The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting... see bio for the earth shattering ending.
|
|
-
-
-
Zecc


- Joined on 06-12-2007
- Location, Location, Location
- Posts 653
|
Five-buncha-zeroes-two-thousand-and-seven.
If mixed metaphors were illegal, I'd be having an indigestion. typeof NaN == 'number'
|
|
-
-
BlueKnot


- Joined on 10-17-2007
- Posts 56
|
danixdefcon5:</p><p>com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '1568316946041014268' to a NUMERIC field . </p><p>
Shit. No way that field could get so high, it was around 1984 last time I checked.
Well, if it's been 24 years since you checked that field I'm not surprised it's higher than you thought...
- Dan
|
|
-
-
jpaull


- Joined on 08-17-2007
- Bristol, CT
- Posts 58
|
henke37:That's five septillion, two thousand and seven.
FTFY
|
|
-
-
-
-
-
danixdefcon5


- Joined on 01-09-2007
- Mexico City, DF, Mexico
- Posts 608
|
Meh:
In the version 11 release we were using, there was no way to safely reset the identity counter without rebuilding the table. AWESOME.
Guess what release we're using. You just described the DBA's "solution" to this problem. Of course, they also set the IDENTITY BURNING to some low value so it won't do these wild jumps. In theory. Meh:
I will never willingly use Sybase again.
I've been thinking that ever since I started working with this. Oh, and it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.) Meh:
The page-level locks were a nice feature as well. Great for making an
expensive server respond like a workstation. Also makes for easy
deadlocks.
The appserver's full of SQLExceptions stating deadlocks. Fortunately, most of my code uses tables that aren't shared with any other apps, and it seems my app doesn't do deadlock-prone stuff, even when used by many concurrent users.
|
|
-
-
APH


- Joined on 06-08-2007
- Posts 9
|
Waldo2k2: It could be worse...you could also be using PowerBuilder...
You know, our flagship product is written in it.... and I dread every day time I open the IDE.
|
|
-
-
Waldo2k2


- Joined on 07-09-2008
- USA
- Posts 5
|
APH:You know, our flagship product is written in it.... and I dread every day time I open the IDE. Heh, ALL of our products are written in it (well, all but one). The only thing worse than the IDE itself, is using it alongside Visual Source Safe. Makes me want to commit Hari Kari with my keyboard.
|
|
-
-
lolwtf


- Joined on 04-02-2008
- (null)
- Posts 303
|
It's OVER NINE THOUSAAAAAAND!
(null)
|
|
-
-
dhromed


- Joined on 04-13-2005
- Dutchland
- Posts 3,734
|
danixdefcon5:it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.) [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done. But supporting LIMIT would prevent lots of ID NOT IN statements. :\
— Flurp.
|
|
-
-
Pidgeot


- Joined on 09-19-2007
- Posts 72
|
jpaull:
henke37:That's fifty decillion, two thousand and seven.
FTFY
FTFY (assuming short scale, UK long scale version: fifty thousand quintillion, two thousand and seven, EU long scale version: fifty quintilliard, two thousand and seven)
|
|
-
-
lpope187


- Joined on 03-05-2006
- York, PA
- Posts 402
|
dhromed: danixdefcon5:it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.) [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done. But supporting LIMIT would prevent lots of ID NOT IN statements. :\ SQL 2005and later have ROW_NUMBER() OVER (Partition BY Field, Order By Field) and RANK() OVER (Partition BY Field, Order By Field) which can then be used in the where statement. Both are much more powerful than LIMIT.
“A system is a network of interdependent components that work together to try to accomplish the aim of the system. A system must have an aim. Without the aim, there is no system.”
W. Edward Deming
|
|
-
-
dhromed


- Joined on 04-13-2005
- Dutchland
- Posts 3,734
|
lpope187:SQL 2005 and later have ROW_NUMBER() OVER (Partition BY Field, Order By Field) and RANK() OVER (Partition BY Field, Order By Field) which can then be used in the where statement. Both are much more powerful than LIMIT. I am delighted and will invesitgate.
— Flurp.
|
|
-
-
TwelveBaud


- Joined on 06-03-2008
- UVA/Wise, Wise, VA
- Posts 258
|
Meh:Got to love IDENTITY BURNING SET FACTOR.
What's really cool about it is that is specifies the percentage of the
max ids to burn on restart. So if you have a numeric(20) and IDENTITY
BURNING SET FACTOR at its minimum (0.01 IIRC), it would add 10^16 + 1
and insert it.
From the Sybase docs: "The default value, 5000, represents .05%, or .0005 [of the available keyspace]." Meh:After the 3rd or 4th time it happened, I built a
script to automatically backup, drop, and rebuild the tables.
From the same documentation, that's the best practice.
|
|
-
-
danixdefcon5


- Joined on 01-09-2007
- Mexico City, DF, Mexico
- Posts 608
|
dhromed: danixdefcon5:it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.) [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done. But supporting LIMIT would prevent lots of ID NOT IN statements. :\
So does Sybase. Still, lack of OFFSET does require WTF-worthy stuff to emulate that feature.
|
|
-
-
Weng


- Joined on 03-15-2008
- Posts 506
|
TwelveBaud: Meh:After the 3rd or 4th time it happened, I built a
script to automatically backup, drop, and rebuild the tables.
From the same documentation, that's the best practice.
Which is TRWTF. That's NOT a fucking best practice, it's a fucking workaround hack.
|
|
Page 1 of 1 (21 items)
|
|
|