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

re-assign sagas from expunged Nexus instances #6215

Merged
merged 12 commits into from
Aug 16, 2024

Conversation

davepacheco
Copy link
Collaborator

Fixes #5136.

@davepacheco
Copy link
Collaborator Author

I've successfully tested this on a4x2 by:

  • setting up a 3-node cluster
  • adding a 4th node
  • putting only Nexus on that node
  • starting a "demo" saga on that Nexus
  • powering off the 4th node
  • expunging the 4th node
  • watching the demo saga get transferred to a different Nexus
  • completing the demo saga on that different Nexus

I'll do another run of this and post the full details.

In terms of automated tests: the underlying datastore function is tested, but there isn't really an end-to-end test here. I can't figure out a great way to do it with the infrastructure we have today. I spent most of today trying to write a test within the ControlPlaneTestContext framework that would insert a saga owned by a different Nexus and then execute a blueprint that shows that Nexus as expunged. I couldn't get to the point where it could successfully execute that blueprint that contains an expunged Nexus. The immediate problem is that the external networking step (the first step in blueprint execution) expects to find the expunged Nexus's external IP in the database, but that's after working around a bunch of other problems in gross ways. I'd welcome better ways to test this, especially since I did find a real bug during the manual testing, but I think the better investment is probably in automation that sets up a real environment (either on real hardware or a4x2) and provides primitives for operations like the above (e.g., setup rack, add sled, expunge sled, make requests to the internal or external APIs, etc.).

@davepacheco davepacheco marked this pull request as ready for review August 14, 2024 23:49
///
/// To reiterate, we are *not* considering the case where several SECs try
/// to update the same saga. That will be a future enhancement.
/// It's conceivable that multiple SECs do try to udpate the same saga
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed some of the paranoia here because it's going to be too complicated to make it continue to work and it does seem unnecessary at this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! When I looked at this approximately 2 months ago I had the same exact thought! I was hoping it wouldn't be a bone of contention (pardon the pun).

@davepacheco
Copy link
Collaborator Author

davepacheco commented Aug 15, 2024

Here's the testing on a4x2. I set up a4x2 from commit befc6c6 (on this PR branch) with THREE_NODE_RSS=true. Here's the initial blueprint:

# omdb nexus blueprints show current
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
blueprint  b1df6ba0-9223-471e-9cc7-68cd366edab0
parent:    <none>

  sled: 738986db-d4b8-4ef1-a684-2d61b43bb2d5

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    clickhouse        078d9ef0-58ca-4b0d-9c63-723f612551dd   in service    fd00:1122:3344:103::6
    cockroach_db      69147c2a-599a-4276-9f70-5c210aa4f27f   in service    fd00:1122:3344:103::3
    crucible          1698189c-7bf6-4875-b2ea-ad799aa47105   in service    fd00:1122:3344:103::9
    crucible          18e45ebf-c303-4493-beb6-00de847da1cd   in service    fd00:1122:3344:103::8
    crucible          3011b9bc-c7cf-40db-87ec-625b621fe586   in service    fd00:1122:3344:103::c
    crucible          3ad0b675-3e42-4b48-8089-a0443a4ca8c8   in service    fd00:1122:3344:103::a
    crucible          de80acf3-0a53-4cac-b60a-03463c540e9d   in service    fd00:1122:3344:103::b
    crucible_pantry   e9899ffb-0d52-4dc6-9394-aedcfdb7bdc2   in service    fd00:1122:3344:103::7
    external_dns      b774f8f9-5959-4693-9bfe-96a6a50c9411   in service    fd00:1122:3344:103::4
    internal_dns      a6eb60d1-e37d-4243-98ea-6a0950a1a0d6   in service    fd00:1122:3344:3::1  
    internal_ntp      41f69392-996b-46f6-8a02-bc2cece6724c   in service    fd00:1122:3344:103::d
    nexus             59d190f9-f0cc-4ed2-8f8b-92ac82c74946   in service    fd00:1122:3344:103::5



  sled: 799159e0-7480-48dd-bc1d-8bf2c2890815

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      a14e4d18-d813-4fb9-91d0-caa89f445ff2   in service    fd00:1122:3344:102::d
    cockroach_db      66d2c093-2de1-4194-91cc-ee0294259e16   in service    fd00:1122:3344:102::4
    cockroach_db      91a06d39-2b5b-4ff7-93f4-bbf9fdd5b2a1   in service    fd00:1122:3344:102::3
    crucible          1acedb2d-a9cf-4ef1-8863-35072ee43bae   in service    fd00:1122:3344:102::9
    crucible          2e513acf-3e1f-4a16-b857-0876b3fada49   in service    fd00:1122:3344:102::b
    crucible          4e05623e-bda4-496c-b6f7-7f43c225d36d   in service    fd00:1122:3344:102::a
    crucible          6e9d297f-41b3-4918-8299-f3e82fbacc87   in service    fd00:1122:3344:102::8
    crucible          f08c93ed-cd2d-410b-a8e5-c7dd75b83d1d   in service    fd00:1122:3344:102::c
    crucible_pantry   ebc72695-bc04-4978-af95-99309810fe4e   in service    fd00:1122:3344:102::7
    internal_dns      b25cb999-84bd-4fea-a477-f4ee5f1559c8   in service    fd00:1122:3344:2::1  
    nexus             0273812a-8307-4668-9139-7f11a561835c   in service    fd00:1122:3344:102::5
    oximeter          fa182f4d-b3da-4576-b877-b05e8d2b69bb   in service    fd00:1122:3344:102::6



  sled: af0b4361-821c-49af-a45e-5e8c0c915111

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      831f58b2-d199-4411-a822-e2b9b42f3346   in service    fd00:1122:3344:101::d
    cockroach_db      252fde62-fc86-41d7-9855-a2cc4cbba802   in service    fd00:1122:3344:101::3
    cockroach_db      256893b6-6abb-4264-9406-c933984984e4   in service    fd00:1122:3344:101::4
    crucible          02fa6dfc-9f92-4afa-be17-5dedf5c41239   in service    fd00:1122:3344:101::9
    crucible          4ed25940-fc88-4b02-aaf3-d2c1058256e5   in service    fd00:1122:3344:101::8
    crucible          562cd0ff-5ac8-4299-b344-4067e167fcb3   in service    fd00:1122:3344:101::c
    crucible          d8b24781-7d76-42bd-9a57-3b8701ba1c9d   in service    fd00:1122:3344:101::b
    crucible          e14925b4-a540-4394-9611-cebdd602cd37   in service    fd00:1122:3344:101::a
    crucible_pantry   3140373a-2d33-44d9-8a02-4553ea592b49   in service    fd00:1122:3344:101::7
    external_dns      6eb171c4-fcf9-45d2-8080-e3a1f630cf62   in service    fd00:1122:3344:101::5
    internal_dns      6494f35f-cb59-40b0-a9a6-a204f7e4fe76   in service    fd00:1122:3344:1::1  
    nexus             0f44bea0-2694-4cc0-8ad8-5be2bfd5d999   in service    fd00:1122:3344:101::6


 COCKROACHDB SETTINGS:
    state fingerprint:::::::::::::::::   d4d87aa2ad877a4cc2fddd0573952362739110de
    cluster.preserve_downgrade_option:   "22.1"

 METADATA:
    created by:::::::::::   RSS
    created at:::::::::::   2024-08-15T00:19:19.671Z
    comment::::::::::::::   initial blueprint from rack setup
    internal DNS version:   1
    external DNS version:   2

Now let's add that fourth sled:

root@oxz_switch:~ # omdb nexus sleds list-uninitialized
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
RACK_ID                              CUBBY SERIAL PART  REVISION 
5f8e5510-9bfc-4f35-9746-4be1abd3a243 2     g2     i86pc 0        

root@oxz_switch:~# omdb -w nexus sleds add g2 i86pc
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
added sled g2 (i86pc): db44640a-5c32-4e5a-a592-5a9a017409df

root@oxz_switch:~# omdb -w nexus blueprints regenerate
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
generated new blueprint 6e7d5642-fbc7-4be5-8910-4798464948ef

root@oxz_switch:~# omdb -w nexus blueprints diff current 6e7d5642-fbc7-4be5-8910-4798464948ef
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
from: blueprint b1df6ba0-9223-471e-9cc7-68cd366edab0
to:   blueprint 6e7d5642-fbc7-4be5-8910-4798464948ef

 UNCHANGED SLEDS:

  sled 738986db-d4b8-4ef1-a684-2d61b43bb2d5:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    clickhouse        078d9ef0-58ca-4b0d-9c63-723f612551dd   in service    fd00:1122:3344:103::6
    cockroach_db      69147c2a-599a-4276-9f70-5c210aa4f27f   in service    fd00:1122:3344:103::3
    crucible          1698189c-7bf6-4875-b2ea-ad799aa47105   in service    fd00:1122:3344:103::9
    crucible          18e45ebf-c303-4493-beb6-00de847da1cd   in service    fd00:1122:3344:103::8
    crucible          3011b9bc-c7cf-40db-87ec-625b621fe586   in service    fd00:1122:3344:103::c
    crucible          3ad0b675-3e42-4b48-8089-a0443a4ca8c8   in service    fd00:1122:3344:103::a
    crucible          de80acf3-0a53-4cac-b60a-03463c540e9d   in service    fd00:1122:3344:103::b
    crucible_pantry   e9899ffb-0d52-4dc6-9394-aedcfdb7bdc2   in service    fd00:1122:3344:103::7
    external_dns      b774f8f9-5959-4693-9bfe-96a6a50c9411   in service    fd00:1122:3344:103::4
    internal_dns      a6eb60d1-e37d-4243-98ea-6a0950a1a0d6   in service    fd00:1122:3344:3::1  
    internal_ntp      41f69392-996b-46f6-8a02-bc2cece6724c   in service    fd00:1122:3344:103::d
    nexus             59d190f9-f0cc-4ed2-8f8b-92ac82c74946   in service    fd00:1122:3344:103::5


  sled 799159e0-7480-48dd-bc1d-8bf2c2890815:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      a14e4d18-d813-4fb9-91d0-caa89f445ff2   in service    fd00:1122:3344:102::d
    cockroach_db      66d2c093-2de1-4194-91cc-ee0294259e16   in service    fd00:1122:3344:102::4
    cockroach_db      91a06d39-2b5b-4ff7-93f4-bbf9fdd5b2a1   in service    fd00:1122:3344:102::3
    crucible          1acedb2d-a9cf-4ef1-8863-35072ee43bae   in service    fd00:1122:3344:102::9
    crucible          2e513acf-3e1f-4a16-b857-0876b3fada49   in service    fd00:1122:3344:102::b
    crucible          4e05623e-bda4-496c-b6f7-7f43c225d36d   in service    fd00:1122:3344:102::a
    crucible          6e9d297f-41b3-4918-8299-f3e82fbacc87   in service    fd00:1122:3344:102::8
    crucible          f08c93ed-cd2d-410b-a8e5-c7dd75b83d1d   in service    fd00:1122:3344:102::c
    crucible_pantry   ebc72695-bc04-4978-af95-99309810fe4e   in service    fd00:1122:3344:102::7
    internal_dns      b25cb999-84bd-4fea-a477-f4ee5f1559c8   in service    fd00:1122:3344:2::1  
    nexus             0273812a-8307-4668-9139-7f11a561835c   in service    fd00:1122:3344:102::5
    oximeter          fa182f4d-b3da-4576-b877-b05e8d2b69bb   in service    fd00:1122:3344:102::6


  sled af0b4361-821c-49af-a45e-5e8c0c915111:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      831f58b2-d199-4411-a822-e2b9b42f3346   in service    fd00:1122:3344:101::d
    cockroach_db      252fde62-fc86-41d7-9855-a2cc4cbba802   in service    fd00:1122:3344:101::3
    cockroach_db      256893b6-6abb-4264-9406-c933984984e4   in service    fd00:1122:3344:101::4
    crucible          02fa6dfc-9f92-4afa-be17-5dedf5c41239   in service    fd00:1122:3344:101::9
    crucible          4ed25940-fc88-4b02-aaf3-d2c1058256e5   in service    fd00:1122:3344:101::8
    crucible          562cd0ff-5ac8-4299-b344-4067e167fcb3   in service    fd00:1122:3344:101::c
    crucible          d8b24781-7d76-42bd-9a57-3b8701ba1c9d   in service    fd00:1122:3344:101::b
    crucible          e14925b4-a540-4394-9611-cebdd602cd37   in service    fd00:1122:3344:101::a
    crucible_pantry   3140373a-2d33-44d9-8a02-4553ea592b49   in service    fd00:1122:3344:101::7
    external_dns      6eb171c4-fcf9-45d2-8080-e3a1f630cf62   in service    fd00:1122:3344:101::5
    internal_dns      6494f35f-cb59-40b0-a9a6-a204f7e4fe76   in service    fd00:1122:3344:1::1  
    nexus             0f44bea0-2694-4cc0-8ad8-5be2bfd5d999   in service    fd00:1122:3344:101::6


 ADDED SLEDS:

  sled db44640a-5c32-4e5a-a592-5a9a017409df:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
+   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_0
+   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_1
+   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_2
+   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_3
+   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_4


    omicron zones at generation 2:
    ------------------------------------------------------------------------------------------
    zone type      zone id                                disposition   underlay IP           
    ------------------------------------------------------------------------------------------
+   internal_ntp   a1add45d-c693-426e-811c-0aa173d0cc3f   in service    fd00:1122:3344:121::21


 COCKROACHDB SETTINGS:
    state fingerprint:::::::::::::::::   d4d87aa2ad877a4cc2fddd0573952362739110de (unchanged)
    cluster.preserve_downgrade_option:   "22.1" (unchanged)

 METADATA:
    internal DNS version:   1 (unchanged)
    external DNS version:   2 (unchanged)


root@oxz_switch:~# omdb -w nexus blueprints target set 6e7d5642-fbc7-4be5-8910-4798464948ef enabled
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
set target blueprint to 6e7d5642-fbc7-4be5-8910-4798464948ef

A few seconds later over on the new sled I see the new internal NTP zone:

