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

routing: Namespaced Mission Control #9001

Open
wants to merge 8 commits into
base: elle-reduceMCEncoding
Choose a base branch
from

Conversation

ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Aug 13, 2024

This PR:

  • migrates the Mission control store so that all existing entries are moved to a new "default" namespace sub-bucket.
  • The MissionControlManager now handles returning mission control instances based on namespace.

With this PR we still only use the default namespace, but this is a starting point for starting to make use of other namespaces. A follow up could add functionality to combine the results of 2 or more on-disk namespaces into one in-memory.

Required for #8991 where we will want to report MC results in a different (non payment related) namespace.
Addresses part of #7812
Addresses part of #8849

Depends on #8911

Visual

MC DB structure currently:

missioncontrol-results ---> < result ID 1> --> <encoded result 1> 
                       ---> < result ID 2> --> <encoded result 2> 
                       ---> < result ID 3> --> <encoded result 3> 
                                        .....

MC DB structure after this PR:

missioncontrol-results ---> "default" ---> < result ID 1> --> <encoded result 1> 
                                      ---> < result ID 2> --> <encoded result 2> 
                                      ---> < result ID 3> --> <encoded result 3> 
                                                      .....

Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Important

Review skipped

Auto reviews are limited to specific labels.

Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ellemouton
Copy link
Collaborator Author

ellemouton commented Aug 14, 2024

Note: this is currently stacked on top of #8911 just to make my life easier for building on top of these 2 together but there is no actual dependency on that PR. So if this gets approved before that one, I can switch the order of dependencies (although, I think performance wise, it makes sense to get #8911 in first since it will make the size of the result blobs way smaller).

@ellemouton ellemouton changed the title MC: Namespaced Mission Control routing: Namespaced Mission Control Aug 14, 2024
@lightninglabs-deploy
Copy link

@guggero: review reminder

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Very nice! Only small comments, everything's very straightforward 🚀

routing/missioncontrol.go Show resolved Hide resolved
routing/missioncontrol_store.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Outdated Show resolved Hide resolved
routing/router_test.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Show resolved Hide resolved
So that `missionControlStore` can be unaware of the backing DB structure
it is writing to. In an upcoming commit when we change mission control
to write to namespaced buckets instead, we then only need to update the
`namespacedDB` implementation.
In this commit, the mission control store is migrated such that all
existing pairs which are currently stored directly in the top level
results bucket are now instead moved to a "default" namespace bucket.

Note that this migration is not yet invoked in this commit. The
migration will be invoked in the same commit that starts writing and
reading the new format.
and invoke the associated mission control migration.
Only the MissionControl instance should use this variable and it should
not be accessible to users of MissionControl.
This commit renames the previous MissionControl to MissionController and
the previous MissionController interface to MissionControlQuerier. This
is done because soon the (new) MissionController will back multiple
namespaced MissionControl instances.  For now, it just houses a single
MissionControl in the default namespace.

This commit also replaces the MissionControl's `now` function with a
`clock.Clock`.
Copy link
Collaborator Author

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

Wohoooo thanks @guggero 🚀

routing/missioncontrol.go Show resolved Hide resolved
routing/missioncontrol_store.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Outdated Show resolved Hide resolved
routing/missioncontrol.go Show resolved Hide resolved
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM and tACK 🎉

Ran this on a copy of my mainnet node with 474 entries, migration was super fast (for both migration 32 and 33):

2024-09-16 13:00:12.172 [INF] CHDB: Checking for schema update: latest_version=33, db_version=31
2024-09-16 13:00:12.172 [INF] CHDB: Performing database schema migration
2024-09-16 13:00:12.172 [INF] CHDB: Applying migration #32
2024-09-16 13:00:12.172 [INF] CHDB: Migrating Mission Control store to use a more minimal encoding for routes
2024-09-16 13:00:12.192 [INF] CHDB: Applying migration #33
2024-09-16 13:00:12.192 [INF] CHDB: Migrating Mission Control store to use namespaced results
2024-09-16 13:00:12.200 [INF] CHDB: Checking for optional update: prune_revocation_log=false, db_version=0: prune revocation log
2024-09-16 13:00:12.201 [INF] LTND: Database(s) now open (time_to_open=1.772583823s)!

...

2024-09-16 13:00:16.431 [DBG] CRTR: Instantiating mission control with config: maximum history: 1000, minimum failure relax interval: 1m0s, estimator type: apriori, penalty halflife time: 1h0m0s, apriori hop probability: 0.6, apriori weight: 0.5, previous success probability: 0.95, capacity fraction: 0.9999
2024-09-16 13:00:16.432 [INF] CRTR: Loaded 474 mission control entries
2024-09-16 13:00:16.432 [DBG] CRTR: [default]: Mission control state reconstruction started
2024-09-16 13:00:16.437 [DBG] CRTR: [default]: Reporting pair success to Mission Control: pair=0256812a1cb2539a5500f3c1c20db5ed7626e3878a552e3356c032c7bec2b3060e -> 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f, amt=75403539 mSAT
2024-09-16 13:00:16.437 [DBG] CRTR: Setting 0256812a1cb2539a5500f3c1c20db5ed7626e3878a552e3356c032c7bec2b3060e->03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f range to [75403539 mSAT-0 mSAT]
2024-09-16 13:00:16.437 [DBG] CRTR: [default]: Reporting pair success to Mission Control: pair=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f -> 032795584d041034d0daec6c048be786bb566282a9e275ca6b22085598dc6db71e, amt=75395000 mSAT

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration mission control size/kilo medium, proper context needed, less than 1000 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants