473,771 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anybody using DB2 9 on Linux x86, please, examine...

I'm almost sure I've found bad bug, but for a while I can't neither confirm nor reject this.

If anybody could make an independent test on it's own system, I'd appreciate it very much.

The possible bug is:

*************** *
*** DB2 refuses DEVICE containers bigger than 4Gb. ***
*************** *

DB2 version affected ( at least ):

| # db2level
| DB21085I Instance "dbi" uses "32" bits and DB2 code release "SQL09012" with level identifier "01030107".
| Informational tokens are "DB2 v9.1.0.2", "s070210", "MI00183", and Fix Pack "2".

The test is rather simple: just try in any database

| # db2 create tablespace X pagesize 4096 managed by database using ( device '/some/device' 1048576 )

The device must be bigger than 4G, and amount of pages indicated to DB2: any number >= 1048576 and <= (device size). The 1048576 because 1048576 * 4096 = 0x100000000, that is 4G.

If you get in response:
| SQL1422N The size of the container is invalid. SQLSTATE=54039

then you are affected too.
--
Konstantin Andreev.
May 30 '07
15 2873
Konstantin Andreev wrote:
I see 3 correct results, and 3 wrong results. But it's likely something
wrong in your code, not in ioctl(), because you mistakenly count BYTES
returned by ioctl(BLKGETSIZ E64) as SECTORS.

I can not review your code, because it's omitted, ...
Sorry about that - finger slipped. Here is the code:

------------------------------------------------------
/* Compile with "g++ -o GetDevSize -D_FILE_OFFSET_B ITS=64 GetDevSize.c" */

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/statvfs.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <errno.h>
#include <getopt.h>

#define BLKGETSIZE64 _IOR(0x12,114,s ize_t)
#define BLKGETSIZE _IO(0x12, 96)

int main (int argc, char *argv[])
{
int fh;
int rc;
size_t sectors = 0;
int pagesize = 4;
char *device = NULL;

if (argc < 2)
{
printf("\nSynta x: GetDevSize <device>\n\n" );
rc = -1;
return rc;
}

device = argv[1];

fh = open(device, O_RDONLY | O_DIRECT | O_LARGEFILE , 0600);
if ( -1 == fh )
{
printf("Error opening device \"%s\": %x\n", device, errno);
rc = 1;
return rc;
}
rc = ioctl(fh, BLKGETSIZE64, &sectors);
if ( 0 != rc )
{
printf("BLKGETS IZE64: Error calling ioctl: %x !\n", errno);
}
else
{
printf("BLKGETS IZE64: Device %s: rc=%u - %u sectors, %d %dK
pages\n",device , rc, sectors, sectors / (pagesize * 1024), pagesize );
}

close(fh);
return rc;
}
------------------------------------------------------

Jun 1 '07 #11
Jan M. Nelken wrote:
Sorry about that - finger slipped. Here is the code:
Here is your miss:
size_t sectors = 0;
rc = ioctl(fh, BLKGETSIZE64, &sectors);
LOL. You are getting the 64-bits value in the 32-bit variable. Certainly, you see only lowest bits.

Maybe IBM worth hire me for coding :) I can handle this :)...
--
Konstantin Andreev.
Jun 1 '07 #12
Konstantin Andreev wrote:
Here is your miss:
> size_t sectors = 0;
rc = ioctl(fh, BLKGETSIZE64, &sectors);

LOL. You are getting the 64-bits value in the 32-bit variable.
Certainly, you see only lowest bits.

Maybe IBM worth hire me for coding :) I can handle this :)...
Oh - now I get it:

There is an ioctl BLKGETSIZE that returns the size (in 512-byte sectors)
of a block device in 32 bits.
There is an ioctl BLKGETSIZE64 that returns the size (in bytes) of a
block device in 64 bits.

Not too consistent - I would say.

I am not related to hiring process at IBM at all - so cannot help you
here. But - you were too eager to blame DB2 - an IBM product.
Thanks anyway

Jan M. Nelken
Jun 1 '07 #13
Jan M. Nelken wrote:
Sorry about that - finger slipped. Here is the code:
Sorry, the error is more subtle.

Somebody mistakenly assumed that if BLKGETSIZE64 is formally defined as
#define BLKGETSIZE64 _IOR(0x12,114,s ize_t)
then ioctl() returns sizeof(size_t) value... But

1) the contrary is clearly documented:
--- ( from linux/fs.h )----
#define BLKGETSIZE64 _IOR(0x12,114,s ize_t) /* return device size in bytes (u64 *arg) */

2) it's easy to note, that 64-bit value can't fit in 32-bit 'size_t' (on 32-bit platform).

Hence, ioctl(BLKGETSIZ E64) has not an implementation error, but feature.
The situation is clear now, thank you for intresting discussion.
--
Konstantin Andreev.
Jun 1 '07 #14
Jan M. Nelken wrote:
But - you were too eager to blame DB2 - an IBM product.
:) I generally flay without regard for rank. IBM or DB2 is not special case.

--
Konstantin Andreev.
Jun 1 '07 #15
Konstantin Andreev wrote:
Jan M. Nelken wrote:
>But - you were too eager to blame DB2 - an IBM product.
:) I generally flay without regard for rank. IBM or DB2 is not special
case.
A man to my liking.

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 1 '07 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5242
by: Fred | last post by:
Hi, I'm thinking about using a USB attached device for some data collection. I can use other languages to "talk" with it, but I'd prefer a Java solution. Does anybody have any experience with USB and Java and could point me to a starting point? Thanks. (Already know Java and apologize if I'm overlooking the obvious.)
1
2667
by: Nick Leeson | last post by:
I have two HTML files - call it file1.html and file2.html.Is there a utility in Linux that I can use to visually compare the difference between the two files.Please note that I need to display and examine the difference in a Web browser like Mozilla. Otherwise I could have used the simple 'diff' utility. I know a utility called DiffnMerge exists in Windows , but is there something similar for linux? Please lemme know,
3
1450
by: Clamps | last post by:
I was wondering if anybody gets similar results when attempting to query an XML Doc with an XPath query or if this is expected behavior or if I'm using something incorrectly. <xml ...> <LoginInfo> <user> <username>test</username> <password>test</password> </user>
3
5129
by: mairhtin o'feannag | last post by:
Hello, Since DB2 Cluster Certification Guide is out of print and I cannot seem to get my hands on a copy, is there a publication that would give me a "cookbook" approach to setting up a cluster using Linux and multiple machines? I came across a couple of things, but they all assume one honking great AIX box with multiple SPs and that sort of thing.
27
4771
by: MK | last post by:
I am a newbie. Please help. The following warning is issued by gcc-3.2.2 compiler (pc Linux): ================================================================== read_raw_data.c:51: warning: assignment makes pointer from integer without a cast ================================================================== when the following piece of code was compiled. The offending statement is calloc. A similar statement in the main() function...
1
1088
by: CrazyCube | last post by:
does any body got some files about Orthogonal Experiment?? i really need it now ,if anybody got ,please send them to me my mailbox is : yuxh312@hotmail.com
18
26121
by: Digital Puer | last post by:
Hi, I'm coming over from Java to C++, so please bear with me. In C++, is there a way for me to use exceptions to catch segmentation faults (e.g. when I access a location off the end of an array)? Thanks.
5
2474
by: John Ladasky | last post by:
Hi folks, Running Python 2.5 on both a Windows XP laptop, and an Ubuntu Linux 7.04 desktop. I've gotten tired of maintaining multiple copies of my personal modules that I use over and over. I have copies of these files in the same directory as the main program I happen to be working on at the time. I've also downloaded FANN, and want to use its Python bindings. FANN does not seem to build automatically, like wxWidgets
44
584
by: John Dann | last post by:
I'm unclear as to how best to use what I'm terming the top-level CSS selectors, by which I mean selectors like *, html and body. I'm coming at this from trying to understand how best to set font sizes but I seem to have strayed into a broader question. Some CSS guides seem to suggest that a * declaration is good practice for any style sheet, primarily I suppose to set zero defaults for margin and padding for all other relevant selectors...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.