Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15265173
D20743.id49459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D20743.id49459.diff
View Options
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
@@ -30,4 +30,8 @@
) + parent::getConfiguration();
}
+ public function getSchemaPersistence() {
+ return PhabricatorConfigTableSchema::PERSISTENCE_CACHE;
+ }
+
}
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
@@ -48,11 +48,19 @@
abstract public function buildSchemata();
protected function buildLiskObjectSchema(PhabricatorLiskDAO $object) {
+ $index_options = array();
+
+ $persistence = $object->getSchemaPersistence();
+ if ($persistence !== null) {
+ $index_options['persistence'] = $persistence;
+ }
+
$this->buildRawSchema(
$object->getApplicationName(),
$object->getTableName(),
$object->getSchemaColumns(),
- $object->getSchemaKeys());
+ $object->getSchemaKeys(),
+ $index_options);
}
protected function buildFerretIndexSchema(PhabricatorFerretEngine $engine) {
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
@@ -1881,6 +1881,10 @@
->getMaximumByteLengthForDataType($data_type);
}
+ public function getSchemaPersistence() {
+ return null;
+ }
+
/* -( AphrontDatabaseTableRefInterface )----------------------------------- */
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
@@ -14,7 +14,8 @@
'name' => 'for-replica',
'help' => pht(
'Add __--master-data__ to the __mysqldump__ command, '.
- 'generating a CHANGE MASTER statement in the output.'),
+ 'generating a CHANGE MASTER statement in the output. This '.
+ 'option also dumps all data, including caches.'),
),
array(
'name' => 'output',
@@ -54,6 +55,8 @@
$output_file = $args->getArg('output');
$is_compress = $args->getArg('compress');
$is_overwrite = $args->getArg('overwrite');
+ $is_noindex = $args->getArg('no-indexes');
+ $is_replica = $args->getArg('for-replica');
if ($is_compress) {
if ($output_file === null) {
@@ -79,6 +82,14 @@
}
}
+ if ($is_replica && $is_noindex) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'The "--for-replica" flag can not be used with the '.
+ '"--no-indexes" flag. Replication dumps must contain a complete '.
+ 'representation of database state.'));
+ }
+
if ($output_file !== null) {
if (Filesystem::pathExists($output_file)) {
if (!$is_overwrite) {
@@ -94,8 +105,6 @@
$api = $this->getSingleAPI();
$patches = $this->getPatches();
- $with_indexes = !$args->getArg('no-indexes');
-
$applied = $api->getAppliedPatches();
if ($applied === null) {
throw new PhutilArgumentUsageException(
@@ -119,6 +128,9 @@
$schemata = $actual_map[$ref_key];
$expect = $expect_map[$ref_key];
+ $with_caches = $is_replica;
+ $with_indexes = !$is_noindex;
+
$targets = array();
foreach ($schemata->getDatabases() as $database_name => $database) {
$expect_database = $expect->getDatabase($database_name);
@@ -143,7 +155,7 @@
// When dumping tables, leave the data in cache tables in the
// database. This will be automatically rebuild after the data
// is restored and does not need to be persisted in backups.
- $with_data = false;
+ $with_data = $with_caches;
break;
case PhabricatorConfigTableSchema::PERSISTENCE_INDEX:
// When dumping tables, leave index data behind of the caller
@@ -183,7 +195,7 @@
$argv[] = '--default-character-set';
$argv[] = $api->getClientCharset();
- if ($args->getArg('for-replica')) {
+ if ($is_replica) {
$argv[] = '--master-data';
}
@@ -342,7 +354,6 @@
return 0;
}
-
private function writeData($data, $file, $is_compress, $output_file) {
if (!strlen($data)) {
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 26, 10:38 PM (14 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7209703
Default Alt Text
D20743.id49459.diff (4 KB)
Attached To
Mode
D20743: Straighten out replication/cache behavior in "bin/storage dump"
Attached
Detach File
Event Timeline
Log In to Comment