Project

Profile

Help

Issue #4288

_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column 'name' used in key specification without a key length")

Added by daviddavis almost 2 years ago. Updated 11 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

MySQL doesn't allow you to create an index on a text field unless you specify the length of the index (e.g. KEY pulp_app_workers_name (name(1000)). This is to prevent indexes from growing too large. We probably don't want to remove the key in which case we should either change the text fields to char fields or manually create the indexes in the db ourselves.

Here's how to search for the fields affected:

grep -r "TextField(db_index" *.py

Related issues

Blocks Pulp - Task #4270: Add support for MariaDB and MySQLCLOSED - CURRENTRELEASE

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision ed49af03 View on GitHub
Added by daviddavis almost 2 years ago

MySQL doesn't support text fields as indexes

Changing fields from text to char since MySQL doesn't support text fields as indexes. Also, recreating the migrations since they blow up when you run them on MySQL.

fixes #4288 https://pulp.plan.io/issues/4288

Revision ed49af03 View on GitHub
Added by daviddavis almost 2 years ago

MySQL doesn't support text fields as indexes

Changing fields from text to char since MySQL doesn't support text fields as indexes. Also, recreating the migrations since they blow up when you run them on MySQL.

fixes #4288 https://pulp.plan.io/issues/4288

Revision c0ff733e View on GitHub
Added by daviddavis over 1 year ago

Changing relative_path and digest to CharFields

The relative_path and digest fields are text fields and are part of a unique constraint which MySQL/mariadb doesn't support.

ref #4288 https://pulp.plan.io/issues/4288

History

#1 Updated by daviddavis almost 2 years ago

  • Blocks Task #4270: Add support for MariaDB and MySQL added

#2 Updated by daviddavis almost 2 years ago

There are 5 instances in Pulp where we have TextFields with db indexes. They're all name fields. I noticed in some cases (e.g. ContentGuard, Distribution) we are using CharField. So to reiterate, the options are:

1. Change all names to use CharField and thus avoiding having to write raw SQL in our migrations
2. Write a migration with some raw sql to create the key with a length. I am not sure how db agnostic this is though.

#3 Updated by daviddavis almost 2 years ago

  • Blocks Task #4290: Investigate performance of Pulp with UUID PKs added

#4 Updated by ttereshc almost 2 years ago

+1 to option 1, CharField.

In my opinion, we don't have a real need for TextField for names. And it seems that it's easier to stay DB-agnostic with a CharField and for some DBs it will also mean a performance gain (not for PostgreSQL though, it doesn't matter for it, AFAIK)

#5 Updated by bmbouter almost 2 years ago

+1 to CharField

#6 Updated by dkliban@redhat.com almost 2 years ago

we should go with the CharField

#7 Updated by daviddavis almost 2 years ago

  • Status changed from NEW to POST
  • Assignee set to daviddavis

#8 Updated by daviddavis almost 2 years ago

  • Status changed from POST to MODIFIED

#9 Updated by daviddavis almost 2 years ago

  • Status changed from MODIFIED to ASSIGNED

#10 Updated by daviddavis almost 2 years ago

  • Status changed from ASSIGNED to MODIFIED

#11 Updated by daviddavis almost 2 years ago

  • Status changed from MODIFIED to ASSIGNED

#12 Updated by daviddavis almost 2 years ago

  • Status changed from ASSIGNED to MODIFIED

#13 Updated by dalley almost 2 years ago

  • Blocks deleted (Task #4290: Investigate performance of Pulp with UUID PKs)

#14 Updated by daviddavis over 1 year ago

  • Status changed from MODIFIED to POST

#15 Updated by daviddavis over 1 year ago

  • Status changed from POST to MODIFIED

#16 Updated by daviddavis over 1 year ago

  • Sprint/Milestone set to 3.0.0

#17 Updated by bmbouter over 1 year ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)

#18 Updated by bmbouter 11 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF