Skip to content

Conversation

@0aix
Copy link
Member

@0aix 0aix commented May 11, 2021

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@0aix 0aix requested review from NathanSpeidel and akshaisarma May 11, 2021 20:12
public void merge(Config other) {
super.merge(other);
validate();
provider = BulletRecordProvider.from(getAs(RECORD_PROVIDER_CLASS_NAME, String.class));
Copy link
Member

Choose a reason for hiding this comment

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

Good catch but it won't fix it if you do config.set(RECORD_PROVIDER_CLASS_NAME, somethingElse) and do getBulletRecordProvider().

I think the best way to fix it would be to make the getBulletRecordProvider do the check (provider == null || !provider.getClass.getName().equals(get(RECORD_PROVIDER_CLASS_NAME)) and init if so?

@0aix 0aix requested a review from akshaisarma May 12, 2021 17:45
@0aix 0aix changed the title BulletConfig merge() updates stored BulletRecordProvider Add getCachedBulletRecordProvider to BulletConfig May 12, 2021
BulletRecordProvider providerB = config.getCachedBulletRecordProvider();

// Uses the same provider
Assert.assertEquals(providerA, providerB);
Copy link
Member

Choose a reason for hiding this comment

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

Do assertSame to be explicit

// Default record provider is TypedAvroBulletRecordProvider
Assert.assertTrue(config.getBulletRecordProvider() instanceof TypedAvroBulletRecordProvider);

config.set(BulletConfig.RECORD_PROVIDER_CLASS_NAME, "com.yahoo.bullet.record.simple.TypedSimpleBulletRecordProvider");
Copy link
Member

Choose a reason for hiding this comment

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

Import and use TypedSimpleBulletRecordProvider.getClass().getName()?

@0aix 0aix merged commit e840c79 into master May 13, 2021
@0aix 0aix deleted the provider-fix branch May 13, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants