Skip to content
Snippets Groups Projects
Commit a99a443e authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix(1447): show that the issue is about indexForTrimming only

parent 67b05f1a
No related branches found
No related tags found
No related merge requests found
Pipeline #32332 failed
...@@ -345,7 +345,16 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry> ...@@ -345,7 +345,16 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry>
* Allow to get internal index, for unit test (see test triming-dal.ts) * Allow to get internal index, for unit test (see test triming-dal.ts)
*/ */
getInternalIndexes(): LevelDBTable<any>[] { getInternalIndexes(): LevelDBTable<any>[] {
return [this.indexForTrimming, this.indexForConditions, this.indexForConditions, this.indexOfComplexeConditionForPubkeys]; return [this.indexForTrimming, this.indexForConditions, this.indexForConsumed, this.indexOfComplexeConditionForPubkeys];
}
getIndexForTrimming(): LevelDBTable<any> {
return this.indexForTrimming
}
getIndexForConditions(): LevelDBTable<any> {
return this.indexForConditions
}
getIndexForConsumed(): LevelDBTable<any> {
return this.indexForConsumed
} }
private async trimConditions(condition: string, id: string) { private async trimConditions(condition: string, id: string) {
......
...@@ -120,8 +120,8 @@ describe("Triming", function(){ ...@@ -120,8 +120,8 @@ describe("Triming", function(){
await dal.sindexDAL.insertBatch([ await dal.sindexDAL.insertBatch([
{ op: 'CREATE', identifier: 'SOURCE_1', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'COND(SOURCE_1)'}, { op: 'CREATE', identifier: 'SOURCE_1', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'COND(SOURCE_1)'},
{ op: 'UPDATE', identifier: 'SOURCE_1', pos: 4, written_on: '139-H', writtenOn: 139, written_time: 4500, consumed: true, conditions: 'COND(SOURCE_1)'}, { op: 'UPDATE', identifier: 'SOURCE_1', pos: 4, written_on: '139-H', writtenOn: 139, written_time: 4500, consumed: true, conditions: 'COND(SOURCE_1)'},
{ op: 'CREATE', identifier: 'SOURCE_2', pos: 4, written_on: '127-H', writtenOn: 127, written_time: 2500, consumed: false, conditions: 'COND(SOURCE_2)'}, { op: 'CREATE', identifier: 'SOURCE_2', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2500, consumed: false, conditions: 'COND(SOURCE_2)'},
{ op: 'CREATE', identifier: 'SOURCE_3', pos: 4, written_on: '127-H', writtenOn: 127, written_time: 2500, consumed: false, conditions: 'SIG(PUB_1)'} { op: 'CREATE', identifier: 'SOURCE_3', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2500, consumed: false, conditions: 'SIG(PUB_1)'}
] as any); ] as any);
(await dal.sindexDAL.findByIdentifier('SOURCE_1')).should.have.length(2); (await dal.sindexDAL.findByIdentifier('SOURCE_1')).should.have.length(2);
(await dal.sindexDAL.getAvailableForConditions('COND(SOURCE_2)')).should.have.length(1); (await dal.sindexDAL.getAvailableForConditions('COND(SOURCE_2)')).should.have.length(1);
...@@ -141,13 +141,15 @@ describe("Triming", function(){ ...@@ -141,13 +141,15 @@ describe("Triming", function(){
(await dal.sindexDAL.findByPos(4)).should.have.length(2); (await dal.sindexDAL.findByPos(4)).should.have.length(2);
// Check internal index // Check internal index
should.not.exist(await sindexDAL.getIndexForConditions().getOrNull("COND(SOURCE_1)")); // The only source at this condition was trimmed
should.not.exist(await sindexDAL.getIndexForConsumed().getOrNull("0000000139")); // The only consumption at this block was trimmed
let entriesAt0000000126 = await sindexDAL.getIndexForTrimming().getOrNull("0000000126");
// FIXME another issue here // FIXME another issue here
for (let index of sindexDAL.getInternalIndexes()) { entriesAt0000000126.should.not.containEql('SOURCE_1-0000000004'); // This CREATE entry should have been trimmed
const keys = await index.findAllKeys();
keys.should.not.containEql("COND(SOURCE_1)"); let entriesAt0000000139 = await sindexDAL.getIndexForTrimming().getOrNull("0000000139");
keys.should.not.containEql("0000000126"); should.not.exist(entriesAt0000000139);
keys.should.not.containEql("0000000139");
}
// Now we consume all sources // Now we consume all sources
await dal.sindexDAL.insertBatch([ await dal.sindexDAL.insertBatch([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment