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

KAFKA-15443: Upgrade RocksDB to 9.7.3 #18275

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

swikarpat
Copy link
Contributor

@swikarpat swikarpat commented Dec 19, 2024

Upgrades RocksDB to version 9.7.3 to address Jira KAFKA-15443

This PR addresses the following compatibility issues introduced by the RocksDB upgrade:

  • Removal of AccessHint: The AccessHint class was completely removed in RocksDB 9.7.3. This required removing all import statements, variable declarations, method parameters, method return types, and static method calls related to AccessHint in RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java Unused methods are removed in RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java

  • Removal of NO_FILE_CLOSES: The NO_FILE_CLOSES metric was also removed in RocksDB 9.7.3. The calculation for numberOfOpenFiles in RocksDBMetricsRecorder.java has been adjusted to now track the total number of file opens since the last reset. The previous calculation, which subtracted NO_FILE_CLOSES from NO_FILE_OPENS, is no longer possible.
    The reason RocksDB team removed NO_FILE_CLOSES it seems to me they detected not properly working: https://github.com/search?q=repo%3Afacebook%2Frocksdb+NO_FILE_CLOSES&type=issues

Any feedback or any proposed changes you would like me to do are welcome let me know.
@cadonna @mjsax

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added triage PRs from the community streams dependencies Pull requests that update a dependency file build Gradle build or GitHub Actions small Small PRs labels Dec 19, 2024
@swikarpat swikarpat changed the title Upgrade RocksDB to 9.7.3 KAFKA-15443 Upgrade RocksDB to 9.7.3 Dec 19, 2024
Copy link
Member

@mjsax mjsax 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 PR. I think we need to bite the bullet and merge this as-is. Given that we are heading into a major release, it should hopefully be ok.

Curious to hear how others think about it. \cc @cadonna @ableegoldman


// NO_FILE_CLOSES metric was removed in RocksDB 9.7.3.
// This now tracks the total number of file opens since the last reset.
numberOfOpenFiles += valueProviders.statistics.getAndResetTickerCount(TickerType.NO_FILE_OPENS);
Copy link
Member

Choose a reason for hiding this comment

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

As commented on the Jira ticket, changing semantics of an existing metric does not sound right. I would rather just report -1 surrogate for now, and deprecate this metric with 4.0 release.

Curious to hear what others think.

Copy link
Member

Choose a reason for hiding this comment

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

Tend to agree that changing semantics is no good, but it sounds like the new metric will be useful -- is it possible to deprecate the old one and introduce a new one that corresponds to the same underlying thing? I really don't know anything about how we expose the RocksDB metrics though so Bruno is probably better suited to chime in

Copy link
Contributor Author

@swikarpat swikarpat Dec 20, 2024

Choose a reason for hiding this comment

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

@mjsax Thanks for the suggestion. I'm not entirely sure how to implement reporting a -1 surrogate and deprecating the metric for the 4.0 release. Could you provide some guidance or point me to relevant examples? NO_FILE_CLOSES metric declared in TickerType.class inside org.rocksdb package. We can't modify that class, can we? @cadonna @ableegoldman

Copy link
Contributor

Choose a reason for hiding this comment

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

@swikarpat I believe @mjsax means to not return the number of opened files but just -1. I agree with him. The number of opened files without the number of closed files does not give us much info. Furthermore, by recording the number of opened files, the metric would seem correct, but actually would not show the correct values because the metric is defined as the number of currently open files. Returning constant -1 would make it clear that the metric does not work.
In addition to returning -1, could you please also update the documentation of the metrics in this PR:

<td>number-open-files</td>

@@ -842,12 +830,6 @@ public Options setSstFileManager(final SstFileManager sstFileManager) {
return this;
}

