mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Give HarbormasterBuildLogChunk a real table
Summary: Ref T10457. Currently, this table is an ad-hoc table, but can easily be turned into a normal table. This will make iterating over log chunks to compress and archive them easier. Test Plan: Viewed logs, ran `bin/storage adjust` with no issues. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10457 Differential Revision: https://secure.phabricator.com/D15376
This commit is contained in:
parent
0daa9ad987
commit
e174cac1b4
4 changed files with 37 additions and 28 deletions
|
@ -1044,6 +1044,7 @@ phutil_register_library_map(array(
|
|||
'HarbormasterBuildGraph' => 'applications/harbormaster/engine/HarbormasterBuildGraph.php',
|
||||
'HarbormasterBuildLintMessage' => 'applications/harbormaster/storage/build/HarbormasterBuildLintMessage.php',
|
||||
'HarbormasterBuildLog' => 'applications/harbormaster/storage/build/HarbormasterBuildLog.php',
|
||||
'HarbormasterBuildLogChunk' => 'applications/harbormaster/storage/build/HarbormasterBuildLogChunk.php',
|
||||
'HarbormasterBuildLogPHIDType' => 'applications/harbormaster/phid/HarbormasterBuildLogPHIDType.php',
|
||||
'HarbormasterBuildLogQuery' => 'applications/harbormaster/query/HarbormasterBuildLogQuery.php',
|
||||
'HarbormasterBuildMessage' => 'applications/harbormaster/storage/HarbormasterBuildMessage.php',
|
||||
|
@ -5191,6 +5192,7 @@ phutil_register_library_map(array(
|
|||
'HarbormasterDAO',
|
||||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
'HarbormasterBuildLogChunk' => 'HarbormasterDAO',
|
||||
'HarbormasterBuildLogPHIDType' => 'PhabricatorPHIDType',
|
||||
'HarbormasterBuildLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'HarbormasterBuildMessage' => array(
|
||||
|
|
|
@ -21,31 +21,6 @@ final class HarbormasterSchemaSpec extends PhabricatorConfigSchemaSpec {
|
|||
),
|
||||
));
|
||||
|
||||
|
||||
$this->buildRawSchema(
|
||||
id(new HarbormasterBuildable())->getApplicationName(),
|
||||
HarbormasterBuildLog::CHUNK_TABLE,
|
||||
array(
|
||||
'id' => 'auto',
|
||||
'logID' => 'id',
|
||||
'encoding' => 'text32',
|
||||
|
||||
// T6203/NULLABILITY
|
||||
// Both the type and nullability of this column are crazily wrong.
|
||||
'size' => 'uint32?',
|
||||
|
||||
'chunk' => 'bytes',
|
||||
),
|
||||
array(
|
||||
'PRIMARY' => array(
|
||||
'columns' => array('id'),
|
||||
'unique' => true,
|
||||
),
|
||||
'key_log' => array(
|
||||
'columns' => array('logID'),
|
||||
),
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ final class HarbormasterBuildLog
|
|||
private $isOpen;
|
||||
|
||||
const CHUNK_BYTE_LIMIT = 102400;
|
||||
const CHUNK_TABLE = 'harbormaster_buildlogchunk';
|
||||
|
||||
/**
|
||||
* The log is encoded as plain text.
|
||||
|
@ -128,7 +127,7 @@ final class HarbormasterBuildLog
|
|||
// caller writes a single character over and over again, we'll currently
|
||||
// spend a lot of time flushing that.
|
||||
|
||||
$chunk_table = self::CHUNK_TABLE;
|
||||
$chunk_table = id(new HarbormasterBuildLogChunk())->getTableName();
|
||||
$chunk_limit = self::CHUNK_BYTE_LIMIT;
|
||||
$rope = $this->rope;
|
||||
|
||||
|
@ -198,9 +197,10 @@ final class HarbormasterBuildLog
|
|||
$result = queryfx_all(
|
||||
$conn,
|
||||
'SELECT chunk '.
|
||||
'FROM harbormaster_buildlogchunk '.
|
||||
'FROM %T '.
|
||||
'WHERE logID = %d '.
|
||||
'ORDER BY id ASC',
|
||||
id(new HarbormasterBuildLogChunk())->getTableName(),
|
||||
$this->getID());
|
||||
|
||||
$content = '';
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
final class HarbormasterBuildLogChunk
|
||||
extends HarbormasterDAO {
|
||||
|
||||
protected $logID;
|
||||
protected $encoding;
|
||||
protected $size;
|
||||
protected $chunk;
|
||||
|
||||
protected function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_TIMESTAMPS => false,
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'logID' => 'id',
|
||||
'encoding' => 'text32',
|
||||
|
||||
// T6203/NULLABILITY
|
||||
// Both the type and nullability of this column are crazily wrong.
|
||||
'size' => 'uint32?',
|
||||
|
||||
'chunk' => 'bytes',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
'key_log' => array(
|
||||
'columns' => array('logID'),
|
||||
),
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue