Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare Zui Data Migration Script #2409

Closed
jameskerr opened this issue Jun 21, 2022 · 6 comments · Fixed by #2428
Closed

Prepare Zui Data Migration Script #2409

jameskerr opened this issue Jun 21, 2022 · 6 comments · Fixed by #2428
Assignees

Comments

@jameskerr
Copy link
Member

When Zui launches for the first time ever, write a script to go get the app state and the lake from the Brim directory.
Copy it into the Zui directory, then restart the app.

Test that permissions work.

@philrz
Copy link
Contributor

philrz commented Aug 9, 2022

I'm verifiying this using GA Brim v0.31.0 and the Zui test artifacts linked from https://github.com/brimdata/brim/actions/runs/2827034553.

Steps for testing migration

  1. Start with a system that has neither Brim nor Zui installed on it
  2. Install Brim v0.31.0
  3. Accumulate data in files/directories that will be migrated by:
    a. Create a lake by dragging in a ZNG file (populates lake/)
    b. Create a saved query (populates appState.json)
    c. Create a second lake and add to the Brimcap root by dragging in a pcap file (populaes lake/ and data/)
  4. Quit Brim
  5. install and launch the Zui test artifact
  6. Check the Zui logs/main.log to confirm the migration was successful
  7. In Zui, access both lakes, run the saved query, and extract a pcap slice to WIreshark to ensure the migrated data all works as expected

Steps for testing that migration only runs once

  1. Quit Zui
  2. Relaunch Brim v0.31.0
  3. Add another lake, saved query, and pcap
  4. Quit Brim
  5. Relaunch Zui
  6. Check the Zui logs/main.log to confirm the migration did not run again
  7. In Zui, confirm that none of the data we just added in Brim shows up in Zui

Steps for testing that Zui works fine if there never was any legacy Brim present

  1. Start with a system that has neither Brim nor Zui installed on it
  2. Install and launch the Zui test artifact
  3. Check the Zui logs/main.log to confirm no migration was attempted
  4. In Zui, create test lakes and add/run a saved query and confirm all works as expected

@philrz
Copy link
Contributor

philrz commented Aug 9, 2022

On macOS, testing migration showed the following in the Zui log:

[2022-08-09 15:12:03.122] [info] app paths: getAppPath=/Applications/Zui.app/Contents/Resources/app.asar userData=/Users/phil/Library/Application Support/Zui logs=/Users/phil/Library/Application Support/Zui/logs
[2022-08-09 15:12:03.148] [info] brim data found
[2022-08-09 15:12:03.149] [info] no existing zui data, proceeding to migrate
[2022-08-09 15:12:03.149] [info] migrating '/Users/phil/Library/Application Support/Brim/appState.json' => '/Users/phil/Library/Application Support/Zui/appState.json'
[2022-08-09 15:12:03.151] [info] migrating '/Users/phil/Library/Application Support/Brim/lake => /Users/phil/Library/Application Support/Zui/lake'
[2022-08-09 15:12:03.316] [info] migrating '/Users/phil/Library/Application Support/Brim/data => /Users/phil/Library/Application Support/Zui/data'
[2022-08-09 15:12:03.389] [info] migration completed
[2022-08-09 15:12:03.539] [info] migrations: currentVersion=202202170834 pending=2
[2022-08-09 15:12:03.539] [info] migrations: running
[2022-08-09 15:12:03.541] [info] migrations: currentVersion=202207270956

When testing that migration only ran once, upon relaunching Zui, only the following lines were added to the log:

[2022-08-09 15:16:17.872] [info] app paths: getAppPath=/Applications/Zui.app/Contents/Resources/app.asar userData=/Users/phil/Library/Application Support/Zui logs=/Users/phil/Library/Application Support/Zui/logs
[2022-08-09 15:16:18.111] [info] migrations: currentVersion=202207270956 pending=0

...and none of the additional data we'd added in Brim was visible in the app.

For testing without legacy Brim present, the Zui log on first launch looked like:

[2022-08-09 15:18:17.364] [info] app paths: getAppPath=/Applications/Zui.app/Contents/Resources/app.asar userData=/Users/phil/Library/Application Support/Zui logs=/Users/phil/Library/Application Support/Zui/logs
[2022-08-09 15:18:17.391] [info] no brim data to migrate

...and test lakes and saved queries worked as expected.

@philrz
Copy link
Contributor

philrz commented Aug 10, 2022

On Windows, testing migration showed the following in the Zui log:

[2022-08-09 16:03:43.561] [info] app paths: getAppPath=C:\Users\Phil\AppData\Local\Programs\brim\resources\app.asar userData=C:\Users\Phil\AppData\Roaming\Zui logs=C:\Users\Phil\AppData\Roaming\Zui\logs
[2022-08-09 16:03:43.795] [info] brim data found
[2022-08-09 16:03:43.797] [info] no existing zui data, proceeding to migrate
[2022-08-09 16:03:43.798] [info] migrating 'C:\Users\Phil\AppData\Roaming\Brim\appState.json' => 'C:\Users\Phil\AppData\Roaming\Zui\appState.json'
[2022-08-09 16:03:43.805] [info] migrating 'C:\Users\Phil\AppData\Roaming\Brim\lake => C:\Users\Phil\AppData\Roaming\Zui\lake'
[2022-08-09 16:03:44.920] [info] migrating 'C:\Users\Phil\AppData\Roaming\Brim\data => C:\Users\Phil\AppData\Roaming\Zui\data'
[2022-08-09 16:03:45.062] [info] migration completed
[2022-08-09 16:03:45.598] [info] migrations: currentVersion=202202170834 pending=2
[2022-08-09 16:03:45.599] [info] migrations: running
[2022-08-09 16:03:45.602] [info] migrations: currentVersion=202207270956
[2022-08-09 16:04:15.865] [error] There was a problem updating the application: Error: net::ERR_NAME_NOT_RESOLVED
[2022-08-09 16:04:15.867] [error] Error: net::ERR_NAME_NOT_RESOLVED
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:105:7068)
    at SimpleURLLoaderWrapper.emit (node:events:394:28)

