1mod execution_trace;
7#[cfg(test)]
8mod tests;
9
10use crate::{
11 db::{
12 Db, EntityRuntimeHooks,
13 commit::CommitRowOp,
14 data::{DataKey, StorageKey, decode_structural_row_cbor},
15 index::IndexKey,
16 registry::StoreHandle,
17 },
18 error::{ErrorClass, InternalError},
19 traits::{CanisterKind, Repr},
20 types::EntityTag,
21};
22use candid::CandidType;
23use serde::Deserialize;
24use std::collections::{BTreeMap, BTreeSet};
25
26pub use execution_trace::{
27 ExecutionAccessPathVariant, ExecutionMetrics, ExecutionOptimization, ExecutionTrace,
28};
29
30#[derive(CandidType, Clone, Debug, Default, Deserialize)]
36pub struct StorageReport {
37 pub(crate) storage_data: Vec<DataStoreSnapshot>,
38 pub(crate) storage_index: Vec<IndexStoreSnapshot>,
39 pub(crate) entity_storage: Vec<EntitySnapshot>,
40 pub(crate) corrupted_keys: u64,
41 pub(crate) corrupted_entries: u64,
42}
43
44#[derive(CandidType, Clone, Debug, Default, Deserialize)]
50pub struct IntegrityTotals {
51 pub(crate) data_rows_scanned: u64,
52 pub(crate) index_entries_scanned: u64,
53 pub(crate) corrupted_data_keys: u64,
54 pub(crate) corrupted_data_rows: u64,
55 pub(crate) corrupted_index_keys: u64,
56 pub(crate) corrupted_index_entries: u64,
57 pub(crate) missing_index_entries: u64,
58 pub(crate) divergent_index_entries: u64,
59 pub(crate) orphan_index_references: u64,
60 pub(crate) compatibility_findings: u64,
61 pub(crate) misuse_findings: u64,
62}
63
64impl IntegrityTotals {
65 const fn add_store_snapshot(&mut self, store: &IntegrityStoreSnapshot) {
66 self.data_rows_scanned = self
67 .data_rows_scanned
68 .saturating_add(store.data_rows_scanned);
69 self.index_entries_scanned = self
70 .index_entries_scanned
71 .saturating_add(store.index_entries_scanned);
72 self.corrupted_data_keys = self
73 .corrupted_data_keys
74 .saturating_add(store.corrupted_data_keys);
75 self.corrupted_data_rows = self
76 .corrupted_data_rows
77 .saturating_add(store.corrupted_data_rows);
78 self.corrupted_index_keys = self
79 .corrupted_index_keys
80 .saturating_add(store.corrupted_index_keys);
81 self.corrupted_index_entries = self
82 .corrupted_index_entries
83 .saturating_add(store.corrupted_index_entries);
84 self.missing_index_entries = self
85 .missing_index_entries
86 .saturating_add(store.missing_index_entries);
87 self.divergent_index_entries = self
88 .divergent_index_entries
89 .saturating_add(store.divergent_index_entries);
90 self.orphan_index_references = self
91 .orphan_index_references
92 .saturating_add(store.orphan_index_references);
93 self.compatibility_findings = self
94 .compatibility_findings
95 .saturating_add(store.compatibility_findings);
96 self.misuse_findings = self.misuse_findings.saturating_add(store.misuse_findings);
97 }
98
99 #[must_use]
101 pub const fn data_rows_scanned(&self) -> u64 {
102 self.data_rows_scanned
103 }
104
105 #[must_use]
107 pub const fn index_entries_scanned(&self) -> u64 {
108 self.index_entries_scanned
109 }
110
111 #[must_use]
113 pub const fn corrupted_data_keys(&self) -> u64 {
114 self.corrupted_data_keys
115 }
116
117 #[must_use]
119 pub const fn corrupted_data_rows(&self) -> u64 {
120 self.corrupted_data_rows
121 }
122
123 #[must_use]
125 pub const fn corrupted_index_keys(&self) -> u64 {
126 self.corrupted_index_keys
127 }
128
129 #[must_use]
131 pub const fn corrupted_index_entries(&self) -> u64 {
132 self.corrupted_index_entries
133 }
134
135 #[must_use]
137 pub const fn missing_index_entries(&self) -> u64 {
138 self.missing_index_entries
139 }
140
141 #[must_use]
143 pub const fn divergent_index_entries(&self) -> u64 {
144 self.divergent_index_entries
145 }
146
147 #[must_use]
149 pub const fn orphan_index_references(&self) -> u64 {
150 self.orphan_index_references
151 }
152
153 #[must_use]
155 pub const fn compatibility_findings(&self) -> u64 {
156 self.compatibility_findings
157 }
158
159 #[must_use]
161 pub const fn misuse_findings(&self) -> u64 {
162 self.misuse_findings
163 }
164}
165
166#[derive(CandidType, Clone, Debug, Default, Deserialize)]
172pub struct IntegrityStoreSnapshot {
173 pub(crate) path: String,
174 pub(crate) data_rows_scanned: u64,
175 pub(crate) index_entries_scanned: u64,
176 pub(crate) corrupted_data_keys: u64,
177 pub(crate) corrupted_data_rows: u64,
178 pub(crate) corrupted_index_keys: u64,
179 pub(crate) corrupted_index_entries: u64,
180 pub(crate) missing_index_entries: u64,
181 pub(crate) divergent_index_entries: u64,
182 pub(crate) orphan_index_references: u64,
183 pub(crate) compatibility_findings: u64,
184 pub(crate) misuse_findings: u64,
185}
186
187impl IntegrityStoreSnapshot {
188 #[must_use]
190 pub fn new(path: String) -> Self {
191 Self {
192 path,
193 ..Self::default()
194 }
195 }
196
197 #[must_use]
199 pub const fn path(&self) -> &str {
200 self.path.as_str()
201 }
202
203 #[must_use]
205 pub const fn data_rows_scanned(&self) -> u64 {
206 self.data_rows_scanned
207 }
208
209 #[must_use]
211 pub const fn index_entries_scanned(&self) -> u64 {
212 self.index_entries_scanned
213 }
214
215 #[must_use]
217 pub const fn corrupted_data_keys(&self) -> u64 {
218 self.corrupted_data_keys
219 }
220
221 #[must_use]
223 pub const fn corrupted_data_rows(&self) -> u64 {
224 self.corrupted_data_rows
225 }
226
227 #[must_use]
229 pub const fn corrupted_index_keys(&self) -> u64 {
230 self.corrupted_index_keys
231 }
232
233 #[must_use]
235 pub const fn corrupted_index_entries(&self) -> u64 {
236 self.corrupted_index_entries
237 }
238
239 #[must_use]
241 pub const fn missing_index_entries(&self) -> u64 {
242 self.missing_index_entries
243 }
244
245 #[must_use]
247 pub const fn divergent_index_entries(&self) -> u64 {
248 self.divergent_index_entries
249 }
250
251 #[must_use]
253 pub const fn orphan_index_references(&self) -> u64 {
254 self.orphan_index_references
255 }
256
257 #[must_use]
259 pub const fn compatibility_findings(&self) -> u64 {
260 self.compatibility_findings
261 }
262
263 #[must_use]
265 pub const fn misuse_findings(&self) -> u64 {
266 self.misuse_findings
267 }
268}
269
270#[derive(CandidType, Clone, Debug, Default, Deserialize)]
276pub struct IntegrityReport {
277 pub(crate) stores: Vec<IntegrityStoreSnapshot>,
278 pub(crate) totals: IntegrityTotals,
279}
280
281impl IntegrityReport {
282 #[must_use]
284 pub const fn new(stores: Vec<IntegrityStoreSnapshot>, totals: IntegrityTotals) -> Self {
285 Self { stores, totals }
286 }
287
288 #[must_use]
290 pub const fn stores(&self) -> &[IntegrityStoreSnapshot] {
291 self.stores.as_slice()
292 }
293
294 #[must_use]
296 pub const fn totals(&self) -> &IntegrityTotals {
297 &self.totals
298 }
299}
300
301impl StorageReport {
302 #[must_use]
304 pub const fn new(
305 storage_data: Vec<DataStoreSnapshot>,
306 storage_index: Vec<IndexStoreSnapshot>,
307 entity_storage: Vec<EntitySnapshot>,
308 corrupted_keys: u64,
309 corrupted_entries: u64,
310 ) -> Self {
311 Self {
312 storage_data,
313 storage_index,
314 entity_storage,
315 corrupted_keys,
316 corrupted_entries,
317 }
318 }
319
320 #[must_use]
322 pub const fn storage_data(&self) -> &[DataStoreSnapshot] {
323 self.storage_data.as_slice()
324 }
325
326 #[must_use]
328 pub const fn storage_index(&self) -> &[IndexStoreSnapshot] {
329 self.storage_index.as_slice()
330 }
331
332 #[must_use]
334 pub const fn entity_storage(&self) -> &[EntitySnapshot] {
335 self.entity_storage.as_slice()
336 }
337
338 #[must_use]
340 pub const fn corrupted_keys(&self) -> u64 {
341 self.corrupted_keys
342 }
343
344 #[must_use]
346 pub const fn corrupted_entries(&self) -> u64 {
347 self.corrupted_entries
348 }
349}
350
351#[derive(CandidType, Clone, Debug, Default, Deserialize)]
357pub struct DataStoreSnapshot {
358 pub(crate) path: String,
359 pub(crate) entries: u64,
360 pub(crate) memory_bytes: u64,
361}
362
363impl DataStoreSnapshot {
364 #[must_use]
366 pub const fn new(path: String, entries: u64, memory_bytes: u64) -> Self {
367 Self {
368 path,
369 entries,
370 memory_bytes,
371 }
372 }
373
374 #[must_use]
376 pub const fn path(&self) -> &str {
377 self.path.as_str()
378 }
379
380 #[must_use]
382 pub const fn entries(&self) -> u64 {
383 self.entries
384 }
385
386 #[must_use]
388 pub const fn memory_bytes(&self) -> u64 {
389 self.memory_bytes
390 }
391}
392
393#[derive(CandidType, Clone, Debug, Default, Deserialize)]
399pub struct IndexStoreSnapshot {
400 pub(crate) path: String,
401 pub(crate) entries: u64,
402 pub(crate) user_entries: u64,
403 pub(crate) system_entries: u64,
404 pub(crate) memory_bytes: u64,
405}
406
407impl IndexStoreSnapshot {
408 #[must_use]
410 pub const fn new(
411 path: String,
412 entries: u64,
413 user_entries: u64,
414 system_entries: u64,
415 memory_bytes: u64,
416 ) -> Self {
417 Self {
418 path,
419 entries,
420 user_entries,
421 system_entries,
422 memory_bytes,
423 }
424 }
425
426 #[must_use]
428 pub const fn path(&self) -> &str {
429 self.path.as_str()
430 }
431
432 #[must_use]
434 pub const fn entries(&self) -> u64 {
435 self.entries
436 }
437
438 #[must_use]
440 pub const fn user_entries(&self) -> u64 {
441 self.user_entries
442 }
443
444 #[must_use]
446 pub const fn system_entries(&self) -> u64 {
447 self.system_entries
448 }
449
450 #[must_use]
452 pub const fn memory_bytes(&self) -> u64 {
453 self.memory_bytes
454 }
455}
456
457#[derive(CandidType, Clone, Debug, Default, Deserialize)]
463pub struct EntitySnapshot {
464 pub(crate) store: String,
466
467 pub(crate) path: String,
469
470 pub(crate) entries: u64,
472
473 pub(crate) memory_bytes: u64,
475
476 pub(crate) min_key: Option<String>,
478
479 pub(crate) max_key: Option<String>,
481}
482
483impl EntitySnapshot {
484 #[must_use]
486 pub fn new(
487 store: String,
488 path: String,
489 entries: u64,
490 memory_bytes: u64,
491 min_key: Option<StorageKey>,
492 max_key: Option<StorageKey>,
493 ) -> Self {
494 Self {
495 store,
496 path,
497 entries,
498 memory_bytes,
499 min_key: min_key.map(Self::storage_key_text),
500 max_key: max_key.map(Self::storage_key_text),
501 }
502 }
503
504 fn storage_key_text(key: StorageKey) -> String {
507 match key {
508 StorageKey::Account(value) => value.to_string(),
509 StorageKey::Int(value) => value.to_string(),
510 StorageKey::Principal(value) => value.to_string(),
511 StorageKey::Subaccount(value) => value.to_string(),
512 StorageKey::Timestamp(value) => value.repr().to_string(),
513 StorageKey::Uint(value) => value.to_string(),
514 StorageKey::Ulid(value) => value.to_string(),
515 StorageKey::Unit => "()".to_string(),
516 }
517 }
518
519 #[must_use]
521 pub const fn store(&self) -> &str {
522 self.store.as_str()
523 }
524
525 #[must_use]
527 pub const fn path(&self) -> &str {
528 self.path.as_str()
529 }
530
531 #[must_use]
533 pub const fn entries(&self) -> u64 {
534 self.entries
535 }
536
537 #[must_use]
539 pub const fn memory_bytes(&self) -> u64 {
540 self.memory_bytes
541 }
542
543 #[must_use]
545 pub fn min_key(&self) -> Option<&str> {
546 self.min_key.as_deref()
547 }
548
549 #[must_use]
551 pub fn max_key(&self) -> Option<&str> {
552 self.max_key.as_deref()
553 }
554}
555
556#[derive(Default)]
562struct EntityStats {
563 entries: u64,
564 memory_bytes: u64,
565 min_key: Option<StorageKey>,
566 max_key: Option<StorageKey>,
567}
568
569impl EntityStats {
570 fn update(&mut self, dk: &DataKey, value_len: u64) {
572 self.entries = self.entries.saturating_add(1);
573 self.memory_bytes = self
574 .memory_bytes
575 .saturating_add(DataKey::entry_size_bytes(value_len));
576
577 let k = dk.storage_key();
578
579 match &mut self.min_key {
580 Some(min) if k < *min => *min = k,
581 None => self.min_key = Some(k),
582 _ => {}
583 }
584
585 match &mut self.max_key {
586 Some(max) if k > *max => *max = k,
587 None => self.max_key = Some(k),
588 _ => {}
589 }
590 }
591}
592
593fn storage_report_name_for_hook<'a, C: CanisterKind>(
594 name_map: &BTreeMap<&'static str, &'a str>,
595 hooks: &EntityRuntimeHooks<C>,
596) -> &'a str {
597 name_map
598 .get(hooks.entity_path)
599 .copied()
600 .or_else(|| name_map.get(hooks.model.name()).copied())
601 .unwrap_or(hooks.entity_path)
602}
603
604pub(crate) fn storage_report<C: CanisterKind>(
609 db: &Db<C>,
610 name_to_path: &[(&'static str, &'static str)],
611) -> Result<StorageReport, InternalError> {
612 db.ensure_recovered_state()?;
613 let name_map: BTreeMap<&'static str, &str> = name_to_path.iter().copied().collect();
617 let mut tag_name_map = BTreeMap::<EntityTag, &str>::new();
618 for hooks in db.entity_runtime_hooks {
619 tag_name_map
620 .entry(hooks.entity_tag)
621 .or_insert_with(|| storage_report_name_for_hook(&name_map, hooks));
622 }
623 let mut data = Vec::new();
624 let mut index = Vec::new();
625 let mut entity_storage: Vec<EntitySnapshot> = Vec::new();
626 let mut corrupted_keys = 0u64;
627 let mut corrupted_entries = 0u64;
628
629 db.with_store_registry(|reg| {
630 let mut stores = reg.iter().collect::<Vec<_>>();
632 stores.sort_by_key(|(path, _)| *path);
633
634 for (path, store_handle) in stores {
635 store_handle.with_data(|store| {
637 data.push(DataStoreSnapshot::new(
638 path.to_string(),
639 store.len(),
640 store.memory_bytes(),
641 ));
642
643 let mut by_entity: BTreeMap<EntityTag, EntityStats> = BTreeMap::new();
645
646 for entry in store.iter() {
647 let Ok(dk) = DataKey::try_from_raw(entry.key()) else {
648 corrupted_keys = corrupted_keys.saturating_add(1);
649 continue;
650 };
651
652 let value_len = entry.value().len() as u64;
653
654 by_entity
655 .entry(dk.entity_tag())
656 .or_default()
657 .update(&dk, value_len);
658 }
659
660 for (entity_tag, stats) in by_entity {
661 let path_name = tag_name_map
662 .get(&entity_tag)
663 .copied()
664 .map(str::to_string)
665 .or_else(|| {
666 db.runtime_hook_for_entity_tag(entity_tag)
667 .ok()
668 .map(|hooks| {
669 storage_report_name_for_hook(&name_map, hooks).to_string()
670 })
671 })
672 .unwrap_or_else(|| format!("#{}", entity_tag.value()));
673 entity_storage.push(EntitySnapshot::new(
674 path.to_string(),
675 path_name,
676 stats.entries,
677 stats.memory_bytes,
678 stats.min_key,
679 stats.max_key,
680 ));
681 }
682 });
683
684 store_handle.with_index(|store| {
686 let mut user_entries = 0u64;
687 let mut system_entries = 0u64;
688
689 for (key, value) in store.entries() {
690 let Ok(decoded_key) = IndexKey::try_from_raw(&key) else {
691 corrupted_entries = corrupted_entries.saturating_add(1);
692 continue;
693 };
694
695 if decoded_key.uses_system_namespace() {
696 system_entries = system_entries.saturating_add(1);
697 } else {
698 user_entries = user_entries.saturating_add(1);
699 }
700
701 if value.validate().is_err() {
702 corrupted_entries = corrupted_entries.saturating_add(1);
703 }
704 }
705
706 index.push(IndexStoreSnapshot::new(
707 path.to_string(),
708 store.len(),
709 user_entries,
710 system_entries,
711 store.memory_bytes(),
712 ));
713 });
714 }
715 });
716
717 entity_storage
720 .sort_by(|left, right| (left.store(), left.path()).cmp(&(right.store(), right.path())));
721
722 Ok(StorageReport::new(
723 data,
724 index,
725 entity_storage,
726 corrupted_keys,
727 corrupted_entries,
728 ))
729}
730
731pub(crate) fn integrity_report<C: CanisterKind>(
738 db: &Db<C>,
739) -> Result<IntegrityReport, InternalError> {
740 db.ensure_recovered_state()?;
741
742 integrity_report_after_recovery(db)
743}
744
745pub(in crate::db) fn integrity_report_after_recovery<C: CanisterKind>(
750 db: &Db<C>,
751) -> Result<IntegrityReport, InternalError> {
752 build_integrity_report(db)
753}
754
755fn build_integrity_report<C: CanisterKind>(db: &Db<C>) -> Result<IntegrityReport, InternalError> {
756 let mut stores = Vec::new();
757 let mut totals = IntegrityTotals::default();
758 let global_live_keys_by_entity = collect_global_live_keys_by_entity(db)?;
759
760 db.with_store_registry(|reg| {
761 let mut store_entries = reg.iter().collect::<Vec<_>>();
763 store_entries.sort_by_key(|(path, _)| *path);
764
765 for (path, store_handle) in store_entries {
766 let mut snapshot = IntegrityStoreSnapshot::new(path.to_string());
767 scan_store_forward_integrity(db, store_handle, &mut snapshot)?;
768 scan_store_reverse_integrity(store_handle, &global_live_keys_by_entity, &mut snapshot);
769
770 totals.add_store_snapshot(&snapshot);
771 stores.push(snapshot);
772 }
773
774 Ok::<(), InternalError>(())
775 })?;
776
777 Ok(IntegrityReport::new(stores, totals))
778}
779
780fn collect_global_live_keys_by_entity<C: CanisterKind>(
782 db: &Db<C>,
783) -> Result<BTreeMap<EntityTag, BTreeSet<StorageKey>>, InternalError> {
784 let mut keys = BTreeMap::<EntityTag, BTreeSet<StorageKey>>::new();
785
786 db.with_store_registry(|reg| {
787 for (_, store_handle) in reg.iter() {
788 store_handle.with_data(|data_store| {
789 for entry in data_store.iter() {
790 if let Ok(data_key) = DataKey::try_from_raw(entry.key()) {
791 keys.entry(data_key.entity_tag())
792 .or_default()
793 .insert(data_key.storage_key());
794 }
795 }
796 });
797 }
798
799 Ok::<(), InternalError>(())
800 })?;
801
802 Ok(keys)
803}
804
805fn scan_store_forward_integrity<C: CanisterKind>(
807 db: &Db<C>,
808 store_handle: StoreHandle,
809 snapshot: &mut IntegrityStoreSnapshot,
810) -> Result<(), InternalError> {
811 store_handle.with_data(|data_store| {
812 for entry in data_store.iter() {
813 snapshot.data_rows_scanned = snapshot.data_rows_scanned.saturating_add(1);
814
815 let raw_key = *entry.key();
816
817 let Ok(data_key) = DataKey::try_from_raw(&raw_key) else {
818 snapshot.corrupted_data_keys = snapshot.corrupted_data_keys.saturating_add(1);
819 continue;
820 };
821
822 let hooks = match db.runtime_hook_for_entity_tag(data_key.entity_tag()) {
823 Ok(hooks) => hooks,
824 Err(err) => {
825 classify_scan_error(err, snapshot)?;
826 continue;
827 }
828 };
829
830 let marker_row = CommitRowOp::new(
831 hooks.entity_path,
832 raw_key.as_bytes().to_vec(),
833 None,
834 Some(entry.value().as_bytes().to_vec()),
835 crate::db::schema::commit_schema_fingerprint_for_model(
836 hooks.entity_path,
837 hooks.model,
838 ),
839 );
840
841 if let Err(err) = decode_structural_row_cbor(&entry.value()) {
844 classify_scan_error(err, snapshot)?;
845 continue;
846 }
847
848 let prepared = match db.prepare_row_commit_op(&marker_row) {
849 Ok(prepared) => prepared,
850 Err(err) => {
851 classify_scan_error(err, snapshot)?;
852 continue;
853 }
854 };
855
856 for index_op in prepared.index_ops {
857 let Some(expected_value) = index_op.value else {
858 continue;
859 };
860
861 let actual = index_op
862 .store
863 .with_borrow(|index_store| index_store.get(&index_op.key));
864 match actual {
865 Some(actual_value) if actual_value == expected_value => {}
866 Some(_) => {
867 snapshot.divergent_index_entries =
868 snapshot.divergent_index_entries.saturating_add(1);
869 }
870 None => {
871 snapshot.missing_index_entries =
872 snapshot.missing_index_entries.saturating_add(1);
873 }
874 }
875 }
876 }
877
878 Ok::<(), InternalError>(())
879 })
880}
881
882fn scan_store_reverse_integrity(
884 store_handle: StoreHandle,
885 live_keys_by_entity: &BTreeMap<EntityTag, BTreeSet<StorageKey>>,
886 snapshot: &mut IntegrityStoreSnapshot,
887) {
888 store_handle.with_index(|index_store| {
889 for (raw_index_key, raw_index_entry) in index_store.entries() {
890 snapshot.index_entries_scanned = snapshot.index_entries_scanned.saturating_add(1);
891
892 let Ok(decoded_index_key) = IndexKey::try_from_raw(&raw_index_key) else {
893 snapshot.corrupted_index_keys = snapshot.corrupted_index_keys.saturating_add(1);
894 continue;
895 };
896
897 let index_entity_tag = data_entity_tag_for_index_key(&decoded_index_key);
898
899 let Ok(indexed_primary_keys) = raw_index_entry.decode_keys() else {
900 snapshot.corrupted_index_entries =
901 snapshot.corrupted_index_entries.saturating_add(1);
902 continue;
903 };
904
905 for primary_key in indexed_primary_keys {
906 let exists = live_keys_by_entity
907 .get(&index_entity_tag)
908 .is_some_and(|entity_keys| entity_keys.contains(&primary_key));
909 if !exists {
910 snapshot.orphan_index_references =
911 snapshot.orphan_index_references.saturating_add(1);
912 }
913 }
914 }
915 });
916}
917
918fn classify_scan_error(
920 err: InternalError,
921 snapshot: &mut IntegrityStoreSnapshot,
922) -> Result<(), InternalError> {
923 match err.class() {
924 ErrorClass::Corruption => {
925 snapshot.corrupted_data_rows = snapshot.corrupted_data_rows.saturating_add(1);
926 Ok(())
927 }
928 ErrorClass::IncompatiblePersistedFormat => {
929 snapshot.compatibility_findings = snapshot.compatibility_findings.saturating_add(1);
930 Ok(())
931 }
932 ErrorClass::Unsupported | ErrorClass::NotFound | ErrorClass::Conflict => {
933 snapshot.misuse_findings = snapshot.misuse_findings.saturating_add(1);
934 Ok(())
935 }
936 ErrorClass::Internal | ErrorClass::InvariantViolation => Err(err),
937 }
938}
939
940const fn data_entity_tag_for_index_key(index_key: &IndexKey) -> EntityTag {
942 index_key.index_id().entity_tag
943}