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

Prevent extra unnecessary reconfig events #3671

Merged
merged 9 commits into from
Aug 11, 2022
Merged

Conversation

vicky-g
Copy link
Contributor

@vicky-g vicky-g commented Aug 10, 2022

Description

There were unnecessary reconfig events being made. To prevent this from happening, we have to pass in the old replica set and call the fn that requires passing in the old replica set.

Tests

  1. Created user
  2. Uploaded 2 tracks
  3. Checked existing replica set
  4. Stopped a secondary
  5. Waited to see if user got rolled onto another secondary
  6. Confirmed that one of user's replica set nodes successfully rolled onto another secondary
{"name":"audius_creator_node","hostname":"baf7882f9f52","pid":26576,"queue":"update-replica-set-queue","jobId":"2","level":30,"msg":"[_issueUpdateReplicaSetOp] Reconfig SUCCESS: userId=2 wallet=0x3ce45ff75ed2e9e8439dbc57e835bc37bcedd0a2 old replica set=[http://cn2_creator-node_1:4001,http://cn3_creator-node_1:4002,http://cn4_creator-node_1:4003] | new replica set=[http://cn2_creator-node_1:4001,http://cn3_creator-node_1:4002,http://cn1_creator-node_1:4000] | reconfig type=[ONE_SECONDARY]","time":"2022-08-10T21:51:49.014Z","v":0,"logLevel":"info"}
  1. Confirmed that the other user's replica set node did not roll onto another secondary
{"name":"audius_creator_node","hostname":"7af26083da6e","pid":10184,"queue":"update-replica-set-queue","jobId":"1","level":30,"msg":"[_issueUpdateReplicaSetOp] skipping updateReplicaSet as reconfig already occurred for userId=2 wallet=0x3ce45ff75ed2e9e8439dbc57e835bc37bcedd0a2","time":"2022-08-10T21:52:27.790Z","v":0,"logLevel":"info"}

Monitoring - How will this change be monitored? Are there sufficient logs / alerts?

See logs surrounding _issueUpdateReplicaSetOp.

Followups

  • can we make this smarter than letting the txn fail? we will see 5 retries that are useless. maybe we can also instead check the replica set on chain instead of making an extra reconfig call

Copy link
Contributor

@dmanjunath dmanjunath left a comment

Choose a reason for hiding this comment

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

Great catch! Looks good to me but will let @SidSethi give the ✅ as well because i'm not as familiar with this flow as he is

Copy link
Contributor

@SidSethi SidSethi left a comment

Choose a reason for hiding this comment

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

huge find 💪
few small things, otherwise looks great

const oldSecondary1SpId =
ContentNodeInfoManager.getCNodeEndpointToSpIdMap()[secondary1]
const oldSecondary2SpId =
ContentNodeInfoManager.getCNodeEndpointToSpIdMap()[secondary2]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

const {
  primary: oldPrimarySpId,
  secondary1: oldSecondary1SpId,
  secondary2: oldSecondary2SpId
} = ContentNodeInfoManager.getCNodeEndpointToSpIdMap()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we can do this? getCNodeEndpointToSpIdMap returns an object with keys as the endpoints

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah my b, i meant this

const {
  [primary]: oldPrimarySpId,
  [secondary1]: oldSecondary1SpId,
  [secondary2]: oldSecondary2SpId
} = ContentNodeInfoManager.getCNodeEndpointToSpIdMap()

also like, this is a nit haha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh wow lol I didnt know this was possible! ok ill update it

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah its dope

)

