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

feat: persist AlterSchema and AlterOptions to data WAL #166

Merged
merged 7 commits into from
Aug 8, 2022

Conversation

waynexia
Copy link
Member

@waynexia waynexia commented Aug 4, 2022

Which issue does this PR close?

Closes #82

Rationale for this change

quote from #82:

AlterSchema and AlterOption are now persisted in the manifest. It would be better to keep manifest simple (only contains SST file information, sequence number, etc.). And schema modification is related to data, putting them in two separate places may bring some problems.

This PR focus on the second target -- put DDL (altering schema and options) together with data WAL.

A more detailed reason is that in distributed mode, we have a writer node and serval reader nodes. Where the writer serves all the related write requests, including writing data and altering schema/options. And readers sync new data from their writer. They communicate with data WAL. However, the data WAL used only contains the data logs. This is problematic when for example, the schema is changing. Readers don't know at which point the schema has changed, and therefore cannot handle their memory status correctly.

After this patch readers can know when to update their schema and/or options. Those DDL records are associated with data records.

Besides this, those DDL records still exist in the Manifest. I.e. this PR doesn't touch the Manifest. I haven't found a better place to put those metadata. This kind of data changes frequently thus OSS is not a good choice.

What changes are included in this PR?

Duplicate AlterSchema and AlterOptions to data WAL

Are there any user-facing changes?

No, all changes are internal.

How does this change test

Unit test

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@waynexia waynexia added feature New feature or request A-analytic-engine Area: Analytic Engine labels Aug 4, 2022
@waynexia waynexia added this to the Release v0.3 milestone Aug 4, 2022
@waynexia waynexia requested a review from ShiKaiWi August 4, 2022 07:38
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Copy link
Member

@ShiKaiWi ShiKaiWi left a comment

Choose a reason for hiding this comment

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

Well done!

@waynexia
Copy link
Member Author

waynexia commented Aug 5, 2022

I've merged main to resolve conflicts with #163, PTAL again @ShiKaiWi

@ShiKaiWi ShiKaiWi merged commit e9f7fa6 into apache:main Aug 8, 2022
@waynexia waynexia deleted the move-wal branch August 8, 2022 07:25
chunshao90 pushed a commit to chunshao90/ceresdb that referenced this pull request May 15, 2023
* feat: move schema out from manifest

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* change the AlterSchema persist destination to Wal

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* AlterSchema decodeing

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* impl alter options; store update to Manifest as well

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* update mod doc

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix decoding header

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-analytic-engine Area: Analytic Engine feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move AlterSchema and AlterOption to data WAL
2 participants