comments, debchange
authorJeroen van der Heijden <jeroen@cesbit.com>
Fri, 15 Jul 2022 06:22:41 +0000 (08:22 +0200)
committerJeroen van der Heijden <jeroen@cesbit.com>
Fri, 15 Jul 2022 06:22:41 +0000 (08:22 +0200)
debian/changelog
src/siri/db/shard.c

index 30ecaedf14aeac932adc39352fbce00b8ad7e3a4..b21ebe0e2f331747b63d2f1718180d72c3e8c34a 100644 (file)
@@ -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 <jeroen@cesbit.com>  Fri, 15 Jul 2022 07:55:12 +0200
+
 siridb-server (2.0.47-0~cb1) unstable; urgency=medium
 
   * New upstream release
index 01f5a0e2759f9e7cb0aba457149fd00f40eb4f00..c1552d76b79af5ab0c1c68a31ebd407ca5cbb811 100644 (file)
@@ -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);