Ignore read-only mode in SQL->DS replication process (#1432)

* Ignore read-only mode in SQL->DS replication process

We need to be able to save indices and save data about the replication
even when we're in read-only mode.
This commit is contained in:
gbrodman 2021-11-24 11:51:25 -05:00 committed by GitHub
parent 97a87687b2
commit e4fb083f8a
2 changed files with 5 additions and 5 deletions

View file

@ -228,10 +228,8 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable {
/** Used when replaying from SQL to DS to populate the Datastore indexes. */
protected void saveIndexesToDatastore() {
ofyTm()
.putAll(
ForeignKeyIndex.create(this, getDeletionTime()),
EppResourceIndex.create(Key.create(this)));
ofyTm().putIgnoringReadOnly(ForeignKeyIndex.create(this, getDeletionTime()));
ofyTm().putIgnoringReadOnly(EppResourceIndex.create(Key.create(this)));
}
/** EppResources that are loaded via foreign keys should implement this marker interface. */

View file

@ -148,7 +148,9 @@ public class ReplicateToDatastoreAction implements Runnable {
// Write the updated last transaction id to Datastore as part of this Datastore
// transaction.
auditedOfy().save().entity(lastSqlTxn.cloneWithNewTransactionId(nextTxnId));
auditedOfy()
.saveIgnoringReadOnly()
.entity(lastSqlTxn.cloneWithNewTransactionId(nextTxnId));
logger.atInfo().log(
"Finished applying single transaction Cloud SQL -> Cloud Datastore.");
});