Page MenuHomePhabricator

D10501.diff
No OneTemporary

D10501.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1277,6 +1277,7 @@
'PhabricatorCacheManagementPurgeWorkflow' => 'applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php',
'PhabricatorCacheManagementWorkflow' => 'applications/cache/management/PhabricatorCacheManagementWorkflow.php',
'PhabricatorCacheMarkupGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheMarkupGarbageCollector.php',
+ 'PhabricatorCacheSchemaSpec' => 'applications/cache/storage/PhabricatorCacheSchemaSpec.php',
'PhabricatorCacheTTLGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheTTLGarbageCollector.php',
'PhabricatorCaches' => 'applications/cache/PhabricatorCaches.php',
'PhabricatorCalendarApplication' => 'applications/calendar/application/PhabricatorCalendarApplication.php',
@@ -4161,6 +4162,7 @@
'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorCacheManagementWorkflow',
'PhabricatorCacheManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorCacheMarkupGarbageCollector' => 'PhabricatorGarbageCollector',
+ 'PhabricatorCacheSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorCacheTTLGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorCalendarApplication' => 'PhabricatorApplication',
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
diff --git a/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php b/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php
new file mode 100644
--- /dev/null
+++ b/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php
@@ -0,0 +1,31 @@
+<?php
+
+final class PhabricatorCacheSchemaSpec extends PhabricatorConfigSchemaSpec {
+
+ public function buildSchemata() {
+ $this->buildLiskSchemata('PhabricatorCacheDAO');
+
+ $this->buildRawSchema(
+ 'cache',
+ id(new PhabricatorKeyValueDatabaseCache())->getTableName(),
+ array(
+ 'id' => 'id64',
+ 'cacheKeyHash' => 'bytes12',
+ 'cacheKey' => 'text128',
+ 'cacheFormat' => 'text16',
+ 'cacheData' => 'bytes',
+ 'cacheCreated' => 'epoch',
+ 'cacheExpires' => 'epoch?',
+ ),
+ array(
+ 'PRIMARY' => array(
+ 'columns' => array('id'),
+ ),
+ 'key_cacheKeyHash' => array(
+ 'columns' => array('cacheKeyHash'),
+ ),
+ ));
+
+ }
+
+}
diff --git a/src/applications/cache/storage/PhabricatorMarkupCache.php b/src/applications/cache/storage/PhabricatorMarkupCache.php
--- a/src/applications/cache/storage/PhabricatorMarkupCache.php
+++ b/src/applications/cache/storage/PhabricatorMarkupCache.php
@@ -15,6 +15,14 @@
self::CONFIG_BINARY => array(
'cacheData' => true,
),
+ self::CONFIG_COLUMN_SCHEMA => array(
+ 'cacheKey' => 'text128',
+ ),
+ self::CONFIG_KEY_SCHEMA => array(
+ 'cacheKey' => array(
+ 'columns' => array('cacheKey'),
+ ),
+ ),
) + parent::getConfiguration();
}
diff --git a/src/applications/config/schema/PhabricatorConfigColumnSchema.php b/src/applications/config/schema/PhabricatorConfigColumnSchema.php
--- a/src/applications/config/schema/PhabricatorConfigColumnSchema.php
+++ b/src/applications/config/schema/PhabricatorConfigColumnSchema.php
@@ -67,6 +67,13 @@
return ((int)$matches[1]) * 4;
}
+ $matches = null;
+ if (preg_match('/^char\((\d+)\)$/', $type, $matches)) {
+ // We use char() only for fixed-length binary data, so its size
+ // is always the column size.
+ return ((int)$matches[1]);
+ }
+
switch ($type) {
case 'int(10) unsigned':
return 4;
diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
--- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
+++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
@@ -57,12 +57,23 @@
}
private function buildLiskObjectSchema(PhabricatorLiskDAO $object) {
- $database = $this->getDatabase($object->getApplicationName());
+ $this->buildRawSchema(
+ $object->getApplicationName(),
+ $object->getTableName(),
+ $object->getSchemaColumns(),
+ $object->getSchemaKeys());
+ }
+
+ protected function buildRawSchema(
+ $database_name,
+ $table_name,
+ array $columns,
+ array $keys) {
+ $database = $this->getDatabase($database_name);
- $table = $this->newTable($object->getTableName());
+ $table = $this->newTable($table_name);
- $cols = $object->getSchemaColumns();
- foreach ($cols as $name => $type) {
+ foreach ($columns as $name => $type) {
$details = $this->getDetailsForDataType($type);
list($column_type, $charset, $collation, $nullable) = $details;
@@ -76,7 +87,6 @@
$table->addColumn($column);
}
- $keys = $object->getSchemaKeys();
foreach ($keys as $key_name => $key_spec) {
$key = $this->newKey($key_name)
->setColumnNames(idx($key_spec, 'columns', array()));
@@ -147,13 +157,21 @@
case 'uint32':
$column_type = 'int(10) unsigned';
break;
+ case 'id64':
+ $column_type = 'bigint(20) unsigned';
+ break;
case 'phid':
case 'policy';
$column_type = 'varchar(64)';
$charset = 'binary';
$collation = 'binary';
break;
- case 'blob':
+ case 'bytes12':
+ $column_type = 'char(12)';
+ $charset = 'binary';
+ $collation = 'binary';
+ break;
+ case 'bytes':
$column_type = 'longblob';
$charset = 'binary';
$collation = 'binary';
@@ -173,6 +191,11 @@
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
+ case 'text16':
+ $column_type = 'varchar(16)';
+ $charset = $this->getUTF8Charset();
+ $collation = $this->getUTF8Collation();
+ break;
case 'text12':
$column_type = 'varchar(12)';
$charset = $this->getUTF8Charset();
diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php
--- a/src/infrastructure/storage/lisk/LiskDAO.php
+++ b/src/infrastructure/storage/lisk/LiskDAO.php
@@ -1734,7 +1734,7 @@
$serialization_map = array(
self::SERIALIZATION_JSON => 'text',
- self::SERIALIZATION_PHP => 'blob',
+ self::SERIALIZATION_PHP => 'bytes',
);
$builtin = array(

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 14, 6:32 PM (1 d, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8454352
Default Alt Text
D10501.diff (6 KB)

Event Timeline