mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
don't check for null content in consistency checks because it's too slow for large databases #2887
This commit is contained in:
@@ -367,26 +367,30 @@ class ConsistencyChecks {
|
||||
}
|
||||
});
|
||||
|
||||
this.findAndFixIssues(`
|
||||
SELECT notes.noteId, notes.type, notes.mime
|
||||
FROM notes
|
||||
JOIN note_contents USING (noteId)
|
||||
WHERE isDeleted = 0
|
||||
AND isProtected = 0
|
||||
AND content IS NULL`,
|
||||
({noteId, type, mime}) => {
|
||||
if (this.autoFix) {
|
||||
const note = becca.getNote(noteId);
|
||||
const blankContent = getBlankContent(false, type, mime);
|
||||
note.setContent(blankContent);
|
||||
if (sqlInit.getDbSize() < 500000) {
|
||||
// querying for "content IS NULL" is expensive since content is not indexed. See e.g. https://github.com/zadam/trilium/issues/2887
|
||||
|
||||
this.reloadNeeded = true;
|
||||
this.findAndFixIssues(`
|
||||
SELECT notes.noteId, notes.type, notes.mime
|
||||
FROM notes
|
||||
JOIN note_contents USING (noteId)
|
||||
WHERE isDeleted = 0
|
||||
AND isProtected = 0
|
||||
AND content IS NULL`,
|
||||
({noteId, type, mime}) => {
|
||||
if (this.autoFix) {
|
||||
const note = becca.getNote(noteId);
|
||||
const blankContent = getBlankContent(false, type, mime);
|
||||
note.setContent(blankContent);
|
||||
|
||||
logFix(`Note ${noteId} content was set to "${blankContent}" since it was null even though it is not deleted`);
|
||||
} else {
|
||||
logError(`Note ${noteId} content is null even though it is not deleted`);
|
||||
}
|
||||
});
|
||||
this.reloadNeeded = true;
|
||||
|
||||
logFix(`Note ${noteId} content was set to "${blankContent}" since it was null even though it is not deleted`);
|
||||
} else {
|
||||
logError(`Note ${noteId} content is null even though it is not deleted`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.findAndFixIssues(`
|
||||
SELECT note_revisions.noteRevisionId
|
||||
|
||||
Reference in New Issue
Block a user