root@g2:~# zoneadm list
global
oxz_ntp_a1add45d-c693-426e-811c-0aa173d0cc3f

To add a new Nexus zone, I'm going to use omdb db reconfigurator-save to extract all the Reconfigurator state and then use reconfigurator-cli (which I copied to this system for this) to edit the latest blueprint to add a new Nexus zone to that new sled.

root@oxz_switch:~# omdb db reconfigurator-save reconfigurator.out
note: database URL not specified.  Will search DNS.
note: (override with --db-url or OMDB_DB_URL)
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using database URL postgresql://root@[fd00:1122:3344:101::3]:32221,[fd00:1122:3344:101::4]:32221,[fd00:1122:3344:102::4]:32221,[fd00:1122:3344:103::3]:32221,[fd00:1122:3344:102::3]:32221/omicron?sslmode=disable
note: database schema version matches expected (86.0.0)
assembling reconfigurator state ... done
wrote reconfigurator.out

root@oxz_switch:~# ./reconfigurator-cli 
〉load reconfigurator.out
error: no collection_id specified and file contains 4 collections: ab73a6ad-be0a-4ce9-af1b-93406808ad34, c257f2e2-d5f9-4c9f-9003-fab59ac462f1, 10205b54-352d-48d8-b873-d94c1f36c579, 93a01434-0f4d-4152-8576-c2bdf9d1574d

〉load reconfigurator.out 93a01434-0f4d-4152-8576-c2bdf9d1574d
using collection 93a01434-0f4d-4152-8576-c2bdf9d1574d as source of sled inventory data
sled 738986db-d4b8-4ef1-a684-2d61b43bb2d5 loaded
sled 799159e0-7480-48dd-bc1d-8bf2c2890815 loaded
sled af0b4361-821c-49af-a45e-5e8c0c915111 loaded
sled db44640a-5c32-4e5a-a592-5a9a017409df loaded
collection ab73a6ad-be0a-4ce9-af1b-93406808ad34 loaded
collection c257f2e2-d5f9-4c9f-9003-fab59ac462f1 loaded
collection 10205b54-352d-48d8-b873-d94c1f36c579 loaded
collection 93a01434-0f4d-4152-8576-c2bdf9d1574d loaded
blueprint 6e7d5642-fbc7-4be5-8910-4798464948ef loaded
blueprint b1df6ba0-9223-471e-9cc7-68cd366edab0 loaded
loaded service IP pool ranges: [V4(Ipv4Range { first: 198.51.100.20, last: 198.51.100.29 })]
configured external DNS zone name: oxide.test
configured silo names: default-silo, recovery
internal DNS generations: 1, 2
external DNS generations: 2
loaded data from "reconfigurator.out"

〉blueprint-edit 6e7d5642-fbc7-4be5-8910-4798464948ef add-nexus db44640a-5c32-4e5a-a592-5a9a017409df
blueprint 516a3d0f-525f-40f4-a553-1f363f82f805 created from blueprint 6e7d5642-fbc7-4be5-8910-4798464948ef: added Nexus zone to sled db44640a-5c32-4e5a-a592-5a9a017409df

〉blueprint-save 516a3d0f-525f-40f4-a553-1f363f82f805 new-blueprint.out
saved blueprint 516a3d0f-525f-40f4-a553-1f363f82f805 to "new-blueprint.out"

〉

root@oxz_switch:~# omdb -w nexus blueprints import new-blueprint.out 
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
uploaded new blueprint 516a3d0f-525f-40f4-a553-1f363f82f805

root@oxz_switch:~# omdb -w nexus blueprints diff current 516a3d0f-525f-40f4-a553-1f363f82f805
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
from: blueprint 6e7d5642-fbc7-4be5-8910-4798464948ef
to:   blueprint 516a3d0f-525f-40f4-a553-1f363f82f805

 UNCHANGED SLEDS:

  sled 738986db-d4b8-4ef1-a684-2d61b43bb2d5:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    clickhouse        078d9ef0-58ca-4b0d-9c63-723f612551dd   in service    fd00:1122:3344:103::6
    cockroach_db      69147c2a-599a-4276-9f70-5c210aa4f27f   in service    fd00:1122:3344:103::3
    crucible          1698189c-7bf6-4875-b2ea-ad799aa47105   in service    fd00:1122:3344:103::9
    crucible          18e45ebf-c303-4493-beb6-00de847da1cd   in service    fd00:1122:3344:103::8
    crucible          3011b9bc-c7cf-40db-87ec-625b621fe586   in service    fd00:1122:3344:103::c
    crucible          3ad0b675-3e42-4b48-8089-a0443a4ca8c8   in service    fd00:1122:3344:103::a
    crucible          de80acf3-0a53-4cac-b60a-03463c540e9d   in service    fd00:1122:3344:103::b
    crucible_pantry   e9899ffb-0d52-4dc6-9394-aedcfdb7bdc2   in service    fd00:1122:3344:103::7
    external_dns      b774f8f9-5959-4693-9bfe-96a6a50c9411   in service    fd00:1122:3344:103::4
    internal_dns      a6eb60d1-e37d-4243-98ea-6a0950a1a0d6   in service    fd00:1122:3344:3::1  
    internal_ntp      41f69392-996b-46f6-8a02-bc2cece6724c   in service    fd00:1122:3344:103::d
    nexus             59d190f9-f0cc-4ed2-8f8b-92ac82c74946   in service    fd00:1122:3344:103::5


  sled 799159e0-7480-48dd-bc1d-8bf2c2890815:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      a14e4d18-d813-4fb9-91d0-caa89f445ff2   in service    fd00:1122:3344:102::d
    cockroach_db      66d2c093-2de1-4194-91cc-ee0294259e16   in service    fd00:1122:3344:102::4
    cockroach_db      91a06d39-2b5b-4ff7-93f4-bbf9fdd5b2a1   in service    fd00:1122:3344:102::3
    crucible          1acedb2d-a9cf-4ef1-8863-35072ee43bae   in service    fd00:1122:3344:102::9
    crucible          2e513acf-3e1f-4a16-b857-0876b3fada49   in service    fd00:1122:3344:102::b
    crucible          4e05623e-bda4-496c-b6f7-7f43c225d36d   in service    fd00:1122:3344:102::a
    crucible          6e9d297f-41b3-4918-8299-f3e82fbacc87   in service    fd00:1122:3344:102::8
    crucible          f08c93ed-cd2d-410b-a8e5-c7dd75b83d1d   in service    fd00:1122:3344:102::c
    crucible_pantry   ebc72695-bc04-4978-af95-99309810fe4e   in service    fd00:1122:3344:102::7
    internal_dns      b25cb999-84bd-4fea-a477-f4ee5f1559c8   in service    fd00:1122:3344:2::1  
    nexus             0273812a-8307-4668-9139-7f11a561835c   in service    fd00:1122:3344:102::5
    oximeter          fa182f4d-b3da-4576-b877-b05e8d2b69bb   in service    fd00:1122:3344:102::6


  sled af0b4361-821c-49af-a45e-5e8c0c915111:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      831f58b2-d199-4411-a822-e2b9b42f3346   in service    fd00:1122:3344:101::d
    cockroach_db      252fde62-fc86-41d7-9855-a2cc4cbba802   in service    fd00:1122:3344:101::3
    cockroach_db      256893b6-6abb-4264-9406-c933984984e4   in service    fd00:1122:3344:101::4
    crucible          02fa6dfc-9f92-4afa-be17-5dedf5c41239   in service    fd00:1122:3344:101::9
    crucible          4ed25940-fc88-4b02-aaf3-d2c1058256e5   in service    fd00:1122:3344:101::8
    crucible          562cd0ff-5ac8-4299-b344-4067e167fcb3   in service    fd00:1122:3344:101::c
    crucible          d8b24781-7d76-42bd-9a57-3b8701ba1c9d   in service    fd00:1122:3344:101::b
    crucible          e14925b4-a540-4394-9611-cebdd602cd37   in service    fd00:1122:3344:101::a
    crucible_pantry   3140373a-2d33-44d9-8a02-4553ea592b49   in service    fd00:1122:3344:101::7
    external_dns      6eb171c4-fcf9-45d2-8080-e3a1f630cf62   in service    fd00:1122:3344:101::5
    internal_dns      6494f35f-cb59-40b0-a9a6-a204f7e4fe76   in service    fd00:1122:3344:1::1  
    nexus             0f44bea0-2694-4cc0-8ad8-5be2bfd5d999   in service    fd00:1122:3344:101::6


 MODIFIED SLEDS:

  sled db44640a-5c32-4e5a-a592-5a9a017409df:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_4


    omicron zones generation 2 -> 3:
    ------------------------------------------------------------------------------------------
    zone type      zone id                                disposition   underlay IP           
    ------------------------------------------------------------------------------------------
    internal_ntp   a1add45d-c693-426e-811c-0aa173d0cc3f   in service    fd00:1122:3344:121::21
+   nexus          6a7ffaad-0a55-446b-bec2-35e48d953e56   in service    fd00:1122:3344:121::22


 COCKROACHDB SETTINGS:
    state fingerprint:::::::::::::::::   d4d87aa2ad877a4cc2fddd0573952362739110de (unchanged)
    cluster.preserve_downgrade_option:   "22.1" (unchanged)

 METADATA:
    internal DNS version:   1 (unchanged)
    external DNS version:   2 (unchanged)

root@oxz_switch:~# omdb -w nexus blueprints target set 516a3d0f-525f-40f4-a553-1f363f82f805 inherit
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
set target blueprint to 516a3d0f-525f-40f4-a553-1f363f82f805

