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

Sort partition ids #20

Open
JBBianchi opened this issue Mar 23, 2023 · 2 comments · May be fixed by #23
Open

Sort partition ids #20

JBBianchi opened this issue Mar 23, 2023 · 2 comments · May be fixed by #23

Comments

@JBBianchi
Copy link
Member

Describe the solution you'd like
When focusing on the partition id field of the read options form, the ids should be sorted alphabetically.

@JBBianchi JBBianchi self-assigned this Mar 23, 2023
@JBBianchi JBBianchi added the enhancement New feature or request label Mar 23, 2023
@JBBianchi
Copy link
Member Author

For people with an existing setup, they either need to drop their EventStore volume or edit/reset the partitions:

  • cloud-events-partition-ids-BySource
  • cloud-events-partition-ids-BySubject
  • cloud-events-partition-ids-ByType

by adding stream.sort();

fromStream('cloud-events')
    .when({
        $init: () => [],
        $any: (stream, evt) => {
            if (!evt || !evt.metadataRaw || !evt.metadataRaw) return;
            const metadata = JSON.parse(evt.metadataRaw);
            const id = metadata.##propertyName##;
            if (!id || stream.includes(id)) return;
            stream.push(id);
+           stream.sort();
        }
    });

@JBBianchi JBBianchi changed the title Sort partition ids [Draft] Sort partition ids Mar 24, 2023
@JBBianchi JBBianchi changed the title [Draft] Sort partition ids Sort partition ids Mar 24, 2023
@cdavernas
Copy link
Member

Postponed merging the PR to a future date as it requires an ADR regarding the strategy to adopt: ordering of ids at ingestion time (back-end) vs at read time (front-end)

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

Successfully merging a pull request may close this issue.

2 participants