Skip to content

Commit 681f2c7

Browse files
Fix ingestion from raft session >=10
Issue: BB-759
1 parent 3cc85bb commit 681f2c7

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

lib/queuePopulator/IngestionProducer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ class IngestionProducer {
132132
});
133133
IngestionPopulatorMetrics.onIngestionSourceOp('getRaftId', 'error');
134134
return done(err);
135-
} else if (data && data[0]) {
135+
} else if (data) {
136136
IngestionPopulatorMetrics.onIngestionSourceOp('getRaftId', 'success');
137-
return done(null, data[0]);
137+
return done(null, data);
138138
}
139139
this.log.error(`empty response for raftid of ${bucketName}`,
140140
{ method: 'getRaftId', bucketName });

tests/functional/ingestion/IngestionProducer.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,15 @@ describe('ingestion producer tests with mock', () => {
158158
return done();
159159
});
160160
});
161+
162+
it('should return the full raft ID for multi-digit raft sessions',
163+
done => {
164+
this.iProducer.getRaftId('bucket-raft13', (err, res) => {
165+
assert.ifError(err);
166+
assert.strictEqual(typeof res, 'string');
167+
// must return '13', not '1' (first character)
168+
assert.strictEqual(res, '13');
169+
return done();
170+
});
171+
});
161172
});

tests/functional/utils/mockRes.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"resType": "raftId",
3838
"name": "bucket2"
3939
},
40+
"/_/metadata/admin/buckets/bucket-raft13/id": {
41+
"resType": "raftId",
42+
"name": "bucket-raft13"
43+
},
4044
"/_/metadata/admin/raft_sessions/1/log": {
4145
"resType": "raftLogs",
4246
"name": "1"
@@ -678,7 +682,8 @@
678682
},
679683
"raftId": {
680684
"bucket1": 1,
681-
"bucket2": 5
685+
"bucket2": 5,
686+
"bucket-raft13": 13
682687
},
683688
"raftInformation": {
684689
"1": {

0 commit comments

Comments
 (0)