You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nodece (via GitHub)" <gi...@apache.org> on 2023/03/10 04:27:51 UTC
[GitHub] [pulsar] nodece opened a new pull request, #19777: [fix][broker] Fix RetentionPolicies constructor
nodece opened a new pull request, #19777:
URL: https://github.com/apache/pulsar/pull/19777
Fixes https://github.com/apache/pulsar/issues/18112
### Motivation
In the `RetentionPolicies`, the type of the `retentionSizeInMB` field does not match that of the `retentionSizeInMB` type from the `constructor`.
A simple solution is to fix the constructor, `long` can be compatible with `int`, so just use the `long`.
In #18114, the type of the `retentionSizeInMB` field was changed to `int`, I don't think this is correct, and it introduces a bug: https://github.com/apache/pulsar/blob/75d58fda2fe99471abddc60f7ed671aaa6073e66/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java#L381-L382
`retention.getRetentionSizeInMB() * 1024 * 1024` can be overflowing, and then the result is 0.
Please use the following code to verify that:
```java
int retentionSize = 102400; // 12G
var n = (retentionSize * 1024 * 1024);
System.out.println(n == 0); // true
```
### Modifications
- Revert #18114
- Change the `retentionSizeInMB` type to `long` in the `constructor`
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] tisonkun commented on pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on PR #19777:
URL: https://github.com/apache/pulsar/pull/19777#issuecomment-1484105671
> retention.getRetentionSizeInMB() * 1024 * 1024 can be overflowing, and then the result is 0.
Although, event if you use `long`, overflow is still possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] nodece commented on pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "nodece (via GitHub)" <gi...@apache.org>.
nodece commented on PR #19777:
URL: https://github.com/apache/pulsar/pull/19777#issuecomment-1463236668
/pulsarbot rerun-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] michaeljmarshall commented on pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on PR #19777:
URL: https://github.com/apache/pulsar/pull/19777#issuecomment-1485644155
Was this just reverting https://github.com/apache/pulsar/issues/18112?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] nodece merged pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "nodece (via GitHub)" <gi...@apache.org>.
nodece merged PR #19777:
URL: https://github.com/apache/pulsar/pull/19777
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] nodece commented on pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "nodece (via GitHub)" <gi...@apache.org>.
nodece commented on PR #19777:
URL: https://github.com/apache/pulsar/pull/19777#issuecomment-1485691610
> Was this just reverting #18112?
Revert https://github.com/apache/pulsar/pull/18114, and change the `retentionSizeInMB` type to` long` from `int` in the constructor of `RetentionPolicies`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] lhotari commented on pull request #19777: [fix][broker] Fix RetentionPolicies constructor
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #19777:
URL: https://github.com/apache/pulsar/pull/19777#issuecomment-1486226202
> > Was this just reverting #18112?
>
> Revert #18114, and change the `retentionSizeInMB` type to` long` from `int` in the constructor of `RetentionPolicies`.
@nodece What's the point of changing the type to `long`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org