1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/resources/sql/autopatches/20140525.hunkmodern.sql
epriestley 0aa913805d Add an alternate "modern" hunk datastore
Summary:
Ref T4045. Ref T5179. Hunk storage has two major issues:

  - It's utf8, but actual diffs are binary.
  - It's huge and can't be compressed or archived.

This introduces a second datastore which solves these problems: by recording hunk encoding, supporting compression, and supporting alternate storage. There's no actual compression or storage support yet, but there's space in the table for them.

Since nothing actually uses hunk IDs, it's fine to have these tables exist at the same time and use the same IDs. We can migrate data between the tables gradually without requiring downtime or disrupting installs.

Test Plan:
  - There are no writes to the new table yet.
  - The only effect this has is making us issue one extra query when looking for hunks.
  - Observed the query issue, but everything else continue working fine.
  - Created a new diff.
  - Ran unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4045, T5179

Differential Revision: https://secure.phabricator.com/D9290
2014-06-03 18:01:22 -07:00

18 lines
653 B
SQL

CREATE TABLE {$NAMESPACE}_differential.differential_hunk_modern (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
changesetID INT UNSIGNED NOT NULL,
oldOffset INT UNSIGNED NOT NULL,
oldLen INT UNSIGNED NOT NULL,
newOffset INT UNSIGNED NOT NULL,
newLen INT UNSIGNED NOT NULL,
dataType CHAR(4) NOT NULL COLLATE latin1_bin,
dataEncoding VARCHAR(16) COLLATE latin1_bin,
dataFormat CHAR(4) NOT NULL COLLATE latin1_bin,
data LONGBLOB NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
KEY `key_changeset` (changesetID),
KEY `key_created` (dateCreated)
) ENGINE=InnoDB, COLLATE utf8_general_ci;