While the tests with the migrated lakes and saved query all worked fine, I noticed that when I installed Zui, my Brim was immediately uninstalled, which is the same symptom we saw with Zui Insider tracked in #2459. As a result, I wasn't able to do the tests that migration would run only once.

For testing without legacy Brim present, the Zui log on first launch looked like:

[2022-08-09 17:56:48.684] [info] app paths: getAppPath=C:\Users\Phil\AppData\Local\Programs\zui\resources\app.asar userData=C:\Users\Phil\AppData\Roaming\Zui logs=C:\Users\Phil\AppData\Roaming\Zui\logs
[2022-08-09 17:56:48.957] [info] no brim data to migrate

...and test lakes and saved queries worked as expected.

@philrz
Copy link
Contributor

philrz commented Aug 10, 2022

On Ubuntu Linux 21.10, testing migration showed the following in the Zui log:

[2022-08-09 19:06:07.974] [info] app paths: getAppPath=/opt/Zui/resources/app.asar userData=/home/phil/.config/Zui logs=/home/phil/.config/Zui/logs
[2022-08-09 19:06:08.085] [info] brim data found
[2022-08-09 19:06:08.087] [info] no existing zui data, proceeding to migrate
[2022-08-09 19:06:08.087] [info] migrating '/home/phil/.config/Brim/appState.json' => '/home/phil/.config/Zui/appState.json'
[2022-08-09 19:06:08.089] [info] migrating '/home/phil/.config/Brim/lake => /home/phil/.config/Zui/lake'
[2022-08-09 19:06:08.558] [info] migrating '/home/phil/.config/Brim/data => /home/phil/.config/Zui/data'
[2022-08-09 19:06:08.674] [info] migration completed
[2022-08-09 19:06:08.722] [info] migrations: currentVersion=202202170834 pending=2
[2022-08-09 19:06:08.723] [info] migrations: running
[2022-08-09 19:06:08.724] [info] migrations: currentVersion=202207270956

When testing that migration only ran once, upon relaunching Zui, only the following lines were added to the log:

[2022-08-09 19:08:16.835] [info] app paths: getAppPath=/opt/Zui/resources/app.asar userData=/home/phil/.config/Zui logs=/home/phil/.config/Zui/logs
[2022-08-09 19:08:16.980] [info] migrations: currentVersion=202207270956 pending=0

...and none of the additional data we'd added in Brim was visible in the app.

For testing without legacy Brim present, the Zui log on first launch looked like:

[2022-08-09 19:11:15.956] [info] app paths: getAppPath=/opt/Zui/resources/app.asar userData=/home/phil/.config/Zui logs=/home/phil/.config/Zui/logs
[2022-08-09 19:11:16.021] [info] no brim data to migrate

...and test lakes and saved queries worked as expected.

@philrz
Copy link
Contributor

philrz commented Aug 10, 2022

On CentOS 8, testing migration showed the following in the Zui log:

[2022-08-09 22:29:39.070] [info] app paths: getAppPath=/opt/Zui/resources/app.asar userData=/home/phil/.config/Zui logs=/home/phil/.config/Zui/logs
[2022-08-09 22:29:39.203] [info] brim data found
[2022-08-09 22:29:39.204] [info] no existing zui data, proceeding to migrate
[2022-08-09 22:29:39.204] [info] migrating '/home/phil/.config/Brim/appState.json' => '/home/phil/.config/Zui/appState.json'
[2022-08-09 22:29:39.207] [info] migrating '/home/phil/.config/Brim/lake => /home/phil/.config/Zui/lake'
[2022-08-09 22:29:39.221] [info] migrating '/home/phil/.config/Brim/data => /home/phil/.config/Zui/data'
[2022-08-09 22:29:39.224] [info] migration completed
[2022-08-09 22:29:39.286] [info] migrations: currentVersion=202202170834 pending=2
[2022-08-09 22:29:39.287] [info] migrations: running
[2022-08-09 22:29:39.288] [info] migrations: currentVersion=202207270956

When trying to test that migration only ran once, I was reminded (as documented here) that with the RPM installer in particular, there's conflicts that have always required uninstalling an older version of Brim before installing a newer one, and the same turns out to be true when installing Zui while Brim is still installed. Therefore the test of bouncing back to Brim and adding data doesn't really apply here, though FWIW it worked ok on Ubuntu Linux as shown above.

For testing without legacy Brim present, the Zui log on first launch looked like:

[2022-08-09 22:32:53.887] [info] app paths: getAppPath=/opt/Zui/resources/app.asar userData=/home/phil/.config/Zui logs=/home/phil/.config/Zui/logs
[2022-08-09 22:32:53.978] [info] no brim data to migrate

...and test lakes and saved queries worked as expected.

@philrz
Copy link
Contributor

philrz commented Aug 10, 2022

That covers verification of all the platform permutations, and I think we're in good shape here. Thanks @mason-fish!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants