mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 12:08:36 +02:00
Add more logging in the event of replay put/delete failure (#1262)
* Add more logging in the event of replay put/delete failure
This commit is contained in:
parent
a369e57e5c
commit
fb002953c8
1 changed files with 31 additions and 21 deletions
|
@ -233,6 +233,7 @@ public class ReplayCommitLogsToSqlAction implements Runnable {
|
||||||
|
|
||||||
private void handleEntityPut(Entity entity) {
|
private void handleEntityPut(Entity entity) {
|
||||||
Object ofyPojo = auditedOfy().toPojo(entity);
|
Object ofyPojo = auditedOfy().toPojo(entity);
|
||||||
|
try {
|
||||||
if (ofyPojo instanceof DatastoreEntity) {
|
if (ofyPojo instanceof DatastoreEntity) {
|
||||||
DatastoreEntity datastoreEntity = (DatastoreEntity) ofyPojo;
|
DatastoreEntity datastoreEntity = (DatastoreEntity) ofyPojo;
|
||||||
datastoreEntity
|
datastoreEntity
|
||||||
|
@ -248,6 +249,10 @@ public class ReplayCommitLogsToSqlAction implements Runnable {
|
||||||
"%s does not implement DatastoreEntity, which is necessary for SQL replay.",
|
"%s does not implement DatastoreEntity, which is necessary for SQL replay.",
|
||||||
ofyPojo.getClass());
|
ofyPojo.getClass());
|
||||||
}
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
logger.atSevere().log("Error when replaying object %s", ofyPojo);
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleEntityDelete(VersionedEntity entityToDelete) {
|
private void handleEntityDelete(VersionedEntity entityToDelete) {
|
||||||
|
@ -262,6 +267,7 @@ public class ReplayCommitLogsToSqlAction implements Runnable {
|
||||||
"Skipping SQL delete for kind %s since it is not convertible.", key.getKind());
|
"Skipping SQL delete for kind %s since it is not convertible.", key.getKind());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
Class<?> entityClass = entityVKey.getKind();
|
Class<?> entityClass = entityVKey.getKind();
|
||||||
// Delete the key iff the class represents a JPA entity that is replicated
|
// Delete the key iff the class represents a JPA entity that is replicated
|
||||||
if (!NonReplicatedEntity.class.isAssignableFrom(entityClass)
|
if (!NonReplicatedEntity.class.isAssignableFrom(entityClass)
|
||||||
|
@ -270,6 +276,10 @@ public class ReplayCommitLogsToSqlAction implements Runnable {
|
||||||
ReplaySpecializer.beforeSqlDelete(entityVKey);
|
ReplaySpecializer.beforeSqlDelete(entityVKey);
|
||||||
jpaTm().delete(entityVKey);
|
jpaTm().delete(entityVKey);
|
||||||
}
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
logger.atSevere().log("Error when deleting key %s", entityVKey);
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int compareByWeight(VersionedEntity a, VersionedEntity b) {
|
private static int compareByWeight(VersionedEntity a, VersionedEntity b) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue