Use the read-only replica for JPA invoicing (#1494)

* Use the read-only replica for JPA invoicing
This commit is contained in:
gbrodman 2022-01-20 20:50:10 +00:00 committed by GitHub
parent c8636f6c90
commit 7a14f23c79
2 changed files with 17 additions and 11 deletions

View file

@ -32,6 +32,7 @@ import com.google.common.net.MediaType;
import google.registry.config.RegistryConfig.Config;
import google.registry.config.RegistryEnvironment;
import google.registry.model.common.DatabaseMigrationStateSchedule.PrimaryDatabase;
import google.registry.persistence.PersistenceModule;
import google.registry.reporting.ReportingModule;
import google.registry.request.Action;
import google.registry.request.Parameter;
@ -120,17 +121,16 @@ public class GenerateInvoicesAction implements Runnable {
.setContainerSpecGcsPath(
String.format("%s/%s_metadata.json", stagingBucketUrl, PIPELINE_NAME))
.setParameters(
ImmutableMap.of(
"yearMonth",
yearMonth.toString("yyyy-MM"),
"invoiceFilePrefix",
invoiceFilePrefix,
"database",
database.name(),
"billingBucketUrl",
billingBucketUrl,
"registryEnvironment",
RegistryEnvironment.get().name()));
new ImmutableMap.Builder<String, String>()
.put("yearMonth", yearMonth.toString("yyyy-MM"))
.put("invoiceFilePrefix", invoiceFilePrefix)
.put("database", database.name())
.put("billingBucketUrl", billingBucketUrl)
.put("registryEnvironment", RegistryEnvironment.get().name())
.put(
"jpaTransactionManagerType",
PersistenceModule.JpaTransactionManagerType.READ_ONLY_REPLICA.toString())
.build());
LaunchFlexTemplateResponse launchResponse =
dataflow
.projects()

View file

@ -69,6 +69,12 @@
"regexes": [
"^DATASTORE|CLOUD_SQL$"
]
},
{
"name": "jpaTransactionManagerType",
"label": "The type of JPA transaction manager to use if using SQL",
"helpText": "The standard SQL instance or a read-only replica may be used",
"regexes": ["^REGULAR|READ_ONLY_REPLICA$"]
}
]
}