Bug 1454823 - Restore snapshots table constraints to base_disks
Summary: Restore snapshots table constraints to base_disks
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Storage
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.2.0
: ---
Assignee: Eyal Shenitzky
QA Contact: Kevin Alon Goldblatt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-23 14:05 UTC by Fred Rolland
Modified: 2017-12-20 11:25 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-12-20 11:25:32 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 82158 0 master MERGED core: Restore snapshots constraints to base_disks 2017-09-28 13:40:10 UTC

Description Fred Rolland 2017-05-23 14:05:15 UTC
As part of solving #1427104, the constraints between snapshots and base_disks regarding the memory volumes were removed.
This was needed to solve a transaction deadlock in RestoreAllSnapshotsCommand.

In newer version of Postgres, the locking mechanism will allow this flow to succeed.

The constraints to be restored.

SELECT fn_db_create_constraint('snapshots', 'fk_snapshots_metadata_disk_id', 'FOREIGN KEY (memory_metadata_disk_id) REFERENCES base_disks(disk_id) ON DELETE SET NULL');
SELECT fn_db_create_constraint('snapshots', 'fk_snapshots_dump_disk_id', 'FOREIGN KEY (memory_dump_disk_id) REFERENCES base_disks(disk_id) ON DELETE SET NULL');

Comment 1 Allon Mureinik 2017-09-19 12:34:00 UTC
Tal, just to confirm - this is still relevant after your recent work on disk content types, right?

Comment 2 Tal Nisan 2017-09-25 11:39:04 UTC
(In reply to Allon Mureinik from comment #1)
> Tal, just to confirm - this is still relevant after your recent work on disk
> content types, right?

Indeed, it is not relevant for that change, we should still go on with restoring the contraints

Comment 5 Kevin Alon Goldblatt 2017-12-11 10:07:45 UTC
Tested with the following code:
--------------------------------
ovirt-engine-4.2.0-0.6.el7.noarch
vdsm-4.20.9-1.el7ev.x86_64


Tested with following scenario:
--------------------------------
Run the following on the engine:

psql -U postgres engine -c '\d snapshots'
                          Table "public.snapshots"
         Column          |           Type           |       Modifiers        
-------------------------+--------------------------+------------------------
 snapshot_id             | uuid                     | not null
 vm_id                   | uuid                     | not null
 snapshot_type           | character varying(32)    | not null
 status                  | character varying(32)    | not null
 description             | character varying(4000)  | 
 creation_date           | timestamp with time zone | not null
 app_list                | text                     | 
 vm_configuration        | text                     | 
 _create_date            | timestamp with time zone | default now()
 _update_date            | timestamp with time zone | 
 memory_volume           | character varying(255)   | 
 memory_metadata_disk_id | uuid                     | 
 memory_dump_disk_id     | uuid                     | 
 vm_configuration_broken | boolean                  | not null default false
Indexes:
    "pk_snapshots" PRIMARY KEY, btree (snapshot_id)
    "idx_snapshots_memory_dump_disk_id" btree (memory_dump_disk_id)
    "idx_snapshots_memory_metadata_disk_id" btree (memory_metadata_disk_id)
    "idx_snapshots_snapshot_type" btree (snapshot_type)
    "idx_snapshots_vm_id" btree (vm_id)
Foreign-key constraints:
    "fk_snapshot_vm" FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid)
    "fk_snapshots_dump_disk_id" FOREIGN KEY (memory_dump_disk_id) REFERENCES base_disks(disk_id) ON DELETE SET NULL
    "fk_snapshots_metadata_disk_id" FOREIGN KEY (memory_metadata_disk_id) REFERENCES base_disks(disk_id) ON DELETE SET NULL
Referenced by:
    TABLE "vm_device" CONSTRAINT "vm_device_snapshot_id_fkey" FOREIGN KEY (snapshot_id) REFERENCES snapshots(snapshot_id) ON DELETE CASCADE


Moving to VERIFIED

Comment 6 Sandro Bonazzola 2017-12-20 11:25:32 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.