[GH-ISSUE #75] Sorting with indexed field #51

Closed
opened 2026-05-23 08:28:24 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @paradis-A on GitHub (Feb 23, 2022).
Original GitHub issue: https://github.com/appy-one/acebase/issues/75

Originally assigned to: @appy-one on GitHub.

Using v1.15.0

load first 100 sort letter by a-z (non-indexed)
√ (547ms)

load second 100 sort letter by a-z (non-indexed)
√ (345ms)

load third 100 sort letter by a-z (non-indexed)
√ (325ms)

load first 100 sort letter by z-a (non-indexed)
√ (254ms)

load second 100 sort letter by z-a (non-indexed)
√ (283ms)

load third 100 sort letter by z-a (non-indexed)
√ (300ms)

load first 100 sort letter by a-z (indexed)
1)

load second 100 sort letter by a-z (indexed)
Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion
2)

load third 100 sort letter by a-z (indexed)
3)

load first 100 sort letter by z-a (indexed)
Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion
4)

load second 100 sort letter by a-z (indexed)
5)

load third 100 sort letter by a-z (indexed)
Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion
6)

6 passing (3m)
6 failing

  1. load first 100 sort letter by a-z (indexed)
    :
    Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at async Context. (acebasetake.spec.js:105:9)

  2. load second 100 sort letter by a-z (indexed)
    :
    Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical)
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Context. (acebasetake.spec.js:113:9)

  3. load third 100 sort letter by a-z (indexed)
    :
    Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at async Context. (acebasetake.spec.js:121:9)

  4. load first 100 sort letter by z-a (indexed)
    :
    Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical)
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Context. (acebasetake.spec.js:130:9)

  5. load second 100 sort letter by a-z (indexed)
    :
    Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at async Context. (acebasetake.spec.js:138:9)

  6. load third 100 sort letter by a-z (indexed)
    :
    Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical)
    at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Context. (acebasetake.spec.js:146:9)

Originally created by @paradis-A on GitHub (Feb 23, 2022). Original GitHub issue: https://github.com/appy-one/acebase/issues/75 Originally assigned to: @appy-one on GitHub. Using v1.15.0 load first 100 sort letter by a-z (non-indexed) √ (547ms) load second 100 sort letter by a-z (non-indexed) √ (345ms) load third 100 sort letter by a-z (non-indexed) √ (325ms) load first 100 sort letter by z-a (non-indexed) √ (254ms) load second 100 sort letter by z-a (non-indexed) √ (283ms) load third 100 sort letter by z-a (non-indexed) √ (300ms) load first 100 sort letter by a-z (indexed) 1) load second 100 sort letter by a-z (indexed) Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion 2) load third 100 sort letter by a-z (indexed) 3) load first 100 sort letter by z-a (indexed) Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion 4) load second 100 sort letter by a-z (indexed) 5) load third 100 sort letter by a-z (indexed) Lock "./take_test.acebase/sort_indexed-letter.idx" timed out! lock.release() was not called in a timely fashion 6) 6 passing (3m) 6 failing 1) load first 100 sort letter by a-z (indexed) : Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at async Context.<anonymous> (acebasetake.spec.js:105:9) 2) load second 100 sort letter by a-z (indexed) : Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical) at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Context.<anonymous> (acebasetake.spec.js:113:9) 3) load third 100 sort letter by a-z (indexed) : Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at async Context.<anonymous> (acebasetake.spec.js:121:9) 4) load first 100 sort letter by z-a (indexed) : Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical) at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Context.<anonymous> (acebasetake.spec.js:130:9) 5) load second 100 sort letter by a-z (indexed) : Error: Error: ext_data values were not read yet. use entry.extData.loadValues() first at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at async Context.<anonymous> (acebasetake.spec.js:138:9) 6) load third 100 sort letter by a-z (indexed) : Error: Error: Could not achieve lock because the current lock ("./take_test.acebase/sort_indexed-letter.idx") was not released in time (and lock is flagged critical) at C:\System\lenlen\lendb-server\node_modules\acebase-core\dist\data-reference.js:845:19 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Context.<anonymous> (acebasetake.spec.js:146:9)
gitea-mirror 2026-05-23 08:28:24 -06:00
Author
Owner

@paradis-A commented on GitHub (Feb 23, 2022):

full test code:

const { AceBase, ID } = require("acebase");
var assert = require("assert");
const db = new AceBase("take_test", { logLevel: "error" });
const alphabet = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
];
const updates = {};
//Assuming that this already executed
// for (let i = 0; i < 2000; i++) {
//     updates[ID.generate()] = { letter: alphabet[Math.floor(Math.random() * 26)] };
// }
// describe("generate 2000 a-z non-indexed", function () {
//     this.timeout(Infinity);
//     it("", async function () {
//         await db.ref("sort").update(updates);
//         assert.ok(true);
//     });
// });

