czardoz / openarkkit

Automatically exported from code.google.com/p/openarkkit
0 stars 1 forks source link

id int(11) cause error #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

oak-online-alter-table --database=test_bd --table=test --alter="ADD COLUMN 
created DATETIME NULL DEFAULT NULL AFTER modified" --
socket=/var/lib/mysql/mysqld.sock

-- Connecting to MySQL
-- Table test_bd.test is of engine innodb
-- Checking for UNIQUE columns on test_bd.test, by which to chunk
-- Possible UNIQUE KEY column names in test_bd.test:
-- - id
-- Table test_bd.__oak_test has been created
exceptions.Exception (1054, "Unknown column 'modified' in '__oak_test'")
-- ERROR: Errors found. Initiating cleanup
-- Tables unlocked
-- Table test_bd.__oak_test was found and dropped
-- ERROR: (1054, "Unknown column 'modified' in '__oak_test'")
Traceback (most recent call last):
  File "scripts/oak-online-alter-table", line 954, in ?
    exit_with_error(err)
  File "scripts/oak-online-alter-table", line 853, in exit_with_error
    exit(1)
TypeError: 'str' object is not callable

CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24979 DEFAULT CHARSET=latin1;

Thank you,

Jean-Christophe Petit

Original issue reported on code.google.com by jeanchri...@gmail.com on 12 Jan 2010 at 12:14

GoogleCodeExporter commented 8 years ago
Sorry, I type a typo.

Here is the correct description of the problem:

What steps will reproduce the problem?

oak-online-alter-table --database=test_bd --table=test --alter="ADD COLUMN 
created 
DATETIME NULL DEFAULT NULL AFTER user_id" --socket=/var/lib/mysql/mysqld.sock

-- Connecting to MySQL
-- Table test_bd.test is of engine innodb
-- Checking for UNIQUE columns on test_bd.test, by which to chunk
-- Possible UNIQUE KEY column names in test_bd.test:
-- - id
-- Table test_bd.__oak_test has been created
-- Table test_bd.__oak_test has been altered
-- Checking for UNIQUE columns on test_bd.__oak_test, by which to chunk
-- Possible UNIQUE KEY column names in test_bd.__oak_test:
-- - id
-- Checking for UNIQUE columns on test_bd.test, by which to chunk
-- - Found following possible unique keys:
-- - id (int)
-- Chosen unique key is 'id'
-- Shared columns: user_id, id
-- Created AD trigger
-- Created AU trigger
-- Created AI trigger
-- Attempting to lock tables

-- Tables locked WRITE
-- id (min, max) values: ([24979L], [24981L])
-- Tables unlocked
exceptions.Exception sequence item 0: expected string, long found
-- ERROR: Errors found. Initiating cleanup
-- Tables unlocked
-- Table test_bd.__oak_test was found and dropped
-- Dropped custom trigger test_AD_oak
-- Dropped custom trigger test_AU_oak
-- Dropped custom trigger test_AI_oak
-- ERROR: sequence item 0: expected string, long found
Traceback (most recent call last):
  File "scripts/oak-online-alter-table", line 954, in ?
    exit_with_error(err)
  File "scripts/oak-online-alter-table", line 853, in exit_with_error
    exit(1)
TypeError: 'str' object is not callable

CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=24982 DEFAULT CHARSET=latin1;

INSERT INTO `test` VALUES (24979,1234),(24980,1236),(24981,1240);

Original comment by jeanchri...@gmail.com on 12 Jan 2010 at 12:24

GoogleCodeExporter commented 8 years ago
Oh dear!
I've let this bug slip for 5 months now. I'll get to it shortly. I apologise, I 
haven't put much resources into openark kit lately.

Original comment by shlomi.n...@gmail.com on 30 Jun 2010 at 5:39

GoogleCodeExporter commented 8 years ago
This actually due to bug in verbose log statement in line #729. You could 
simple change the line to 

verbose("%s range (%s), (%s), %s" % (description, 
unique_key_range_start_values, unique_key_range_end_values, 
get_progress_and_eta_presentation(elapsed_times, elapsed_time, 
ratio_complete))) 

Original comment by pvsu...@gmail.com on 1 Nov 2010 at 2:30

GoogleCodeExporter commented 8 years ago
pvsubra, thanks,
I've changed line to:

            verbose("%s range (%s), (%s), %s" % (description, ",".join("%s" % val for val in unique_key_range_start_values), ",".join(unique_key_range_end_values), get_progress_and_eta_presentation(elapsed_times, elapsed_time, ratio_complete)))

However, be advised that with the advent of Facebook's Online Schema Change 
(based on oak-online-alter-table) I will probably put less effort on this tool.

Fixed in revision 123 (not yet released)

Original comment by shlomi.n...@gmail.com on 2 Nov 2010 at 4:16