QFix reindex (#8236)

This commit is contained in:
Andrey Sobolev 2025-03-15 20:49:54 +07:00 committed by GitHub
parent 5facd91fab
commit 9013ca0037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 17 deletions

View File

@ -1,25 +1,25 @@
{ {
"ACCOUNTS_URL": "/account", "ACCOUNTS_URL": "/account",
"COLLABORATOR_URL": "ws://localhost:3078", "COLLABORATOR_URL": "ws://huly.local:3078",
"UPLOAD_URL": "/files", "UPLOAD_URL": "/files",
"TELEGRAM_URL": "http://localhost:8086", "TELEGRAM_URL": "http://huly.local:8086",
"GMAIL_URL": "http://localhost:8088", "GMAIL_URL": "http://huly.huly.local:8088",
"CALENDAR_URL": "http://localhost:8095", "CALENDAR_URL": "http://localhost:8095",
"REKONI_URL": "/rekoni", "REKONI_URL": "/rekoni",
"GITHUB_APP": "uberflow-dev", "GITHUB_APP": "uberflow-dev",
"GITHUB_CLIENTID": "Iv1.43f9cac43bd68617", "GITHUB_CLIENTID": "Iv1.43f9cac43bd68617",
"GITHUB_URL": "http://localhost:3500", "GITHUB_URL": "http://huly.local:3500",
"LAST_NAME_FIRST": "true", "LAST_NAME_FIRST": "true",
"PRINT_URL": "http://localhost:4005", "PRINT_URL": "http://huly.local:4005",
"SIGN_URL": "http://localhost:4006", "SIGN_URL": "http://huly.local:4006",
"ANALYTICS_COLLECTOR_URL": "http://localhost:4017", "ANALYTICS_COLLECTOR_URL": "http://huly.local:4017",
"AI_URL": "http://localhost:4010", "AI_URL": "http://huly.local:4010",
"BRANDING_URL": "/branding.json", "BRANDING_URL": "/branding.json",
"VERSION": null, "VERSION": null,
"MODEL_VERSION": null, "MODEL_VERSION": null,
"STATS_URL": "http://localhost:4900", "STATS_URL": "http://huly.local:4900",
"PASSWORD_STRICTNESS": "none", "PASSWORD_STRICTNESS": "none",
"STREAM_URL": "http://localhost:1080/recording", "STREAM_URL": "http://huly.local:1080/recording",
"PUBLIC_SCHEDULE_URL": "http://localhost:8060", "PUBLIC_SCHEDULE_URL": "http://huly.local:8060",
"EXPORT_URL": "http://localhost:4009/export" "EXPORT_URL": "http://huly.local:4009/export"
} }

View File

@ -64,7 +64,7 @@ import type {
import { RateLimiter, SessionDataImpl } from '@hcengineering/server-core' import { RateLimiter, SessionDataImpl } from '@hcengineering/server-core'
import { jsonToText, markupToJSON, markupToText } from '@hcengineering/text' import { jsonToText, markupToJSON, markupToText } from '@hcengineering/text'
import { findSearchPresenter, updateDocWithPresenter } from '../mapper' import { findSearchPresenter, updateDocWithPresenter } from '../mapper'
import { type FullTextPipeline } from './types' import { docStructure, fullReindex, indexes, type FullTextPipeline } from './types'
import { createIndexedDoc, createStateDoc, getContent } from './utils' import { createIndexedDoc, createStateDoc, getContent } from './utils'
export * from './types' export * from './types'
@ -205,7 +205,6 @@ export class FullTextIndexPipeline implements FullTextPipeline {
}) })
) )
const indexes = 'verify-indexes-v2'
if (migrations.find((it) => it.state === indexes) === undefined) { if (migrations.find((it) => it.state === indexes) === undefined) {
ctx.warn('Rebuild DB index', { workspace: this.workspace.uuid }) ctx.warn('Rebuild DB index', { workspace: this.workspace.uuid })
// Clean all existing docs, they will be re-created on verify stage // Clean all existing docs, they will be re-created on verify stage
@ -215,7 +214,6 @@ export class FullTextIndexPipeline implements FullTextPipeline {
ctx.warn('Rebuild DB index complete', { workspace: this.workspace.uuid }) ctx.warn('Rebuild DB index complete', { workspace: this.workspace.uuid })
} }
const fullReindex = 'full-text-indexer-v5'
if (migrations.find((it) => it.state === fullReindex) === undefined) { if (migrations.find((it) => it.state === fullReindex) === undefined) {
ctx.warn('rebuilding index to v5', { workspace: this.workspace.uuid }) ctx.warn('rebuilding index to v5', { workspace: this.workspace.uuid })
// Clean all existing docs, they will be re-created on verify stage // Clean all existing docs, they will be re-created on verify stage
@ -229,7 +227,6 @@ export class FullTextIndexPipeline implements FullTextPipeline {
await this.addMigration(ctx, fullReindex) await this.addMigration(ctx, fullReindex)
} }
const docStructure = 'full-text-structure-v6'
if (migrations.find((it) => it.state === docStructure) === undefined) { if (migrations.find((it) => it.state === docStructure) === undefined) {
ctx.warn('verify document structure', { version: docStructure, workspace: this.workspace.uuid }) ctx.warn('verify document structure', { version: docStructure, workspace: this.workspace.uuid })
@ -293,7 +290,7 @@ export class FullTextIndexPipeline implements FullTextPipeline {
const migrations = await this.storage.findAll<MigrationState>(ctx, core.class.MigrationState, { const migrations = await this.storage.findAll<MigrationState>(ctx, core.class.MigrationState, {
plugin: coreId, plugin: coreId,
state: { state: {
$in: ['verify-indexes-v2', 'full-text-indexer-v5', 'full-text-structure-v4'] $in: [indexes, fullReindex, docStructure]
} }
}) })

View File

@ -39,3 +39,7 @@ export interface FullTextPipeline {
* @public * @public
*/ */
export type DocUpdateHandler = (doc: DocIndexState, update: DocumentUpdate<DocIndexState>) => Promise<void> export type DocUpdateHandler = (doc: DocIndexState, update: DocumentUpdate<DocIndexState>) => Promise<void>
export const indexes = 'verify-indexes-v2'
export const fullReindex = 'full-text-indexer-v5'
export const docStructure = 'full-text-structure-v6'