Просмотр исходного кода

[k8s] clsi-cache: double the number of shards (#32323)

* [k8s] clsi-cache: double the number of shards

* [monorepo] add missing clsi-cache env vars to dev-env

* [clsi] flip direction of clsi-cache shard migration

* [clsi] remove upper bound from clsi-cache shard migration

GitOrigin-RevId: a325a11c3ac9e22a12ad2d8ea802b91d2e175e24
Jakob Ackermann 4 месяцев назад
Родитель
Сommit
3aa69c6ffa

+ 3 - 4
services/clsi/app/js/CLSICacheHandler.js

@@ -34,8 +34,8 @@ const MAX_ENTRIES_IN_OUTPUT_TAR = 100
 const MAX_BLG_FILES = 50
 const OBJECT_ID_REGEX = /^[0-9a-f]{24}$/
 
-const MIGRATE_FROM = new Date('2026-01-14').getTime()
-const MIGRATE_UNTIL = new Date('2026-01-21').getTime()
+const MIGRATE_FROM = Settings.apis.clsiCache.reshardFrom
+const MIGRATE_UNTIL = Settings.apis.clsiCache.reshardUntil
 
 /**
  * @param {string} projectId
@@ -55,8 +55,7 @@ function getAvailableShard(projectId) {
   const now = Date.now()
   if (
     now > MIGRATE_FROM &&
-    now < MIGRATE_UNTIL &&
-    (counter % 100) / 100 <
+    (counter % 100) / 100 >
       (MIGRATE_UNTIL - now) / (MIGRATE_UNTIL - MIGRATE_FROM)
   ) {
     shards = Settings.apis.clsiCache.shards.slice(

+ 4 - 0
services/clsi/config/settings.defaults.cjs

@@ -61,6 +61,10 @@ module.exports = {
       shards: JSON.parse(process.env.CLSI_CACHE_INSTANCES || '[]').filter(
         ({ zone, readOnly }) => zone === process.env.ZONE && !readOnly
       ),
+      currentShards: parseInt(process.env.CLSI_CACHE_CURRENT_SHARDS, 10),
+      desiredShards: parseInt(process.env.CLSI_CACHE_DESIRED_SHARDS, 10),
+      reshardFrom: new Date(process.env.CLSI_CACHE_RESHARD_FROM),
+      reshardUntil: new Date(process.env.CLSI_CACHE_RESHARD_UNTIL),
     },
     filestore: {
       url: