Skip to content

Commit

Permalink
Revert unicode sqlite extension to fix db corruption #3241
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Aug 9, 2024
1 parent c5ba40a commit 3a1e9ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions server/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ class Database {

try {
await this.sequelize.authenticate()
await this.loadExtensions([process.env.SQLEAN_UNICODE_PATH])
Logger.info(`[Database] Db connection was successful`)
return true
} catch (error) {
Expand All @@ -217,7 +216,7 @@ class Database {
}

/**
*
* TODO: Temporarily disabled
* @param {string[]} extensions paths to extension binaries
*/
async loadExtensions(extensions) {
Expand Down Expand Up @@ -827,7 +826,7 @@ class Database {
}

/**
*
* TODO: Temporarily unused
* @param {string} value
* @returns {string}
*/
Expand All @@ -836,7 +835,7 @@ class Database {
}

/**
*
* TODO: Temporarily unused
* @param {string} query
* @returns {Promise<string>}
*/
Expand All @@ -855,7 +854,7 @@ class Database {
*/
matchExpression(column, normalizedQuery) {
const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`)
const normalizedColumn = this.normalize(column)
const normalizedColumn = column
return `${normalizedColumn} LIKE ${normalizedPattern}`
}
}
Expand Down
5 changes: 3 additions & 2 deletions server/managers/BinaryManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ module.exports.sqlean = sqlean // for testing
class BinaryManager {
defaultRequiredBinaries = [
new Binary('ffmpeg', 'executable', 'FFMPEG_PATH', ['5.1'], ffbinaries), // ffmpeg executable
new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries), // ffprobe executable
new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension
new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries) // ffprobe executable
// TODO: Temporarily disabled due to db corruption issues

This comment has been minimized.

Copy link
@devnoname120

devnoname120 Aug 10, 2024

Contributor

Any ideas why it happens?

This comment has been minimized.

Copy link
@advplyr

advplyr Aug 10, 2024

Author Owner

Yeah @mikiher tracked it down to the COLLATE NOCASE indexes. #3199 (comment)

// new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension
]

constructor(requiredBinaries = this.defaultRequiredBinaries) {
Expand Down
2 changes: 1 addition & 1 deletion server/utils/queries/libraryItemsBookFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ module.exports = {
async search(oldUser, oldLibrary, query, limit, offset) {
const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(oldUser)

const normalizedQuery = await Database.getNormalizedQuery(query)
const normalizedQuery = query

const matchTitle = Database.matchExpression('title', normalizedQuery)
const matchSubtitle = Database.matchExpression('subtitle', normalizedQuery)
Expand Down
2 changes: 1 addition & 1 deletion server/utils/queries/libraryItemsPodcastFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ module.exports = {
async search(oldUser, oldLibrary, query, limit, offset) {
const userPermissionPodcastWhere = this.getUserPermissionPodcastWhereQuery(oldUser)

const normalizedQuery = await Database.getNormalizedQuery(query)
const normalizedQuery = query
const matchTitle = Database.matchExpression('title', normalizedQuery)
const matchAuthor = Database.matchExpression('author', normalizedQuery)

Expand Down

0 comments on commit 3a1e9ab

Please sign in to comment.