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

Check if GC config exists before creating gc producer in replication #2555

Open
wants to merge 5 commits into
base: development/8.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,16 @@
* in PEM format
* @param {Object} mConfig - metrics config
* @param {String} mConfig.topic - metrics config kafka topic
* @param {Boolean} gcConfig - flag to enable garbage collection - Based on GC config
*/
constructor(kafkaConfig, sourceConfig, repConfig,
internalHttpsConfig, mConfig) {
internalHttpsConfig, mConfig, gcConfig) {
this.kafkaConfig = kafkaConfig;
this.sourceConfig = sourceConfig;
this.repConfig = repConfig;
this.internalHttpsConfig = internalHttpsConfig;
this.mConfig = mConfig;
this.gcConfig = gcConfig;
this._consumer = null;
this._gcProducer = null;
this._mProducer = null;
Expand Down Expand Up @@ -370,8 +372,12 @@
});
},
done => {
this._gcProducer = new GarbageCollectorProducer();
this._gcProducer.setupProducer(done);
if (this.gcConfig) {
this._gcProducer = new GarbageCollectorProducer();
return this._gcProducer.setupProducer(done);
} else {
return done();

Check warning on line 379 in extensions/replication/replicationStatusProcessor/ReplicationStatusProcessor.js

View check run for this annotation

Codecov / codecov/patch/Backbeat

extensions/replication/replicationStatusProcessor/ReplicationStatusProcessor.js#L379

Added line #L379 was not covered by tests
}
Comment on lines +375 to +380
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add tests for this

},
done => {
this._mProducer = new MetricsProducer(this.kafkaConfig,
Expand Down
3 changes: 2 additions & 1 deletion extensions/replication/replicationStatusProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
const sourceConfig = repConfig.source;
const internalHttpsConfig = config.internalHttps;
const mConfig = config.metrics;
const gcConfig = config.extensions.gc;

Check warning on line 16 in extensions/replication/replicationStatusProcessor/task.js

View check run for this annotation

Codecov / codecov/patch/Backbeat

extensions/replication/replicationStatusProcessor/task.js#L16

Added line #L16 was not covered by tests

const { initManagement } = require('../../../lib/management/index');

const replicationStatusProcessor = new ReplicationStatusProcessor(
kafkaConfig, sourceConfig, repConfig, internalHttpsConfig, mConfig);
kafkaConfig, sourceConfig, repConfig, internalHttpsConfig, mConfig, gcConfig);

werelogs.configure({ level: config.log.logLevel,
dump: config.log.dumpLevel });
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/replication/queueProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ describe('queue processor functional tests with mocking', () => {
objectSizeMetrics: [100, 1000],
},
{},
{ topic: 'metrics-test-topic' });
{ topic: 'metrics-test-topic' }, { topic: 'backbeat-gc' });
KillianG marked this conversation as resolved.
Show resolved Hide resolved
replicationStatusProcessor.start({ bootstrap: true }, done);
},
done => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/replication/ReplicationStatusProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function makeReplicationStatusProcessor(replayTopics) {
transport: 'http',
},
{ replayTopics, objectSizeMetrics: [100, 1000] },
{});
{}, false);
KillianG marked this conversation as resolved.
Show resolved Hide resolved
}

describe('ReplicationStatusProcessor', () => {
Expand Down
Loading