// describe("generate 2000 a-z indexed", function () {
//     this.timeout(Infinity);
//     it("", async function () {
//         await db.indexes.create("sort_indexed", "letter");
//         await db.ref("sort_indexed").update(updates);
//         assert.ok(true);
//     });
// });

describe("load first 100 sort letter by a-z (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter", true).take(100).get();
        assert.ok(true);
    });
});

describe("load second 100 sort letter by a-z (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter", true).skip(100).take(100).get();
        assert.ok(true);
    });
});

describe("load third 100 sort letter by a-z (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter", true).skip(200).take(100).get();
        assert.ok(true);
    });
});

describe("load first 100 sort letter by z-a (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter").take(100).get();
        assert.ok(true);
    });
});

describe("load second 100 sort letter by z-a (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter").skip(100).take(100).get();
        assert.ok(true);
    });
});

describe("load third 100 sort letter by z-a (non-indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort").sort("letter").skip(200).take(100).get();
        assert.ok(true);
    });
});

describe("load first 100 sort letter by a-z (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter", true).take(100).get();
        assert.ok(true);
    });
});

describe("load second 100 sort letter by a-z (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter", true).skip(100).take(100).get();
        assert.ok(true);
    });
});

describe("load third 100 sort letter by a-z (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter", true).skip(200).take(100).get();
        assert.ok(true);
    });
});


describe("load first 100 sort letter by z-a (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter").take(100).get();
        assert.ok(true);
    });
});

describe("load second 100 sort letter by a-z (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter").skip(100).take(100).get();
        assert.ok(true);
    });
});

describe("load third 100 sort letter by a-z (indexed)", function () {
    this.timeout(Infinity);
    it("", async function () {
        await db.query("sort_indexed").sort("letter").skip(200).take(100).get();
        assert.ok(true);
    });
});
<!-- gh-comment-id:1048402985 --> @paradis-A commented on GitHub (Feb 23, 2022): full test code: ```js const { AceBase, ID } = require("acebase"); var assert = require("assert"); const db = new AceBase("take_test", { logLevel: "error" }); const alphabet = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ]; const updates = {}; //Assuming that this already executed // for (let i = 0; i < 2000; i++) { // updates[ID.generate()] = { letter: alphabet[Math.floor(Math.random() * 26)] }; // } // describe("generate 2000 a-z non-indexed", function () { // this.timeout(Infinity); // it("", async function () { // await db.ref("sort").update(updates); // assert.ok(true); // }); // }); // describe("generate 2000 a-z indexed", function () { // this.timeout(Infinity); // it("", async function () { // await db.indexes.create("sort_indexed", "letter"); // await db.ref("sort_indexed").update(updates); // assert.ok(true); // }); // }); describe("load first 100 sort letter by a-z (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter", true).take(100).get(); assert.ok(true); }); }); describe("load second 100 sort letter by a-z (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter", true).skip(100).take(100).get(); assert.ok(true); }); }); describe("load third 100 sort letter by a-z (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter", true).skip(200).take(100).get(); assert.ok(true); }); }); describe("load first 100 sort letter by z-a (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter").take(100).get(); assert.ok(true); }); }); describe("load second 100 sort letter by z-a (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter").skip(100).take(100).get(); assert.ok(true); }); }); describe("load third 100 sort letter by z-a (non-indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort").sort("letter").skip(200).take(100).get(); assert.ok(true); }); }); describe("load first 100 sort letter by a-z (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter", true).take(100).get(); assert.ok(true); }); }); describe("load second 100 sort letter by a-z (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter", true).skip(100).take(100).get(); assert.ok(true); }); }); describe("load third 100 sort letter by a-z (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter", true).skip(200).take(100).get(); assert.ok(true); }); }); describe("load first 100 sort letter by z-a (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter").take(100).get(); assert.ok(true); }); }); describe("load second 100 sort letter by a-z (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter").skip(100).take(100).get(); assert.ok(true); }); }); describe("load third 100 sort letter by a-z (indexed)", function () { this.timeout(Infinity); it("", async function () { await db.query("sort_indexed").sort("letter").skip(200).take(100).get(); assert.ok(true); }); }); ```
Author
Owner

@appy-one commented on GitHub (Feb 23, 2022):

Fixed! Published with v1.15.1
Thanks for your report & tests @paradis-A 👍🏼

<!-- gh-comment-id:1048761532 --> @appy-one commented on GitHub (Feb 23, 2022): Fixed! Published with v1.15.1 Thanks for your report & tests @paradis-A 👍🏼
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#51
No description provided.