mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
UBERF-8888: Fix backup (#7451)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
de77b1a559
commit
942a6c768f
@ -867,6 +867,10 @@ export async function listWorkspaces (
|
|||||||
): Promise<WorkspaceInfo[]> {
|
): Promise<WorkspaceInfo[]> {
|
||||||
decodeToken(ctx, token) // Just verify token is valid
|
decodeToken(ctx, token) // Just verify token is valid
|
||||||
|
|
||||||
|
if (region === '') {
|
||||||
|
region = null
|
||||||
|
}
|
||||||
|
|
||||||
return (await db.workspace.find(region != null ? { region } : {}))
|
return (await db.workspace.find(region != null ? { region } : {}))
|
||||||
.filter((it) => it.disabled !== true)
|
.filter((it) => it.disabled !== true)
|
||||||
.map(trimWorkspaceInfo)
|
.map(trimWorkspaceInfo)
|
||||||
@ -903,6 +907,9 @@ export async function countWorkspacesInRegion (
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function listWorkspacesRaw (db: AccountDB, region?: string): Promise<Workspace[]> {
|
export async function listWorkspacesRaw (db: AccountDB, region?: string): Promise<Workspace[]> {
|
||||||
|
if (region === '') {
|
||||||
|
region = undefined
|
||||||
|
}
|
||||||
return (await db.workspace.find(region !== undefined ? { region } : {})).filter((it) => it.disabled !== true)
|
return (await db.workspace.find(region !== undefined ? { region } : {})).filter((it) => it.disabled !== true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1652,6 +1652,7 @@ export async function restore (
|
|||||||
storageAdapter?: StorageAdapter
|
storageAdapter?: StorageAdapter
|
||||||
token?: string
|
token?: string
|
||||||
progress?: (progress: number) => Promise<void>
|
progress?: (progress: number) => Promise<void>
|
||||||
|
cleanIndexState?: boolean
|
||||||
}
|
}
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const infoFile = 'backup.json.gz'
|
const infoFile = 'backup.json.gz'
|
||||||
@ -1845,6 +1846,11 @@ export async function restore (
|
|||||||
tx.objectSpace = core.space.Workspace
|
tx.objectSpace = core.space.Workspace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (opt.cleanIndexState === true) {
|
||||||
|
if (d._class === core.class.DocIndexState) {
|
||||||
|
;(d as DocIndexState).needIndex = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.recheck === true) {
|
if (opt.recheck === true) {
|
||||||
|
@ -347,13 +347,8 @@ export async function doRestoreWorkspace (
|
|||||||
bucketName: string,
|
bucketName: string,
|
||||||
pipelineFactory: PipelineFactory,
|
pipelineFactory: PipelineFactory,
|
||||||
workspaceStorageAdapter: StorageAdapter,
|
workspaceStorageAdapter: StorageAdapter,
|
||||||
getConfig: (
|
|
||||||
ctx: MeasureContext,
|
|
||||||
workspace: WorkspaceIdWithUrl,
|
|
||||||
branding: Branding | null,
|
|
||||||
externalStorage: StorageAdapter
|
|
||||||
) => DbConfiguration,
|
|
||||||
skipDomains: string[],
|
skipDomains: string[],
|
||||||
|
cleanIndexState: boolean,
|
||||||
notify?: (progress: number) => Promise<void>
|
notify?: (progress: number) => Promise<void>
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
rootCtx.warn('\nRESTORE WORKSPACE ', {
|
rootCtx.warn('\nRESTORE WORKSPACE ', {
|
||||||
@ -374,6 +369,7 @@ export async function doRestoreWorkspace (
|
|||||||
skip: new Set(skipDomains),
|
skip: new Set(skipDomains),
|
||||||
recheck: true,
|
recheck: true,
|
||||||
storageAdapter: workspaceStorageAdapter,
|
storageAdapter: workspaceStorageAdapter,
|
||||||
|
cleanIndexState,
|
||||||
getConnection: async () => {
|
getConnection: async () => {
|
||||||
if (pipeline === undefined) {
|
if (pipeline === undefined) {
|
||||||
pipeline = await pipelineFactory(ctx, wsUrl, true, () => {}, null)
|
pipeline = await pipelineFactory(ctx, wsUrl, true, () => {}, null)
|
||||||
|
@ -530,13 +530,8 @@ export class WorkspaceWorker {
|
|||||||
opt.backup.bucketName,
|
opt.backup.bucketName,
|
||||||
pipelineFactory,
|
pipelineFactory,
|
||||||
workspaceStorageAdapter,
|
workspaceStorageAdapter,
|
||||||
(ctx, workspace, branding, externalStorage) => {
|
|
||||||
return getConfig(ctx, dbUrl, ctx, {
|
|
||||||
externalStorage,
|
|
||||||
disableTriggers: true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
['blob'],
|
['blob'],
|
||||||
|
true,
|
||||||
(_p: number) => {
|
(_p: number) => {
|
||||||
if (progress !== Math.round(_p)) {
|
if (progress !== Math.round(_p)) {
|
||||||
progress = Math.round(_p)
|
progress = Math.round(_p)
|
||||||
|
Loading…
Reference in New Issue
Block a user