From b81da9e16d9076c1ed9cced00e09e9167dfa4a2b Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Fri, 15 Jul 2022 08:22:41 +0200 Subject: [PATCH] comments, debchange --- debian/changelog | 8 ++++++++ src/siri/db/shard.c | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 30ecaedf..b21ebe0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +siridb-server (2.0.48-0~cb1) unstable; urgency=medium + + * New upstream release + - Implement smaller indexes for old data + - Added `head` and `tail` syntax queries (#180) + + -- Jeroen van der Heijden Fri, 15 Jul 2022 07:55:12 +0200 + siridb-server (2.0.47-0~cb1) unstable; urgency=medium * New upstream release diff --git a/src/siri/db/shard.c b/src/siri/db/shard.c index 01f5a0e2..c1552d76 100644 --- a/src/siri/db/shard.c +++ b/src/siri/db/shard.c @@ -466,18 +466,20 @@ siridb_shard_t * siridb_shard_create( else { shard->max_chunk_sz = replacing->max_chunk_sz; - if (tp == SIRIDB_SHARD_TP_NUMBER && shard->max_chunk_sz < 4000) + if (tp == SIRIDB_SHARD_TP_NUMBER && shard->max_chunk_sz < 2000) { uint64_t now_ts; struct timespec now; clock_gettime(CLOCK_REALTIME, &now); now_ts = siridb_time_now(siridb, now); - if (now_ts > id && (now_ts - id) > (duration * 3)) + if (now_ts > id && (now_ts - id) > (duration * 4)) { /* for numbers, we grow the max_chunk_size on each optimize; - * as soon as the shard is older than 3 times the duration */ - shard->max_chunk_sz *= 2; + * as soon as the shard is older than 4 times the duration; + * usually this happens only once, as afterwards, the max + * chunk-size exceeds 2000 points; */ + shard->max_chunk_sz <<= 2; /* 1200 * 4 = 4800 */ log_debug( "Grow chunk size for shard id %" PRIu64 " to %u", id, shard->max_chunk_sz); -- 2.30.2