Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14075047
D19138.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19138.id.diff
View Options
diff --git a/resources/sql/autopatches/20180223.log.02.chunkformat.sql b/resources/sql/autopatches/20180223.log.02.chunkformat.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180223.log.02.chunkformat.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_harbormaster.harbormaster_buildlog
+ ADD chunkFormat VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/autopatches/20180223.log.03.chunkdefault.sql b/resources/sql/autopatches/20180223.log.03.chunkdefault.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180223.log.03.chunkdefault.sql
@@ -0,0 +1,2 @@
+UPDATE {$NAMESPACE}_harbormaster.harbormaster_buildlog
+ SET chunkFormat = 'text' WHERE chunkFormat = '';
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
@@ -13,6 +13,7 @@
protected $live;
protected $filePHID;
protected $byteLength;
+ protected $chunkFormat;
private $buildTarget = self::ATTACHABLE;
private $rope;
@@ -44,7 +45,8 @@
->setBuildTargetPHID($build_target->getPHID())
->setDuration(null)
->setLive(1)
- ->setByteLength(0);
+ ->setByteLength(0)
+ ->setChunkFormat(HarbormasterBuildLogChunk::CHUNK_ENCODING_TEXT);
}
public function scheduleRebuild($force) {
@@ -73,6 +75,7 @@
'live' => 'bool',
'filePHID' => 'phid?',
'byteLength' => 'uint64',
+ 'chunkFormat' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_buildtarget' => array(
@@ -105,6 +108,11 @@
->setPageSize(8);
}
+ public function newDataIterator() {
+ return $this->newChunkIterator()
+ ->setAsString(true);
+ }
+
private function loadLastChunkInfo() {
$chunk_table = new HarbormasterBuildLogChunk();
$conn_w = $chunk_table->establishConnection('w');
@@ -188,6 +196,10 @@
$this->writeEncodedChunk($rope, $byte_limit, $mode);
}
+ $this
+ ->setChunkFormat($mode)
+ ->save();
+
$this->saveTransaction();
}
diff --git a/src/applications/harbormaster/worker/HarbormasterLogWorker.php b/src/applications/harbormaster/worker/HarbormasterLogWorker.php
--- a/src/applications/harbormaster/worker/HarbormasterLogWorker.php
+++ b/src/applications/harbormaster/worker/HarbormasterLogWorker.php
@@ -58,20 +58,23 @@
$is_force = idx($data, 'force');
if (!$log->getByteLength() || $is_force) {
- $iterator = $log->newChunkIterator()
- ->setAsString(true);
+ $iterator = $log->newDataIterator();
$byte_length = 0;
foreach ($iterator as $block) {
$byte_length += strlen($block);
}
+
$log
->setByteLength($byte_length)
->save();
}
- if ($log->canCompressLog()) {
- $log->compressLog();
+ $format_text = HarbormasterBuildLogChunk::CHUNK_ENCODING_TEXT;
+ if (($log->getChunkFormat() === $format_text) || $is_force) {
+ if ($log->canCompressLog()) {
+ $log->compressLog();
+ }
}
if ($is_force) {
@@ -79,8 +82,7 @@
}
if (!$log->getFilePHID()) {
- $iterator = $log->newChunkIterator()
- ->setAsString(true);
+ $iterator = $log->newDataIterator();
$source = id(new PhabricatorIteratorFileUploadSource())
->setName('harbormaster-log-'.$log->getID().'.log')
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 9:36 AM (7 h, 57 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6774324
Default Alt Text
D19138.id.diff (3 KB)
Attached To
Mode
D19138: Store the Harbormaster log chunk format on the log record
Attached
Detach File
Event Timeline
Log In to Comment