microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.53k stars 896 forks source link

issue with database name in the task terminal not matching with the target database #19702

Open NokSamLeong opened 2 years ago

NokSamLeong commented 2 years ago

Issue Type: Bug

I am using the backupProvider to perform a full backup on a database in the SQL migration extension. The backup is completed as expected. However, when I close the extension wizard, the tasks in the terminal doesn't show the name of the database I triggered backup for. Instead, it shows the name of the first database in the database list in the extension wizard. For example, in the case where there are 3 databases in the database list in the extension wizard, when I trigger backup for the database 2 and then exit to the main page, it will show that backup database completed for database 1 and resulting .bak file is the backup for the database 2 as expected. The expected behavior is for the the terminal to show the name of the database I trigger backup for while the current behavior is that the terminal is showing the name of the first database in the db list in the extension wizard.

Azure Data Studio version: azuredatastudio Dev 1.37.0 (9ca6200018fc206d67a47229f991901a8a453781, 2017-12-15T12:00:00.000Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 x 1498)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.59GB (16.60GB free)| |Process Argv|. --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-renderer-backgrounding --disable-sync --metrics-recording-only --no-first-run --no-default-browser-check --user-data-dir=C:\\Users\\noksam\\Documents\\repo\\azuredatastudio/.profile-oss --inspect=5875 --no-cached-data --remote-debugging-port=9222 --remote-debugging-port=9222| |Screen Reader|no| |VM|0%|
Extensions: none
kburtram commented 2 years ago

@NokSamLeong can you provide a link the code you're using to trigger this back-up so we can repro locally?

NokSamLeong commented 2 years ago

@NokSamLeong can you provide a link the code you're using to trigger this back-up so we can repro locally?

the file I modified: https://github.com/microsoft/azuredatastudio/blob/t-noleong/backupForMigration/extensions/sql-migration/src/wizard/databaseBackupPage.ts the existing backup function: https://github.com/microsoft/azuredatastudio/blob/t-noleong/backupForMigration/src/sql/azdata.d.ts

NokSamLeong commented 2 years ago

might need to checkout this commit (https://github.com/microsoft/azuredatastudio/commit/4efc72378e6dbfb23ae73031b13936970617ddce) instead of the newest commit to repro the bug because status checking that was added in the newest commit is blocking the task from showing up in the terminal. steps to reproduce the bug.

  1. open up the SQL Migration extension
  2. click 'Migration to Azure SQL'
  3. select 1+ databases, click next
  4. select 'Azure SQL Manager Instance'
  5. scroll down and click view/select
  6. select all the database, click select and then next
  7. select any of the subscription that would allow you to click next, then move on to the next page.
  8. select 'offline migration, then next
  9. select 'my database backups are on a networkshare'
  10. scroll down to where you enter the networkshare path. Enter any network sharing path for all the databases.
  11. click backup for all the databases.
  12. then press cancel to close the wizard.
  13. go to the task tab in the terminal. The task should show the same name for all the tasks.
NokSamLeong commented 2 years ago

I did comparison between my project and the backup dialog which also uses the same backup function. The bug insists even when the parameters are exactly the same. The biggest difference in the beginning of my debugging was that the Uri I get from the migration model doesnt have the backupId, databasename, and databaseDisplayName. I added those to my uri and it didnt help.

kburtram commented 2 years ago

@NokSamLeong when I run through the repo steps above with the dev branch you linked me, I get the following exception when I click the Backup button. Are you sure all the changes are pushed? No entries are added to the Task panel and the busy spinner runs indefinitely after this exception, so I'm not able to see the issue you're encountering.

mainThreadExtensionService.ts:64 TypeError: Cannot read property '625c8fcd-8cc9-4c95-876f-b2a98f4707d4' of undefined
    at c:\Users\kburt\repos\azuredatastudio\extensions\sql-migration\out\wizard\databaseBackupPage.js:885:153
    at handleNotification (c:\Users\kburt\repos\azuredatastudio\extensions\mssql\node_modules\vscode-jsonrpc\lib\main.js:489:43)
    at processMessageQueue (c:\Users\kburt\repos\azuredatastudio\extensions\mssql\node_modules\vscode-jsonrpc\lib\main.js:260:17)
    at Immediate.<anonymous> (c:\Users\kburt\repos\azuredatastudio\extensions\mssql\node_modules\vscode-jsonrpc\lib\main.js:247:13)
    at processImmediate (internal/timers.js:461:21)
NokSamLeong commented 2 years ago

It should shows the task now if you pull the latest commit. Also it is expected behavior for now that the spinner go on indefinitely because of the listener issue.