MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / open

Method open

src/catalog/src/expr_cache.rs:156–191  ·  view source on GitHub ↗

Creates a new [`ExpressionCache`] and reconciles all entries in current build version. Reconciliation will remove all entries that are not in `current_ids` and remove all entries that have optimizer features that are not equal to `optimizer_features`. If `remove_prior_versions` is `true`, then all previous versions are durably removed from the cache. If `compact_shard` is `true`, then this funct

(
        ExpressionCacheConfig {
            build_version,
            persist,
            shard_id,
            current_ids,
            remove_prior_versions,
            compact_shard,
         

Source from the content-addressed store, hash-verified

154 ///
155 /// Returns all cached expressions in the current build version, after reconciliation.
156 pub async fn open(
157 ExpressionCacheConfig {
158 build_version,
159 persist,
160 shard_id,
161 current_ids,
162 remove_prior_versions,
163 compact_shard,
164 dyncfgs,
165 }: ExpressionCacheConfig,
166 ) -> (
167 Self,
168 BTreeMap<GlobalId, LocalExpressions>,
169 BTreeMap<GlobalId, GlobalExpressions>,
170 ) {
171 let durable_cache = DurableCache::new(&persist, shard_id, "expressions").await;
172 let mut cache = Self {
173 build_version,
174 durable_cache,
175 };
176
177 const RETRIES: usize = 100;
178 for _ in 0..RETRIES {
179 match cache
180 .try_open(&current_ids, remove_prior_versions, compact_shard, &dyncfgs)
181 .await
182 {
183 Ok((local_expressions, global_expressions)) => {
184 return (cache, local_expressions, global_expressions);
185 }
186 Err(err) => debug!("failed to open cache: {err} ... retrying"),
187 }
188 }
189
190 panic!("Unable to open expression cache after {RETRIES} retries");
191 }
192
193 async fn try_open(
194 &mut self,

Callers 15

mainFunction · 0.45
clientMethod · 0.45
runFunction · 0.45
test_debugFunction · 0.45
test_debug_edit_fencingFunction · 0.45
test_concurrent_debugsFunction · 0.45
test_allocate_idFunction · 0.45
test_audit_logsFunction · 0.45
test_itemsFunction · 0.45
test_schemasFunction · 0.45

Calls 1

try_openMethod · 0.80

Tested by 15

test_debugFunction · 0.36
test_debug_edit_fencingFunction · 0.36
test_concurrent_debugsFunction · 0.36
test_allocate_idFunction · 0.36
test_audit_logsFunction · 0.36
test_itemsFunction · 0.36
test_schemasFunction · 0.36
test_non_writer_commitsFunction · 0.36