A few seconds later, over on the new sled:

root@g2:~# zoneadm list
global
oxz_ntp_a1add45d-c693-426e-811c-0aa173d0cc3f
oxz_nexus_6a7ffaad-0a55-446b-bec2-35e48d953e56

Great -- we have the new Nexus zone. Based on the blueprint diff output we can expect its Nexus internal URL is http://[fd00:1122:3344:121::22]:12221/. Let's start a demo saga on that Nexus specifically:

root@oxz_switch:~# omdb -w nexus --nexus-internal-url http://[fd00:1122:3344:121::22]:12221/ sagas demo-create
note: using Nexus URL http://[fd00:1122:3344:121::22]:12221/
saga id:      34bb366a-40a2-46ac-bebf-7f68b19b65ab
demo saga id: b35ecefa-8b7e-45a0-ba9f-2f2c4e03bc97 (use this with `demo-complete`)

root@oxz_switch:~# omdb nexus --nexus-internal-url http://[fd00:1122:3344:121::22]:12221/ sagas list
note: using Nexus URL http://[fd00:1122:3344:121::22]:12221/
NOTE: This command only reads in-memory state from the targeted Nexus instance.
Sagas may be missing if they were run by a different Nexus instance or if they
finished before this Nexus instance last started up.
SAGA_ID                              STATE   
34bb366a-40a2-46ac-bebf-7f68b19b65ab running 

Great. Now let's expunge that sled. First I'll power it off from its console:

root@g2:~# poweroff
Aug 15 02:11:30 unknown poweroff: initiated by root on /dev/console
poweroff: Halting 2 zones.
poweroff: Completing system halt.
Aug 15 02:11:41 unknown rpcbind: rpcbind terminating on signal 15.
Aug 15 02:11:41 unknown syslogd: going down on signal 15
syncing file systems... done

