mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
SQL-Migration: add new migration monitoring data to migration details (#22460)
* add new migration details * move migraiton target type enum to utils * address review feedback, refectore, text update * fix variable name * limit and filter migrations list to mi/vm/db
This commit is contained in:
@@ -911,6 +911,7 @@ export enum AzureResourceKind {
|
||||
SQLDB = 'SqlDb',
|
||||
SQLMI = 'SqlMi',
|
||||
SQLVM = 'SqlVm',
|
||||
ORACLETOSQLDB = "OracleToSqlDb",
|
||||
}
|
||||
|
||||
export interface ValidateIrSqlDatabaseMigrationRequest {
|
||||
@@ -1008,6 +1009,7 @@ export interface DatabaseMigration {
|
||||
|
||||
export interface DatabaseMigrationProperties {
|
||||
scope: string;
|
||||
kind: string;
|
||||
provisioningState: 'Succeeded' | 'Failed' | 'Creating';
|
||||
provisioningError: string;
|
||||
migrationStatus: 'Canceled' | 'Canceling' | 'Completing' | 'Creating' | 'Failed' | 'InProgress' | 'ReadyForCutover' | 'Restoring' | 'Retriable' | 'Succeeded' | 'UploadingFullBackup' | 'UploadingLogBackup';
|
||||
@@ -1043,6 +1045,22 @@ export interface MigrationStatusDetails {
|
||||
invalidFiles: string[];
|
||||
listOfCopyProgressDetails: CopyProgressDetail[];
|
||||
sqlDataCopyErrors: string[];
|
||||
|
||||
// new fields
|
||||
pendingDiffBackupsCount: number;
|
||||
restorePercentCompleted: number;
|
||||
currentRestoredSize: number;
|
||||
currentRestorePlanSize: number;
|
||||
lastUploadedFileName: string;
|
||||
lastUploadedFileTime: string;
|
||||
lastRestoredFileTime: string;
|
||||
miRestoreState: "None" | "Initializing" | "NotStarted" | "SearchingBackups" | "Restoring" | "RestorePaused" | "RestoreCompleted" | "Waiting" | "CompletingMigration" | "Cancelled" | "Failed" | "Completed" | "Blocked";
|
||||
detectedFiles: number;
|
||||
queuedFiles: number;
|
||||
skippedFiles: number;
|
||||
restoringFiles: number;
|
||||
restoredFiles: number;
|
||||
unrestorableFiles: number;
|
||||
}
|
||||
|
||||
export interface MigrationStatusWarnings {
|
||||
@@ -1053,7 +1071,7 @@ export interface MigrationStatusWarnings {
|
||||
|
||||
export interface CopyProgressDetail {
|
||||
tableName: string;
|
||||
status: 'PreparingForCopy' | 'Copying' | 'CopyFinished' | 'RebuildingIndexes' | 'Succeeded' | 'Failed' | 'Canceled',
|
||||
status: 'PreparingForCopy' | 'Copying' | 'CopyFinished' | 'RebuildingIndexes' | 'Succeeded' | 'Failed' | 'Canceled';
|
||||
parallelCopyType: string;
|
||||
usedParallelCopies: number;
|
||||
dataRead: number;
|
||||
@@ -1061,7 +1079,7 @@ export interface CopyProgressDetail {
|
||||
rowsRead: number;
|
||||
rowsCopied: number;
|
||||
copyStart: string;
|
||||
copyThroughput: number,
|
||||
copyThroughput: number;
|
||||
copyDuration: number;
|
||||
errors: string[];
|
||||
}
|
||||
@@ -1083,22 +1101,30 @@ export interface ErrorInfo {
|
||||
|
||||
export interface BackupSetInfo {
|
||||
backupSetId: string;
|
||||
firstLSN: string;
|
||||
lastLSN: string;
|
||||
backupType: string;
|
||||
firstLSN: string; // SHIR scenario only
|
||||
lastLSN: string; // SHIR scenario only
|
||||
backupType: "Unknown" | "Database" | "TransactionLog" | "File" | "DifferentialDatabase" | "DifferentialFile" | "Partial" | "DifferentialPartial";
|
||||
listOfBackupFiles: BackupFileInfo[];
|
||||
backupStartDate: string;
|
||||
backupFinishDate: string;
|
||||
backupStartDate: string; // SHIR scenario only
|
||||
backupFinishDate: string; // SHIR scenario only
|
||||
isBackupRestored: boolean;
|
||||
backupSize: number;
|
||||
compressedBackupSize: number;
|
||||
hasBackupChecksums: boolean;
|
||||
familyCount: number;
|
||||
|
||||
// new fields
|
||||
restoreStartDate: string;
|
||||
restoreFinishDate: string;
|
||||
restoreStatus: "None" | "Skipped" | "Queued" | "Restoring" | "Restored";
|
||||
backupSizeMB: number;
|
||||
numberOfStripes: number;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
fileShare?: DatabaseMigrationFileShare;
|
||||
azureBlob?: DatabaseMigrationAzureBlob;
|
||||
testConnectivity?: boolean;
|
||||
fileStorageType: 'FileShare' | 'AzureBlob' | 'None';
|
||||
}
|
||||
|
||||
@@ -1109,6 +1135,7 @@ export interface TargetLocation {
|
||||
|
||||
export interface BackupFileInfo {
|
||||
fileName: string;
|
||||
// fields below are only returned by SHIR scenarios
|
||||
status: 'Arrived' | 'Uploading' | 'Uploaded' | 'Restoring' | 'Restored' | 'Canceled' | 'Ignored';
|
||||
totalSize: number;
|
||||
dataRead: number;
|
||||
|
||||
@@ -37,6 +37,12 @@ export const MenuCommands = {
|
||||
SendFeedback: 'sqlmigration.sendfeedback',
|
||||
};
|
||||
|
||||
export enum MigrationTargetType {
|
||||
SQLVM = 'AzureSqlVirtualMachine',
|
||||
SQLMI = 'AzureSqlManagedInstance',
|
||||
SQLDB = 'AzureSqlDatabase'
|
||||
}
|
||||
|
||||
export function deepClone<T>(obj: T): T {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return obj;
|
||||
@@ -152,7 +158,16 @@ export function getMigrationDuration(startDate: string, endDate: string): string
|
||||
}
|
||||
|
||||
export function filterMigrations(databaseMigrations: azure.DatabaseMigration[], statusFilter: string, columnTextFilter?: string): azure.DatabaseMigration[] {
|
||||
let filteredMigration: azure.DatabaseMigration[] = databaseMigrations || [];
|
||||
const supportedKind: string[] = [
|
||||
azure.AzureResourceKind.SQLDB,
|
||||
azure.AzureResourceKind.SQLMI,
|
||||
azure.AzureResourceKind.SQLVM,
|
||||
];
|
||||
|
||||
let filteredMigration: azure.DatabaseMigration[] =
|
||||
databaseMigrations.filter(m => supportedKind.includes(m.properties?.kind)) ||
|
||||
[];
|
||||
|
||||
if (columnTextFilter) {
|
||||
const filter = columnTextFilter.toLowerCase();
|
||||
filteredMigration = filteredMigration.filter(
|
||||
@@ -196,6 +211,7 @@ export function filterMigrations(databaseMigrations: azure.DatabaseMigration[],
|
||||
return filteredMigration.filter(
|
||||
value => getMigrationStatus(value) === constants.MigrationState.Completing);
|
||||
}
|
||||
|
||||
return filteredMigration;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user