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

Use historical data from old API in new API #329

Merged
merged 1 commit into from Apr 5, 2017

Conversation

bobbeyreese
Copy link
Contributor

Motivation

Currently, users which switch to ModularLoadManagerImpl will carry over no history contained in the resource quotas, causing the default message rate and throughput values to be used for every bundle. This PR makes it so that ModularLoadManagerImpl will use this data to initialize bundle data for bundles not yet handled by the new API.

Modifications

When assigning new bundles, the historical data will now be initialized according to the following priorities:

  • Existing data in /loadbalance/bundle-data
  • Existing data in /loadbalance/resource-quota/namespace
  • Hardcoded default values

Result

We may now utilize pre-existing historical data for ModularLoadManagerImpl.

if (zkClient.exists(bundleZPath, null) != null) {
bundleData = readJson(zkClient.getData(bundleZPath, null, null), BundleData.class);
} else if (zkClient.exists(quotaZPath, null) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Both the zkClient.exists() calls are blocking here (it needs to send a req to zk server and wait for it). You can leverage the ZK cache classes that are already in place to cache the existence check for that znode and use watches to update the status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the leader broker, these calls will only be made once per bundle, and then they are added to the local bundle data map -- will it still help to use a cache in this case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, that sounds good

@merlimat merlimat added this to the 1.18 milestone Apr 4, 2017
@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Apr 4, 2017
Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

👍

@merlimat merlimat merged commit 16d8177 into apache:master Apr 5, 2017
@bobbeyreese bobbeyreese deleted the use_quota_history branch April 10, 2017 21:39
hrsakai pushed a commit to hrsakai/pulsar that referenced this pull request Dec 10, 2020
…che#329)

Signed-off-by: Paulo Pereira <paulo.pereira@karhoo.com>

### Motivation

I have a service that when it restarts, it needs to know what was the last message successfully sent to pulsar.
A reader seems the logical place, since we can specify `StartMessageID` as `LatestMessageID()` and `StartMessageIDInclusive`

### Modifications

When the reader is created, verify if it startMessageIDInclusive true and startMessageID == lastestMessageID() and then get the last message id and seek to that message id.
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
fix apache#329 
fix highwatermark and logendoffset error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants