Quantcast
Channel: MySQL Forums - NDB clusters
Viewing all articles
Browse latest Browse all 1562

auto_increment with primary key not working right (2 replies)

$
0
0
Greetings forum ,

I have a mysql cluster with 2 data nodes (seperate boxes) in nodegroup0. I create a table within a database with the following structure :

CREATE TABLE `some-products` (
`connectorID` mediumint(4) unsigned NOT NULL auto_increment,
`name` varchar(20) NOT NULL,
`icon` varchar(20) NOT NULL,
`class` varchar(50) NOT NULL,
`auhorized` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`connectorID`),
KEY `auhorized` (`auhorized`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=utf8;

Then i add data to this table with the following method

INSERT INTO `some-products` (`connectorID`, `name`, `icon`, `class`, `auhorized`) VALUES
(1, 'Bread', 'bread.png', 'breadprod', 1),
(2, 'Butter', 'butter.png', 'butterprod', 1),
(3, 'Honey', 'honey.png', 'honeyprod', 1),
(4, 'Chocolate', 'chocolate.png', 'chocoprod', 1),
(5, 'Cookie', 'cookie.png', 'cookieprod', 0),
(6, 'Milk', 'milk.png', 'milkprod', 1),
(7, 'Peanuts', 'peanuts.png', 'peanutprod', 1),
(8, 'Olives', 'olives.png', 'oliveprod', 1),
(9, 'Beans', 'beans.png', 'beanprod', 1),
(10, 'Potatoes', 'potatoes.png', 'potatoeprod', 0),
(11, 'Eggs', 'eggs.png', 'eggprod', 0);


Now when i do a "select * from `some-products`;" , i dont get tha data in the right order based on the primary key but I get the right order in a non clustered version of mysql. If i add "order by connectorID" to my select i get the data right. Any ideas why this happens? Does the partitioning of ndb storage engine has something to do with it? Anyone knows how to fix it?

Thank you

Alexander Economou

Viewing all articles
Browse latest Browse all 1562

Trending Articles