then do the expungement. I'm overriding the warnings because I don't want to wait for an inventory collection. (It might also be necessary to specify a different Nexus URL explicitly, if DNS would happen to pick the one we just powered off. It wasn't a problem for me.)

root@oxz_switch:~# omdb -w nexus sleds expunge db44640a-5c32-4e5a-a592-5a9a017409df
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
note: database URL not specified.  Will search DNS.
note: (override with --db-url or OMDB_DB_URL)
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using database URL postgresql://root@[fd00:1122:3344:101::3]:32221,[fd00:1122:3344:101::4]:32221,[fd00:1122:3344:102::4]:32221,[fd00:1122:3344:103::3]:32221,[fd00:1122:3344:102::3]:32221/omicron?sslmode=disable
WARN: found schema version 86.0.0, expected 87.0.0
It's possible the database is running a version that's different from what this
tool understands.  This may result in errors or incorrect output.
WARNING: sled db44640a-5c32-4e5a-a592-5a9a017409df is PRESENT in the most recent inventory collection (spotted at 2024-08-15 02:11:06.109809 UTC). It is dangerous to expunge a sled that is still running. Are you sure you want to proceed anyway?
y/N〉y
WARNING: This operation will PERMANENTLY and IRRECOVABLY mark sled db44640a-5c32-4e5a-a592-5a9a017409df (g2) expunged. To proceed, type the sled's serial number.
sled serial number〉g2
expunged sled db44640a-5c32-4e5a-a592-5a9a017409df (previous policy: InService(Provisionable))

root@oxz_switch:~# omdb -w nexus blueprints diff current 4e863f6a-04a4-4be7-9767-902b9e28b72f
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
from: blueprint 516a3d0f-525f-40f4-a553-1f363f82f805
to:   blueprint 4e863f6a-04a4-4be7-9767-902b9e28b72f

 UNCHANGED SLEDS:

  sled 738986db-d4b8-4ef1-a684-2d61b43bb2d5:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g3_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    clickhouse        078d9ef0-58ca-4b0d-9c63-723f612551dd   in service    fd00:1122:3344:103::6
    cockroach_db      69147c2a-599a-4276-9f70-5c210aa4f27f   in service    fd00:1122:3344:103::3
    crucible          1698189c-7bf6-4875-b2ea-ad799aa47105   in service    fd00:1122:3344:103::9
    crucible          18e45ebf-c303-4493-beb6-00de847da1cd   in service    fd00:1122:3344:103::8
    crucible          3011b9bc-c7cf-40db-87ec-625b621fe586   in service    fd00:1122:3344:103::c
    crucible          3ad0b675-3e42-4b48-8089-a0443a4ca8c8   in service    fd00:1122:3344:103::a
    crucible          de80acf3-0a53-4cac-b60a-03463c540e9d   in service    fd00:1122:3344:103::b
    crucible_pantry   e9899ffb-0d52-4dc6-9394-aedcfdb7bdc2   in service    fd00:1122:3344:103::7
    external_dns      b774f8f9-5959-4693-9bfe-96a6a50c9411   in service    fd00:1122:3344:103::4
    internal_dns      a6eb60d1-e37d-4243-98ea-6a0950a1a0d6   in service    fd00:1122:3344:3::1  
    internal_ntp      41f69392-996b-46f6-8a02-bc2cece6724c   in service    fd00:1122:3344:103::d
    nexus             59d190f9-f0cc-4ed2-8f8b-92ac82c74946   in service    fd00:1122:3344:103::5


  sled 799159e0-7480-48dd-bc1d-8bf2c2890815:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g1_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      a14e4d18-d813-4fb9-91d0-caa89f445ff2   in service    fd00:1122:3344:102::d
    cockroach_db      66d2c093-2de1-4194-91cc-ee0294259e16   in service    fd00:1122:3344:102::4
    cockroach_db      91a06d39-2b5b-4ff7-93f4-bbf9fdd5b2a1   in service    fd00:1122:3344:102::3
    crucible          1acedb2d-a9cf-4ef1-8863-35072ee43bae   in service    fd00:1122:3344:102::9
    crucible          2e513acf-3e1f-4a16-b857-0876b3fada49   in service    fd00:1122:3344:102::b
    crucible          4e05623e-bda4-496c-b6f7-7f43c225d36d   in service    fd00:1122:3344:102::a
    crucible          6e9d297f-41b3-4918-8299-f3e82fbacc87   in service    fd00:1122:3344:102::8
    crucible          f08c93ed-cd2d-410b-a8e5-c7dd75b83d1d   in service    fd00:1122:3344:102::c
    crucible_pantry   ebc72695-bc04-4978-af95-99309810fe4e   in service    fd00:1122:3344:102::7
    internal_dns      b25cb999-84bd-4fea-a477-f4ee5f1559c8   in service    fd00:1122:3344:2::1  
    nexus             0273812a-8307-4668-9139-7f11a561835c   in service    fd00:1122:3344:102::5
    oximeter          fa182f4d-b3da-4576-b877-b05e8d2b69bb   in service    fd00:1122:3344:102::6


  sled af0b4361-821c-49af-a45e-5e8c0c915111:

    physical disks at generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_0
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_1
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_2
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_3
    synthetic-vendor   synthetic-model-U2   synthetic-serial-g0_4


    omicron zones at generation 5:
    --------------------------------------------------------------------------------------------
    zone type         zone id                                disposition   underlay IP          
    --------------------------------------------------------------------------------------------
    boundary_ntp      831f58b2-d199-4411-a822-e2b9b42f3346   in service    fd00:1122:3344:101::d
    cockroach_db      252fde62-fc86-41d7-9855-a2cc4cbba802   in service    fd00:1122:3344:101::3
    cockroach_db      256893b6-6abb-4264-9406-c933984984e4   in service    fd00:1122:3344:101::4
    crucible          02fa6dfc-9f92-4afa-be17-5dedf5c41239   in service    fd00:1122:3344:101::9
    crucible          4ed25940-fc88-4b02-aaf3-d2c1058256e5   in service    fd00:1122:3344:101::8
    crucible          562cd0ff-5ac8-4299-b344-4067e167fcb3   in service    fd00:1122:3344:101::c
    crucible          d8b24781-7d76-42bd-9a57-3b8701ba1c9d   in service    fd00:1122:3344:101::b
    crucible          e14925b4-a540-4394-9611-cebdd602cd37   in service    fd00:1122:3344:101::a
    crucible_pantry   3140373a-2d33-44d9-8a02-4553ea592b49   in service    fd00:1122:3344:101::7
    external_dns      6eb171c4-fcf9-45d2-8080-e3a1f630cf62   in service    fd00:1122:3344:101::5
    internal_dns      6494f35f-cb59-40b0-a9a6-a204f7e4fe76   in service    fd00:1122:3344:1::1  
    nexus             0f44bea0-2694-4cc0-8ad8-5be2bfd5d999   in service    fd00:1122:3344:101::6


 MODIFIED SLEDS:

  sled db44640a-5c32-4e5a-a592-5a9a017409df:

    physical disks from generation 1:
    -------------------------------------------------------------
    vendor             model                serial               
    -------------------------------------------------------------
-   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_0
-   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_1
-   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_2
-   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_3
-   synthetic-vendor   synthetic-model-U2   synthetic-serial-g2_4


    omicron zones generation 3 -> 4:
    -------------------------------------------------------------------------------------------
    zone type      zone id                                disposition    underlay IP           
    -------------------------------------------------------------------------------------------
*   internal_ntp   a1add45d-c693-426e-811c-0aa173d0cc3f   - in service   fd00:1122:3344:121::21
     └─                                                   + expunged                           
*   nexus          6a7ffaad-0a55-446b-bec2-35e48d953e56   - in service   fd00:1122:3344:121::22
     └─                                                   + expunged                           


 COCKROACHDB SETTINGS:
    state fingerprint:::::::::::::::::   d4d87aa2ad877a4cc2fddd0573952362739110de (unchanged)
    cluster.preserve_downgrade_option:   "22.1" (unchanged)

 METADATA:
*   internal DNS version:   1 -> 3
*   external DNS version:   2 -> 3

root@oxz_switch:~# omdb -w nexus blueprints target set 4e863f6a-04a4-4be7-9767-902b9e28b72f inherit
note: Nexus URL not specified.  Will pick one from DNS.
note: using DNS server for subnet fd00:1122:3344::/48
note: (if this is not right, use --dns-server to specify an alternate DNS server)
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
set target blueprint to 4e863f6a-04a4-4be7-9767-902b9e28b72f

All of that is just the setup. The key is that having done this, we should now see that our demo saga moved over to the Nexus that first executed that latest blueprint, which is probably the one on which I just set it as the target. Let's look:

root@oxz_switch:~# omdb nexus --nexus-internal-url http://[fd00:1122:3344:101::6]:12221 sagas list
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
NOTE: This command only reads in-memory state from the targeted Nexus instance.
Sagas may be missing if they were run by a different Nexus instance or if they
finished before this Nexus instance last started up.
SAGA_ID                              STATE   
34bb366a-40a2-46ac-bebf-7f68b19b65ab running 

Great! Now we should be able to complete it on the new Nexus:

root@oxz_switch:~# omdb -w nexus --nexus-internal-url http://[fd00:1122:3344:101::6]:12221 sagas demo-complete b35ecefa-8b7e-45a0-ba9f-2f2c4e03bc97
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221

root@oxz_switch:~# omdb nexus --nexus-internal-url http://[fd00:1122:3344:101::6]:12221 sagas list
note: using Nexus URL http://[fd00:1122:3344:101::6]:12221
NOTE: This command only reads in-memory state from the targeted Nexus instance.
Sagas may be missing if they were run by a different Nexus instance or if they
finished before this Nexus instance last started up.
SAGA_ID                              STATE     
34bb366a-40a2-46ac-bebf-7f68b19b65ab succeeded 

Success!

Copy link
Contributor

@andrewjstone andrewjstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

///
/// To reiterate, we are *not* considering the case where several SECs try
/// to update the same saga. That will be a future enhancement.
/// It's conceivable that multiple SECs do try to udpate the same saga
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! When I looked at this approximately 2 months ago I had the same exact thought! I was hoping it wouldn't be a bone of contention (pardon the pun).

let now = chrono::Utc::now();
let conn = self.pool_connection_authorized(opctx).await?;

// It would be more robust to do this in batches. However, Diesel does
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at diesel side-eyed again 🙄

pub async fn sagas_reassign_sec(
&self,
opctx: &OpContext,
nexus_zone_ids: &[db::saga_types::SecId],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call them nexus_zone_ids and not current_sec_ids or similar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was a little self-inconsistent. I've changed this in 87e5718 and updated the comment so it's less flip-flopping between Nexus ids and SEC ids.

/// activate the saga recovery background task after calling this function
/// to immediately resume the newly-assigned sagas.
///
/// **Warning:** This operation is only safe if the Nexus instances
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth checking that the the nexus zone is expunged here to prevent an issue? On the one hand this seems like a good safety check. On the other hand it seems like we may also end up assigning sagas to another nexus of the same version during rolling upgrade if we don't want to actually wait to drain them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be nice but I think it's way beyond the scope of this layer. The datastore doesn't know anything about blueprints, expungement, etc. Its caller could, but it's so simple that I don't think an extra check would help:
https://github.com/oxidecomputer/omicron/pull/6215/files#diff-5a1edb7bfa049a98af5ba0e05a8c2455bb637d63d8e59ed738a8e78bd6342ed7R38-R51

let params = steno::SagaCreateParams {
id: steno::SagaId(Uuid::new_v4()),
name: steno::SagaName::new("tewst saga"),
dag: serde_json::value::Value::Null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never thought about how handy a Null dag would be :)

}
println!("sagas to insert: {:?}", sagas_to_insert);

// These two sets are complements, but we write out the conditions to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. It makes the test really clear beyond the description above!

@davepacheco davepacheco enabled auto-merge (squash) August 16, 2024 22:49
@davepacheco davepacheco merged commit 8e4ac4c into main Aug 16, 2024
22 checks passed
@davepacheco davepacheco deleted the dap/drafts/saga-reassignment branch August 16, 2024 23:37
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 this pull request may close these issues.

nexus expungement: assign an old Nexus instance's sagas to another Nexus instance
2 participants