Skip to content

Commit 42eb0ef

Browse files
committed
gate prepareMigrationFallback on shouldInsertData. Back out properties table delete.
1 parent 7c0cef7 commit 42eb0ef

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

api/src/org/labkey/api/security/Encryption.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,10 @@ static void registerHandler(EncryptionMigrationHandler handler)
570570
*/
571571
public static void prepareMigrationFallback()
572572
{
573-
if (!isEncryptionPassPhraseSpecified())
573+
// Skip if no pass phrase is configured (nothing to fall back to) or we're not inserting data such
574+
// as during database migration (checkMigration() is gated the same way, so the fallback would be unused).
575+
// The latter avoids constructing an AES instance, which would lazily create a salt row in the property store.
576+
if (!isEncryptionPassPhraseSpecified() || !ModuleLoader.getInstance().shouldInsertData())
574577
return;
575578

576579
String oldPassPhrase = getOldEncryptionPassPhrase();

core/src/org/labkey/core/CoreMigrationSchemaHandler.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ public void beforeVerification()
104104
{
105105
super.beforeVerification();
106106

107-
// Clear prop.Properties and prop.PropertySets first: bootstrap (e.g., Encryption.checkMigration) can leave
108-
// PropertySets rows whose ObjectId references the bootstrap containers, blocking the Containers delete below.
109-
Table.delete(PropertySchema.getInstance().getTableInfoProperties());
110-
Table.delete(PropertySchema.getInstance().getTableInfoPropertySets());
111-
112107
// Delete root and shared containers that were needed for bootstrapping
113108
Table.delete(CoreSchema.getInstance().getTableInfoContainers());
114109
DbScope targetScope = DbScope.getLabKeyScope();

0 commit comments

Comments
 (0)