@Override
public Options setLogger(final org.rocksdb.Logger logger) {
dbOptions.setLogger(logger);
Copy link
Member

Choose a reason for hiding this comment

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

If this was removed, too, can you add it to the PR description.

Copy link
Contributor Author

@swikarpat swikarpat Dec 20, 2024

Choose a reason for hiding this comment

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

@mjsax thanks for feedback. I wanted to confirm setLogger() method. Parameter inside setLogger() has changed to LoggerInterface. I've made corrections and put method back in that java class.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is fine to change it like you did. If users use a logger class that is derived from Logger they have to modify it in any case because Logger now implements interface LoggerInterface. Thus, the change of the method will most likely not directly affect users on a source level. It will affect them on binary level, though, but that is the trade-off here.


@Override
public AccessHint accessHintOnCompactionStart() {
return dbOptions.accessHintOnCompactionStart();
Copy link
Member

Choose a reason for hiding this comment

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

It's too bad that RockDB does not mark methods as deprecated but just removes stuff.

This was always an issue for us (even if we have to admit, that we are upgrade from a quite old version...). I guess we just need to bite the bullet and make this breaking change... Seem we need to start tracking RocksDB changes more closely and frequently and do KIPs early on to prepare for breaking changes. (What basically implies, that we can upgrade RocksDB only in major release if there are breaking changes...)

Or we change our "policy" for RocksDB compatibility and document it properly, reserving the right to break compatibility via RocksDB version bumps also in minor release.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this drives me crazy. Personally I think it's ok to bite the bullet on this one but let's definitely come up with a strategy for this going forward. I'd say a good compromise is to meet in the middle and do both, that is, publish an official policy for RocksDB APIs which says there is no guarantee of the usual one-year deprecation & only major version removal, and any deprecations are best-effort. I'm less worried about the deprecations and more about restricting our ability to upgrade rocksdb to only major releases.

At the same time, I think we can and should do better. I like the idea of looking ahead at each new RocksDB release to mark any changed or removed APIs exposed to our users so we can deprecate them ASAP. We can hash out the details of how often and how to share this responsibility later (for example maybe this should be one of the Streams RM responsibilities, to look for upcoming API changes in future rocks and make sure they get deprecated in that release

Copy link
Contributor

@cadonna cadonna 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 PR @swikarpat !

Besides methods that were removed, there is at least one method that was added, i.e., setMemtableMaxRangeDeletions(). That is also the reason why RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest fails.

In the compatibility report you attached to the ticket there are quite some compatibility issues listed. IMO, we should state the most important ones on the upgrade notes and link to the compatibility report for details. Could you please update the upgrade notes with this info in this PR?

I left some more comments on the PR.


// NO_FILE_CLOSES metric was removed in RocksDB 9.7.3.
// This now tracks the total number of file opens since the last reset.
numberOfOpenFiles += valueProviders.statistics.getAndResetTickerCount(TickerType.NO_FILE_OPENS);
Copy link
Contributor

Choose a reason for hiding this comment

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

@swikarpat I believe @mjsax means to not return the number of opened files but just -1. I agree with him. The number of opened files without the number of closed files does not give us much info. Furthermore, by recording the number of opened files, the metric would seem correct, but actually would not show the correct values because the metric is defined as the number of currently open files. Returning constant -1 would make it clear that the metric does not work.
In addition to returning -1, could you please also update the documentation of the metrics in this PR:

<td>number-open-files</td>

@@ -842,12 +830,6 @@ public Options setSstFileManager(final SstFileManager sstFileManager) {
return this;
}

@Override
public Options setLogger(final org.rocksdb.Logger logger) {
dbOptions.setLogger(logger);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is fine to change it like you did. If users use a logger class that is derived from Logger they have to modify it in any case because Logger now implements interface LoggerInterface. Thus, the change of the method will most likely not directly affect users on a source level. It will affect them on binary level, though, but that is the trade-off here.

@github-actions github-actions bot removed the triage PRs from the community label Dec 21, 2024
@swikarpat
Copy link
Contributor Author

swikarpat commented Dec 22, 2024

@cadonna @mjsax I have added methods and also made changes in Test class and also documents. Unit Tests keep failing. Though I ran unit tests for given two Test file and ran passed. Can you please take a look what went wrong and feedback?

Total 8 files changed.

  • ops.html
  • upgrade-guide.html
  • dependencies.gradle
  • RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java
  • RocksDBMetricsRecorder.java
  • RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java
  • RocksDBMetricsRecorderTest.java

Thanks

@mjsax
Copy link
Member

mjsax commented Jan 2, 2025

RocksDB did push out newer release since we started this PR. There is now 9.10.0 -- not sure if we want to go with a .0 version, but there is also 9.9.3. -- Should we use the latest version instead of 9.7.3?

@mjsax
Copy link
Member

mjsax commented Jan 2, 2025

Unit Tests keep failing. Though I ran unit tests for given two Test file and ran passed. Can you please take a look what went wrong and feedback?

No need to worry about these. We know they are flaky, and AFAIK somebody is already working on a fix. As long as no test related to this PR fail, we can merge anyway. Btw: in case a test get's fixed, you would need to rebase your branch to trunk to pickup the fix.

@@ -139,8 +139,6 @@ <h3 class="anchor-heading"><a id="streams_notable_changes" class="anchor-link"><
More details about the new config <code>StreamsConfig#TOPOLOGY_OPTIMIZATION_CONFIG</code> can be found in <a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-295%3A+Add+Streams+Configuration+Allowing+for+Optional+Topology+Optimization">KIP-295</a>.
</p>

<h3><a id="streams_api_changes_400" href="#streams_api_changes_400">Streams API changes in 4.0.0</a></h3>
Copy link
Member

Choose a reason for hiding this comment

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

Why did you move this line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Still not clear why this line was moved.

@swikarpat
Copy link
Contributor Author

swikarpat commented Jan 2, 2025

RocksDB did push out newer release since we started this PR. There is now 9.10.0 -- not sure if we want to go with a .0 version, but there is also 9.9.3. -- Should we use the latest version instead of 9.7.3?

@mjsax Thanks for feedback. Yes I am aware of that but only up to 9.7.3 currently published on maven central. I've asked RocksDB team for timeline of publishing latest version (9.10.0 released today) on maven central as here facebook/rocksdb#13214

@swikarpat swikarpat requested a review from mjsax January 3, 2025 00:00
Copy link
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

LGTM.

@swikarpat swikarpat force-pushed the upgrade-rocksdb-to-9.7.3 branch from f0dd7fd to 1af566b Compare January 3, 2025 20:29
@swikarpat swikarpat requested a review from mjsax January 3, 2025 20:35
@swikarpat swikarpat force-pushed the upgrade-rocksdb-to-9.7.3 branch 4 times, most recently from 20b16a4 to 3c43871 Compare January 3, 2025 23:33
@swikarpat swikarpat force-pushed the upgrade-rocksdb-to-9.7.3 branch from 3c43871 to 124ef06 Compare January 4, 2025 03:59
@swikarpat
Copy link
Contributor Author

swikarpat commented Jan 4, 2025

@mjsax Now I have rebased onto the latest trunk. Could you please merge this PR as I do not have write access to merge. Thank you

@cadonna cadonna changed the title KAFKA-15443 Upgrade RocksDB to 9.7.3 KAFKA-15443: Upgrade RocksDB to 9.7.3 Jan 6, 2025
Copy link
Contributor

@cadonna cadonna 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, @swikarpat !

I have a couple of comments.

docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
docs/ops.html Outdated
Comment on lines 3476 to 3480
<tr>
<td>number-open-files</td>
<td>The number of current open files.</td>
<td>kafka.streams:type=stream-state-metrics,thread-id=([-.\w]+),task-id=([-.\w]+),[store-scope]-id=([-.\w]+)</td>
</tr>
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of removing this row, could you add a comment that the metric will return constant -1 and why it returns that?
In the end the metric is still exposed, it just returns a useless constant value.

If you want, you are welcome to create a KIP to remove this metric from Streams. Once that KIP is accepted, we can remove the metric from in the next major release.

docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
@@ -139,8 +139,6 @@ <h3 class="anchor-heading"><a id="streams_notable_changes" class="anchor-link"><
More details about the new config <code>StreamsConfig#TOPOLOGY_OPTIMIZATION_CONFIG</code> can be found in <a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-295%3A+Add+Streams+Configuration+Allowing+for+Optional+Topology+Optimization">KIP-295</a>.
</p>

<h3><a id="streams_api_changes_400" href="#streams_api_changes_400">Streams API changes in 4.0.0</a></h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

Still not clear why this line was moved.

docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the small Small PRs label Jan 6, 2025
@swikarpat swikarpat requested a review from cadonna January 6, 2025 22:21
@swikarpat
Copy link
Contributor Author

swikarpat commented Jan 6, 2025

@cadonna Thanks for your feedback. I've made changes accordingly:
Removed deprecated methods, added row back to ops.html, made corrections to upgrade-guide.html.
Let me know if anything .. Thanks.

Copy link
Contributor

@cadonna cadonna 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, @swikarpat !

I have a couple of minor comments!

docs/ops.html Outdated Show resolved Hide resolved
docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
docs/streams/upgrade-guide.html Outdated Show resolved Hide resolved
@swikarpat swikarpat requested a review from cadonna January 7, 2025 18:27
@swikarpat
Copy link
Contributor Author

@cadonna Thanks for feedback. I've adjusted your suggested changes accordingly.

@swikarpat swikarpat force-pushed the upgrade-rocksdb-to-9.7.3 branch 6 times, most recently from 3a4c2b7 to 01a7aaf Compare January 8, 2025 22:08
This PR addresses the following compatibility issues introduced by the RocksDB upgrade:

Removal of AccessHint: The AccessHint class was completely removed in RocksDB 9.7.3. This required removing all import statements, variable declarations, method parameters, method return types, and static method calls related to AccessHint in RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java Unused methods are removed in RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapter.java

Removal of NO_FILE_CLOSES: The NO_FILE_CLOSES metric was also removed in RocksDB 9.7.3. The calculation for numberOfOpenFiles in RocksDBMetricsRecorder.java has been adjusted to now track the total number of file opens since the last reset. The previous calculation, which subtracted NO_FILE_CLOSES from NO_FILE_OPENS, is no longer possible.
The reason RocksDB team removed NO_FILE_CLOSES it seems to me they detected not properly working: https://github.com/search?q=repo%3Afacebook%2Frocksdb+NO_FILE_CLOSES&type=issues

KAFKA-15443: Upgrade RocksDB to 9.7.3

Update docs/ops.html

Co-authored-by: Bruno Cadonna <[email protected]>

Update docs/streams/upgrade-guide.html

Co-authored-by: Bruno Cadonna <[email protected]>

Update docs/streams/upgrade-guide.html

Co-authored-by: Bruno Cadonna <[email protected]>

Update upgrade-guide.html
@swikarpat swikarpat force-pushed the upgrade-rocksdb-to-9.7.3 branch from 01a7aaf to 6ae30ed Compare January 9, 2025 01:24
Copy link
Contributor

@cadonna cadonna 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, @swikarpat !

LGTM!

I restarted the failed job. Once that terminates, I am going to merge this PR.

@cadonna cadonna merged commit 8b72204 into apache:trunk Jan 9, 2025
9 checks passed
@swikarpat swikarpat deleted the upgrade-rocksdb-to-9.7.3 branch January 9, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Gradle build or GitHub Actions ci-approved dependencies Pull requests that update a dependency file streams
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants