← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1051123] Re: migration 6 drops deleted image property index in sqlite

 

** Changed in: glance
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1051123

Title:
  migration 6 drops deleted image property index in sqlite

Status in OpenStack Image Registry and Delivery Service (Glance):
  Fix Released

Bug description:
  At version 5 of the glance db in sqlite, I see the following
  schema/indices:

  sqlite> select * from migrate_version;
  Glance Migrations|/home/markwash/devel/glance/glance/db/sqlalchemy/migrate_repo|5
  sqlite> .schema image_properties
  CREATE TABLE image_properties (
  	id INTEGER NOT NULL, 
  	image_id INTEGER NOT NULL, 
  	"key" VARCHAR(255) NOT NULL, 
  	value TEXT, 
  	created_at DATETIME NOT NULL, 
  	updated_at DATETIME, 
  	deleted_at DATETIME, 
  	deleted BOOLEAN NOT NULL, 
  	PRIMARY KEY (id), 
  	UNIQUE (image_id, "key"), 
  	FOREIGN KEY(image_id) REFERENCES images (id), 
  	CHECK (deleted IN (0, 1))
  );
  CREATE INDEX ix_image_properties_deleted ON image_properties (deleted);
  CREATE INDEX ix_image_properties_image_id ON image_properties (image_id);
  CREATE INDEX ix_image_properties_image_id_key ON image_properties (image_id, "key");
  sqlite> .indices
  ix_image_properties_deleted
  ix_image_properties_image_id
  ix_image_properties_image_id_key
  ix_images_deleted
  ix_images_is_public

  After upgrading to version 6, however, I see

  sqlite> .schema image_properties
  CREATE TABLE image_properties (
  	id INTEGER NOT NULL,
  	image_id INTEGER NOT NULL,
  	name VARCHAR(255) NOT NULL,
  	value TEXT,
  	created_at DATETIME NOT NULL,
  	updated_at DATETIME,
  	deleted_at DATETIME,
  	deleted BOOLEAN NOT NULL,
  	PRIMARY KEY (id),
  	CHECK (deleted IN (0, 1)),
  	UNIQUE (image_id, name),
  	FOREIGN KEY(image_id) REFERENCES images (id)
  );
  CREATE INDEX ix_image_properties_name ON image_properties (name);
  sqlite> .indices
  ix_image_properties_name
  ix_images_deleted
  ix_images_is_public

  From the text of the change, this does not seem intentional.

          Column('deleted', Boolean(), nullable=False, default=False,
                 index=True),

  This doesn't really seem like a big deal, as the index is preserved in
  mysql at least. Just wanted to document it.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1051123/+subscriptions