response.issuedReconfig = true
logger.info(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit can we make this logger.warn or .error for easier loggly filtering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm I feel like this shouldn't be a warn or error log though? like if this update reconfig happens successfully, then all is well? we should be filtering by the log instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

whoops i meant to put this comment on line 527

logger.info(
          `[_issueUpdateReplicaSetOp] skipping _updateReplicaSet as reconfig already occurred for userId=${userId} wallet=${wallet}`
        )

@vicky-g vicky-g requested a review from SidSethi August 11, 2022 16:28
Copy link
Contributor

@SidSethi SidSethi left a comment

Choose a reason for hiding this comment

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

idk if blocked on my re-approval but this is good to go, all my comments are your call, can merge either way

@vicky-g vicky-g merged commit e01c91c into master Aug 11, 2022
@vicky-g vicky-g deleted the vg-fix-extra-reconfig branch August 11, 2022 20:00
audius-infra pushed a commit that referenced this pull request Aug 12, 2022
## Changelog

- 2022-08-12 [c38a6a8] Update @solana/spl-token to 0.1.8 (#3689) [Marcus Pasell]
- 2022-08-12 [587b38e] CON-327 Miscellaneous secondarySyncFromPrimary() improvements to logic + metric tracking (#3678) [Sid Sethi]
- 2022-08-12 [1afa5d5] [CON-324] Add orphaned data recovery queue (#3680) [Theo Ilie]
- 2022-08-12 [10599f4] Handle zero error code (#3686) [Saliou Diallo]
- 2022-08-12 [2346960] Use abuse error codes in relay (#3683) [Raymond Jacobson]
- 2022-08-12 [c3f578e] populate save_count in feed endpoint (#3684) [Steve Perkins]
- 2022-08-11 [5e6217f] Revert "[PLAT-259] Upgrade EthereumTx version (#3606)" (#3682) [Raymond Jacobson]
- 2022-08-11 [a44aad2] Fix bad notifs (#3681) [Saliou Diallo]
- 2022-08-11 [23a6c3b] [PAY-485][PAY-491] Handle premium content signature (#3610) [Saliou Diallo]
- 2022-08-11 [a478a1d] [PAY-459] Add dethroned notifications on Identity (#3674) [Michael Piazza]
- 2022-08-11 [8fb6084] Add a log before force resync happen (#3677) [vicky :)]
- 2022-08-11 [47f55f4] [PAY-506] Exposes AAO error code (#3662) [Reed]
- 2022-08-11 [4bc58cf] Filter out notifications from bad initiators (#3676) [Saliou Diallo]
- 2022-08-11 [e01c91c] Prevent extra unnecessary reconfig events (#3671) [vicky :)]
- 2022-08-11 [cff11a9] Fix downgrades (#3667) [Joseph Lee]
- 2022-08-11 [424ff50] Add disable flag to logspout (#3672) [Dheeraj Manjunath]
- 2022-08-11 [bac7669] Bump sdk to v0.0.33 [audius-infra]
audius-infra pushed a commit that referenced this pull request Aug 12, 2022
## Changelog

- 2022-08-12 [c38a6a8] Update @solana/spl-token to 0.1.8 (#3689) [Marcus Pasell]
- 2022-08-12 [587b38e] CON-327 Miscellaneous secondarySyncFromPrimary() improvements to logic + metric tracking (#3678) [Sid Sethi]
- 2022-08-12 [1afa5d5] [CON-324] Add orphaned data recovery queue (#3680) [Theo Ilie]
- 2022-08-12 [10599f4] Handle zero error code (#3686) [Saliou Diallo]
- 2022-08-12 [2346960] Use abuse error codes in relay (#3683) [Raymond Jacobson]
- 2022-08-12 [c3f578e] populate save_count in feed endpoint (#3684) [Steve Perkins]
- 2022-08-11 [5e6217f] Revert "[PLAT-259] Upgrade EthereumTx version (#3606)" (#3682) [Raymond Jacobson]
- 2022-08-11 [a44aad2] Fix bad notifs (#3681) [Saliou Diallo]
- 2022-08-11 [23a6c3b] [PAY-485][PAY-491] Handle premium content signature (#3610) [Saliou Diallo]
- 2022-08-11 [a478a1d] [PAY-459] Add dethroned notifications on Identity (#3674) [Michael Piazza]
- 2022-08-11 [8fb6084] Add a log before force resync happen (#3677) [vicky :)]
- 2022-08-11 [47f55f4] [PAY-506] Exposes AAO error code (#3662) [Reed]
- 2022-08-11 [4bc58cf] Filter out notifications from bad initiators (#3676) [Saliou Diallo]
- 2022-08-11 [e01c91c] Prevent extra unnecessary reconfig events (#3671) [vicky :)]
- 2022-08-11 [cff11a9] Fix downgrades (#3667) [Joseph Lee]
- 2022-08-11 [424ff50] Add disable flag to logspout (#3672) [Dheeraj Manjunath]
- 2022-08-11 [bac7669] Bump sdk to v0.0.33 [audius-infra]
dmanjunath pushed a commit that referenced this pull request Aug 16, 2022
* prevent extra unnecessary reconfig events

* update err msg to not double print logs

* update err log

* lower health check cache ttl

* add a shouldReconfig check

* fix test

* rename to canReconfig

* use Logger instead of any

* update fetch spIDs
sliptype pushed a commit that referenced this pull request Sep 10, 2023
[4a26077] [C-2678] Add Stems and Source Files Modal (#3671) Andrew Mendelsohn
[6a3342a] Bump android version to 1.1.391 to fix play-store build (#3678) Dylan Jeffers
[2064212] [C-2813] Catch collectibles runtime errors (#3675) Dylan Jeffers
[29233ea] [C-2808] Improve storageNodeSelector usage and perf (#3674) Dylan Jeffers
[2de2035] Fix mobile image uri (#3670) Dylan Jeffers
[55a6089] [C-2807] Add ModalField subforms with cancellation (#3664) Andrew Mendelsohn
[e26986f] [C-2812] Use storageNodeSelector in libs, fix mobile images (#3667) Dylan Jeffers
[5daea08] Enable playlist updates on prod (#3668) Dylan Jeffers
[d90c369] [PAY-1541] Autofocus textinput on mobile search users screen (#3666) Reed
[194f894] [PAY-1542][PAY-1539][PAY-1537] Mobile chats QA improvements (#3665) Reed
[58b9028] [C-2798] Fix playlist button overlap (#3662) Dylan Jeffers
[a935588] [PAY-1538] Fix autocorrect behavior (#3661) Michael Piazza
[1a8a6e7] [PAY-1518] DMs: Align the overflow menu bottom center (#3654) Marcus Pasell
[c880b2a] [plat-1085] disable fav and repost on hidden tracks in play bar (#3653) sabrina-kiam
[d80617e] [PAY-1529] Add initial types for usdc purchases (#3651) Randy Schott
[68e87ff] [C-2787] Reregister device-token on app startup (#3660) Dylan Jeffers
[ddfa510] [C-2802] Move embed to client monorepo! (#3659) Raymond Jacobson
[6a2f008] Add Sentry error logging to Audius query C-2800 (#3656) nicoback2
[79213de] Add Amplitude events to new Write OAuth flows C-2801 (#3657) nicoback2
[6576ae4] Fix android chat message cut off at top (#3658) Reed
[160b325] [C-2677] Remix Settings Modal layout complete (#3647) Andrew Mendelsohn
[c01c022] [C-2790] Add private DogEar to desktop playlist cards (#3655) Dylan Jeffers
[50e8f4e] [PAY-1522][PAY-1451] Fix issues with DMs notification dot (#3649) Michael Piazza
[1658810] [PAY-1530] adds usdc feature flag and hooks for fetching it (#3645) Randy Schott
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants