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: update to badger v4 #11344

Closed
wants to merge 13 commits into from
Closed

feat: update to badger v4 #11344

wants to merge 13 commits into from

Conversation

kruskall
Copy link
Member

@kruskall kruskall commented Aug 7, 2023

Motivation/summary

badger v2 is severely out of date and newer versions have important performance improvements

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

Related issues

@kruskall kruskall requested a review from a team as a code owner August 7, 2023 03:51
@mergify
Copy link
Contributor

mergify bot commented Aug 7, 2023

This pull request does not have a backport label. Could you fix it @kruskall? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.x is the label to automatically backport to the 7.x branch.
  • backport-7./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Aug 7, 2023
@@ -573,87 +573,6 @@ func TestStorageMonitoring(t *testing.T) {
assert.NotZero(t, metrics.Ints, "sampling.storage.value_log_size")
}

func TestStorageGC(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

For reviewers: this will fail because the meaning of vlog files changed, see dgraph-io/badger#1555

Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this again, I'm not sure we should just remove the test. GC is still needed, it's just that how it works has changed. Can we instead update the test?

@kruskall kruskall changed the title Feat/badgerv4 feat: update to badger v4 Aug 7, 2023
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Looks good!

IIUC this would be a breaking change as the data format has changed, so old files wouldn't be able to be loaded. Is that correct? If so then we should list it in the changelog. Also, have you confirmed the behaviour when upgrading from an older apm-server version?

@mergify
Copy link
Contributor

mergify bot commented Aug 9, 2023

This pull request is now in conflicts. Could you fix it @kruskall? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/badgerv4 upstream/feat/badgerv4
git merge upstream/main
git push upstream feat/badgerv4

@kruskall
Copy link
Member Author

This is what happened when trying to load a directory on the previous version:

panic: manifest has unsupported version: 7 (we support 8).
Please see https://dgraph.io/docs/badger/faq/#i-see-manifest-has-unsupported-version-x-we-support-y-error on how to fix this.

I don't think the migration procedure is feasible. Could we change the directory path ? e.g. tail_sampling -> tail_sampling_v4 ? WDYT ?

@mergify
Copy link
Contributor

mergify bot commented Aug 14, 2023

This pull request is now in conflicts. Could you fix it @kruskall? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b feat/badgerv4 upstream/feat/badgerv4
git merge upstream/main
git push upstream feat/badgerv4

@axw
Copy link
Member

axw commented Aug 15, 2023

I don't think the migration procedure is feasible. Could we change the directory path ? e.g. tail_sampling -> tail_sampling_v4 ? WDYT ?

That sounds good. The alternative would be to automatically delete the old data, but I think it would be better to leave it there and give the user an option to manually backup/restore.

OTOH that would mean the old data will be left behind forever. Maybe we could check the modification time of files in the tail_sampling directory at startup (if it exists), and remove it if all files are older than the TTL. WDYT?

@kruskall
Copy link
Member Author

Sorry for the late reply!

OTOH that would mean the old data will be left behind forever. Maybe we could check the modification time of files in the tail_sampling directory at startup (if it exists), and remove it if all files are older than the TTL. WDYT?

Good idea! Updated!

@kruskall kruskall requested a review from axw August 25, 2023 02:43
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @kruskall. Looks good overall, my main concern now is the removed test.

x-pack/apm-server/main.go Outdated Show resolved Hide resolved
@@ -5,6 +5,7 @@ https://github.com/elastic/apm-server/compare/8.10\...main[View commits]

[float]
==== Breaking Changes
- Update badger to v4 {pull}11344[11344]
Copy link
Member

Choose a reason for hiding this comment

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

We should mention why it's breaking - what the implications are for users.

@@ -573,87 +573,6 @@ func TestStorageMonitoring(t *testing.T) {
assert.NotZero(t, metrics.Ints, "sampling.storage.value_log_size")
}

func TestStorageGC(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this again, I'm not sure we should just remove the test. GC is still needed, it's just that how it works has changed. Can we instead update the test?

@kruskall kruskall closed this Aug 31, 2023
@kruskall kruskall deleted the feat/badgerv4 branch August 31, 2023 13:52
@kruskall
Copy link
Member Author

I'll close this in the interest of time and open an issue that we can schedule. Sorry, I underestimated the amount of work needed for this 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants