Skip to content

Deleting channel with a collaborator crashed the QN's processor #4601

@zeeshanakram3

Description

@zeeshanakram3

Context

As reported, deletion of channel with a collaborator crashed the QN's processor, see logs:

INFO: Last block: 1264132     : 38680 blocks behind
INFO: Starting the event queue
INFO: Processing block: 0001264154-865d6, events count: 4 
Asset has been disconnected from Channel { channelId: '17', dataObjectId: '143' }
Asset has been disconnected from Channel { channelId: '17', dataObjectId: '144' }
ERROR: Stopping the proccessor due to errors: {
  "query": "DELETE FROM \"channel\" WHERE \"id\" = $1",
  "parameters": [
    "17"
  ],
  "driverError": {
    "length": 309,
    "name": "error",
    "severity": "ERROR",
    "code": "23503",
    "detail": "Key (id)=(17) is still referenced from table \"collaborator\".",
    "schema": "public",
    "table": "collaborator",
    "constraint": "FK_e69d65ddb224176321e63ec3585",
    "file": "ri_triggers.c",
    "line": "2476",
    "routine": "ri_ReportViolation"
  },
  "length": 309,
  "severity": "ERROR",
  "code": "23503",
  "detail": "Key (id)=(17) is still referenced from table \"collaborator\".",
  "schema": "public",
  "table": "collaborator",
  "constraint": "FK_e69d65ddb224176321e63ec3585",
  "file": "ri_triggers.c",
  "line": "2476",
  "routine": "ri_ReportViolation"
} name: QueryFailedError, message: update or delete on table "channel" violates foreign key constraint "FK_e69d65ddb224176321e63ec3585" on table "collaborator", stack: QueryFailedError: update or delete on table "channel" violates foreign key constraint "FK_e69d65ddb224176321e63ec3585" on table "collaborator"
    at QueryFailedError.TypeORMError [as constructor] (/joystream/node_modules/typeorm/error/TypeORMError.js:9:28)
I 

Fix

During processing the channel deletion mappings, we need to make sure that all the entities that have non-nullable reference (e.g. Collaborator) to channel are removed before we actually remove channel from the DB.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions