Blame view

UPGRADE 3.1 KB
Julien Muchembled committed
1 2 3 4 5 6 7
NEO 1.0
=======

The format of MySQL tables has changed in NEO 1.0 and there is no backward
compatibility or transparent migration, so you will have to use the following
SQL commands to migrate each storage from NEO 0.10.x::

Julien Muchembled committed
8
  -- make sure 'tobj' & 'ttrans' are empty first
Julien Muchembled committed
9
  -- and all storages have up-to-date partition tables
Julien Muchembled committed
10 11
  CREATE TABLE new_data (id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, hash BINARY(20) NOT NULL UNIQUE, compression TINYINT UNSIGNED NULL, value LONGBLOB NULL) ENGINE = InnoDB SELECT DISTINCT obj.hash as hash FROM obj, data WHERE obj.hash=data.hash ORDER BY serial;
  UPDATE new_data, data SET new_data.compression=data.compression, new_data.value=data.value WHERE new_data.hash=data.hash;
Julien Muchembled committed
12 13
  DROP TABLE data;
  RENAME TABLE new_data TO data;
Julien Muchembled committed
14
  CREATE TABLE new_obj (partition SMALLINT UNSIGNED NOT NULL, oid BIGINT UNSIGNED NOT NULL, tid BIGINT UNSIGNED NOT NULL, data_id BIGINT UNSIGNED NULL, value_tid BIGINT UNSIGNED NULL, PRIMARY KEY (partition, tid, oid), KEY (partition, oid, tid), KEY (data_id)) ENGINE = InnoDB SELECT partition, oid, serial as tid, data.id as data_id, value_serial as value_tid FROM obj LEFT JOIN data ON (obj.hash=data.hash);
Julien Muchembled committed
15 16
  DROP TABLE obj;
  RENAME TABLE new_obj TO obj;
Julien Muchembled committed
17
  ALTER TABLE tobj CHANGE serial tid BIGINT UNSIGNED NOT NULL, CHANGE hash data_id BIGINT UNSIGNED NULL, CHANGE value_serial value_tid BIGINT UNSIGNED NULL;
Julien Muchembled committed
18 19 20
  ALTER TABLE trans ADD COLUMN ttid BIGINT UNSIGNED NOT NULL;
  UPDATE trans SET ttid=tid;
  ALTER TABLE ttrans ADD COLUMN ttid BIGINT UNSIGNED NOT NULL;
Julien Muchembled committed
21
  ALTER TABLE config MODIFY name VARBINARY(255) NOT NULL;
Julien Muchembled committed
22 23 24 25 26
  CREATE TEMPORARY TABLE nid (new INT NOT NULL AUTO_INCREMENT PRIMARY KEY, old CHAR(32) NOT NULL, KEY (old)) ENGINE = InnoDB SELECT DISTINCT uuid as old FROM pt ORDER BY uuid;
  ALTER TABLE pt DROP PRIMARY KEY, ADD nid INT NOT NULL after rid;
  UPDATE pt, nid SET pt.nid=nid.new, state=state-1 WHERE pt.uuid=nid.old;
  ALTER TABLE pt DROP uuid, ADD PRIMARY KEY (rid, nid);
  UPDATE config, nid SET config.name='nid', config.value=nid.new WHERE config.name='uuid' AND nid.old=config.value;
Julien Muchembled committed
27
  DELETE FROM config WHERE name='loid';
Julien Muchembled committed
28

Julien Muchembled committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
NEO 0.10
========

The format of MySQL tables has changed in NEO 0.10 and there is no backward
compatibility or transparent migration, so you will have to use the following
SQL commands to migrate each storage from NEO < 0.10::

  -- make sure 'tobj' is empty first
  DROP TABLE obj_short, tobj;
  ALTER TABLE obj CHANGE checksum hash BINARY(20) NULL;
  UPDATE obj SET value=NULL WHERE value='';
  UPDATE obj SET hash=UNHEX(SHA1(value));
  ALTER TABLE obj ADD KEY (hash(4));
  CREATE TABLE data (hash BINARY(20) NOT NULL PRIMARY KEY, compression TINYINT UNSIGNED NULL, value LONGBLOB NULL) ENGINE = InnoDB SELECT DISTINCT hash, compression, value FROM obj WHERE hash IS NOT NULL;
  ALTER TABLE obj DROP compression, DROP value;
  UPDATE obj, obj as undone SET obj.hash=undone.hash WHERE obj.value_serial IS NOT NULL AND obj.partition=undone.partition AND obj.oid=undone.oid AND obj.value_serial=undone.serial;

If 'tobj' is not empty, this means your cluster was not shutdown properly.
Restart it to flush the last committed transaction.