Compare commits

..

3 Commits

Author SHA1 Message Date
Vitaliy Filippov 7b11eb7313 Try new PG combinator in tests
Test / test_rm (push) Successful in 13s Details
Test / test_snapshot_chain (push) Successful in 1m4s Details
Test / test_snapshot_chain_ec (push) Successful in 1m27s Details
Test / test_snapshot_down (push) Successful in 21s Details
Test / test_interrupted_rebalance_ec (push) Successful in 6m36s Details
Test / test_snapshot_down_ec (push) Successful in 22s Details
Test / test_splitbrain (push) Successful in 16s Details
Test / test_rebalance_verify_imm (push) Successful in 3m15s Details
Test / test_write (push) Successful in 46s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 2m47s Details
Test / test_write_no_same (push) Successful in 14s Details
Test / test_rebalance_verify (push) Successful in 5m13s Details
Test / test_rebalance_verify_ec (push) Successful in 4m13s Details
Test / test_heal_pg_size_2 (push) Successful in 3m49s Details
Test / test_heal_ec (push) Successful in 4m39s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m34s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m48s Details
Test / test_heal_csum_32k (push) Successful in 6m25s Details
Test / test_scrub (push) Successful in 42s Details
Test / test_scrub_zero_osd_2 (push) Successful in 48s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m58s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m31s Details
Test / test_scrub_xor (push) Successful in 38s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 54s Details
Test / test_scrub_ec (push) Successful in 44s Details
Test / test_heal_csum_4k (push) Successful in 6m1s Details
Test / test_etcd_fail (push) Successful in 42s Details
Test / test_interrupted_rebalance (push) Successful in 1m14s Details
Test / test_scrub_pg_size_3 (push) Successful in 39s Details
Test / test_write_xor (push) Successful in 33s Details
2024-01-02 12:47:14 +03:00
Vitaliy Filippov 2dacc1b5a7 Plug the new PG combinator into monitor 2024-01-02 12:47:14 +03:00
Vitaliy Filippov 73ff8c6406 Implement new DSL/rule-based PG generation algorithm 2024-01-02 12:47:14 +03:00
2 changed files with 44 additions and 36 deletions

View File

@ -1,3 +1,5 @@
const { select_murmur3 } = require('./murmur3.js');
const NO_OSD = 'Z';
class RuleCombinator
@ -250,7 +252,8 @@ function random_custom_combinations(osd_tree, rules, count, ordered)
for (let i = 1; i < rules.length; i++)
{
const filtered = filter_tree_by_rules(osd_tree, rules[i], selected);
selected.push(select_murmur3(filtered, 'p:'+f.id));
const idx = select_murmur3(filtered.length, i => 'p:'+f.id+':'+filtered[i].id);
selected.push(idx == null ? { levels: {}, id: null } : filtered[idx]);
}
const size = selected.filter(s => s.id !== null).length;
max_size = max_size < size ? size : max_size;
@ -266,7 +269,8 @@ function random_custom_combinations(osd_tree, rules, count, ordered)
for (const item_rules of rules)
{
const filtered = selected.length ? filter_tree_by_rules(osd_tree, item_rules, selected) : first;
selected.push(select_murmur3(filtered, n));
const idx = select_murmur3(filtered.length, i => n+':'+filtered[i].id);
selected.push(idx == null ? { levels: {}, id: null } : filtered[idx]);
}
const size = selected.filter(s => s.id !== null).length;
max_size = max_size < size ? size : max_size;
@ -286,40 +290,6 @@ function random_custom_combinations(osd_tree, rules, count, ordered)
return r;
}
function select_murmur3(filtered, prefix)
{
if (!filtered.length)
{
return { levels: {}, id: null };
}
else
{
let i = 0, maxh = -1;
for (let j = 0; j < filtered.length; j++)
{
const h = murmur3(prefix+':'+filtered[j].id);
if (h > maxh)
{
i = j;
maxh = h;
}
}
return filtered[i];
}
}
function murmur3(s)
{
let hash = 0x12345678;
for (let i = 0; i < s.length; i++)
{
hash ^= s.charCodeAt(i);
hash = (hash*0x5bd1e995) & 0xFFFFFFFF;
hash ^= (hash >> 15);
}
return hash;
}
function filter_tree_by_rules(osd_tree, rules, selected)
{
let cur = osd_tree[''].children;

38
mon/murmur3.js Normal file
View File

@ -0,0 +1,38 @@
function select_murmur3(count, cb)
{
if (!count)
{
return null;
}
else
{
let i = 0, maxh = -1;
for (let j = 0; j < count; j++)
{
const h = murmur3(cb(j));
if (h > maxh)
{
i = j;
maxh = h;
}
}
return i;
}
}
function murmur3(s)
{
let hash = 0x12345678;
for (let i = 0; i < s.length; i++)
{
hash ^= s.charCodeAt(i);
hash = (hash*0x5bd1e995) & 0xFFFFFFFF;
hash ^= (hash >> 15);
}
return hash;
}
module.exports = {
murmur3,
select_murmur3,
};