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

fix: Enable autosharding in any cluster #2505

Merged
merged 2 commits into from
Mar 13, 2024
Merged

Conversation

alrevuelta
Copy link
Contributor

@alrevuelta alrevuelta commented Mar 5, 2024

Description

  • Removes hardcoding of amount of shards.
  • Removes hardcoding of cluster-id with enabled autosharding.
  • This enables any cluster-id != 1 to i) have autosharding if desired and ii) have whatever amount of shards they want.

For example, this PR enables the following. Creating a cluster-id=10 with 4 shards, where the node only subscribed to 0, 1

./build/wakunode2\
  --rest=true\
  --log-level=DEBUG\
  --relay=true\
  --pubsub-topic=/waku/2/rs/10/0\
  --pubsub-topic=/waku/2/rs/10/1\
  --pubsub-topic=/waku/2/rs/10/2\
  --pubsub-topic=/waku/2/rs/10/3\
  --cluster-id=10\
  --shard=0\
  --shard=1

@alrevuelta alrevuelta requested a review from SionoiS March 5, 2024 16:42
Copy link

github-actions bot commented Mar 5, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2505-rln-v2-false

Built from 46809e3

@SionoiS
Copy link
Contributor

SionoiS commented Mar 5, 2024

LGTM

We just need to add dynamic shard subscription like in Waku metadata.

@alrevuelta alrevuelta force-pushed the cluster-configurable branch 2 times, most recently from 39e125a to 5921c68 Compare March 12, 2024 12:31
@alrevuelta alrevuelta marked this pull request as ready for review March 12, 2024 14:51
Copy link
Contributor

@fbarbu15 fbarbu15 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

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

LGTM

Thank you!

@@ -506,10 +506,12 @@ suite "WakuNode - Relay":

await node.start()
await node.mountRelay()
require node.mountSharding(1, 1).isOk
echo node.wakuSharding.getShard(DefaultContentTopic)
Copy link
Contributor

Choose a reason for hiding this comment

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

left overs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wops, fixed: c6a446b

clusterId: uint16
shardIds: seq[uint16]
clusterId*: uint16
shardIds*: seq[uint16]

func clusterId*(rs: RelayShards): uint16 =
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the clusterId and shardIds if they are no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure: c6a446b

Copy link
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

4 participants