-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve][broker]Enable custom metadata stores #19208
Conversation
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Outdated
Show resolved
Hide resolved
/pulsarbot rerun-failure-checks |
Codecov Report
@@ Coverage Diff @@
## master #19208 +/- ##
============================================
- Coverage 47.89% 41.44% -6.45%
- Complexity 10871 18086 +7215
============================================
Files 713 1790 +1077
Lines 69730 134266 +64536
Branches 7496 14797 +7301
============================================
+ Hits 33394 55647 +22253
- Misses 32631 71879 +39248
- Partials 3705 6740 +3035
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/pulsarbot rerun-failure-checks |
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/DefaultMetadataStoreProvider.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/MetadataStoreFactoryImpl.java
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/LocalMemoryMetadataStore.java
Outdated
Show resolved
Hide resolved
@@ -570,3 +573,17 @@ public Optional<MetadataEventSynchronizer> getMetadataEventSynchronizer() { | |||
return Optional.ofNullable(synchronizer); | |||
} | |||
} | |||
|
|||
class RocksdbMetadataStoreProvider implements MetadataStoreProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know java supports that (I'm used to it in Kotlin).
|
||
@BeforeClass | ||
public void setMetadataStoreProperty() { | ||
originalProperty = System.getProperties().get(MetadataStoreFactoryImpl.METADATASTORE_PROVIDERS_PROPERTY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It certainly does. But I think it is a good practice to leave the static state as it was before the test, regardless of the probability of it being non-null.
On the other hand, I think it's possible for someone using this very feature to run tests with their own provider configured in system properties.
/pulsarbot rerun-failure-checks |
/pulsarbot rerun-failure-checks |
Sorry about this. I think my comment thread has been hiding as resolved, so I'm resurfacing it if that's ok @andrasbeni String factoryClasses = System.getProperty(METADATASTORE_PROVIDERS_PROPERTY);
Based on (1) and (2), I don't understand why we can't use Pulsar configuration for that config @andrasbeni Last question, @andrasbeni: does Pulsar have a mechanism that, based on an ENV variable or System property, sets a property in the configuration (like an override)? So you can define it in the pulsar configuration and use the technique you used to set it via a system property, making it less intrusive, less static code? |
Motivation
Pulsar can use different metadata stores (ZK, etcd, etc.). These metadata stores are built into Pulsar itself, and there has been no way of using a custom-made metadata store. This change allows the loading of metadata store implementations from the classpath by providing a system property.
Modifications
pulsar.metadatastore.providers
for provider class namesVerifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: andrasbeni#10