Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 73ae6a0

Browse files
committed
Downgrade salsa log levels
1 parent 022bece commit 73ae6a0

File tree

8 files changed

+86
-68
lines changed

8 files changed

+86
-68
lines changed

src/tools/rust-analyzer/crates/ra-salsa/ra-salsa-macros/src/query_group.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
242242
let tracing = if let QueryStorage::Memoized | QueryStorage::LruMemoized = query.storage {
243243
let s = format!("{trait_name}::{fn_name}");
244244
Some(quote! {
245-
let _p = tracing::debug_span!(#s, #(#key_names = tracing::field::debug(&#key_names)),*).entered();
245+
let _p = tracing::trace_span!(#s, #(#key_names = tracing::field::debug(&#key_names)),*).entered();
246246
})
247247
} else {
248248
None

src/tools/rust-analyzer/crates/ra-salsa/src/derived/slot.rs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{Database, DatabaseKeyIndex, Event, EventKind, QueryDb};
1313
use parking_lot::{RawRwLock, RwLock};
1414
use std::ops::Deref;
1515
use std::sync::atomic::{AtomicBool, Ordering};
16-
use tracing::{debug, info};
16+
use tracing::trace;
1717

1818
pub(super) struct Slot<Q>
1919
where
@@ -126,7 +126,7 @@ where
126126
// doing any `set` invocations while the query function runs.
127127
let revision_now = runtime.current_revision();
128128

129-
info!("{:?}: invoked at {:?}", self, revision_now,);
129+
trace!("{:?}: invoked at {:?}", self, revision_now,);
130130

131131
// First, do a check with a read-lock.
132132
loop {
@@ -152,7 +152,7 @@ where
152152
) -> StampedValue<Q::Value> {
153153
let runtime = db.salsa_runtime();
154154

155-
debug!("{:?}: read_upgrade(revision_now={:?})", self, revision_now,);
155+
trace!("{:?}: read_upgrade(revision_now={:?})", self, revision_now,);
156156

157157
// Check with an upgradable read to see if there is a value
158158
// already. (This permits other readers but prevents anyone
@@ -184,7 +184,7 @@ where
184184
// inputs and check whether they are out of date.
185185
if let Some(memo) = &mut old_memo {
186186
if let Some(value) = memo.verify_value(db.ops_database(), revision_now, &active_query) {
187-
info!("{:?}: validated old memoized value", self,);
187+
trace!("{:?}: validated old memoized value", self,);
188188

189189
db.salsa_event(Event {
190190
runtime_id: runtime.id(),
@@ -212,7 +212,7 @@ where
212212
old_memo: Option<Memo<Q::Value>>,
213213
key: &Q::Key,
214214
) -> StampedValue<Q::Value> {
215-
tracing::info!("{:?}: executing query", self.database_key_index().debug(db));
215+
tracing::trace!("{:?}: executing query", self.database_key_index().debug(db));
216216

217217
db.salsa_event(Event {
218218
runtime_id: db.salsa_runtime().id(),
@@ -224,7 +224,7 @@ where
224224
let value = match Cycle::catch(|| Q::execute(db, key.clone())) {
225225
Ok(v) => v,
226226
Err(cycle) => {
227-
tracing::debug!(
227+
tracing::trace!(
228228
"{:?}: caught cycle {:?}, have strategy {:?}",
229229
self.database_key_index().debug(db),
230230
cycle,
@@ -272,9 +272,10 @@ where
272272
// consumers must be aware of. Becoming *more* durable
273273
// is not. See the test `constant_to_non_constant`.
274274
if revisions.durability >= old_memo.revisions.durability && old_memo.value == value {
275-
debug!(
275+
trace!(
276276
"read_upgrade({:?}): value is equal, back-dating to {:?}",
277-
self, old_memo.revisions.changed_at,
277+
self,
278+
old_memo.revisions.changed_at,
278279
);
279280

280281
assert!(old_memo.revisions.changed_at <= revisions.changed_at);
@@ -290,7 +291,7 @@ where
290291

291292
let memo_value = new_value.value.clone();
292293

293-
debug!("read_upgrade({:?}): result.revisions = {:#?}", self, revisions,);
294+
trace!("read_upgrade({:?}): result.revisions = {:#?}", self, revisions,);
294295

295296
panic_guard.proceed(Some(Memo { value: memo_value, verified_at: revision_now, revisions }));
296297

@@ -339,9 +340,11 @@ where
339340
}
340341

341342
QueryState::Memoized(memo) => {
342-
debug!(
343+
trace!(
343344
"{:?}: found memoized value, verified_at={:?}, changed_at={:?}",
344-
self, memo.verified_at, memo.revisions.changed_at,
345+
self,
346+
memo.verified_at,
347+
memo.revisions.changed_at,
345348
);
346349

347350
if memo.verified_at < revision_now {
@@ -355,7 +358,7 @@ where
355358
value: value.clone(),
356359
};
357360

358-
info!("{:?}: returning memoized value changed at {:?}", self, value.changed_at);
361+
trace!("{:?}: returning memoized value changed at {:?}", self, value.changed_at);
359362

360363
ProbeState::UpToDate(value)
361364
}
@@ -387,7 +390,7 @@ where
387390
}
388391

389392
pub(super) fn invalidate(&self, new_revision: Revision) -> Option<Durability> {
390-
tracing::debug!("Slot::invalidate(new_revision = {:?})", new_revision);
393+
tracing::trace!("Slot::invalidate(new_revision = {:?})", new_revision);
391394
match &mut *self.state.write() {
392395
QueryState::Memoized(memo) => {
393396
memo.revisions.untracked = true;
@@ -411,9 +414,11 @@ where
411414

412415
db.unwind_if_cancelled();
413416

414-
debug!(
417+
trace!(
415418
"maybe_changed_after({:?}) called with revision={:?}, revision_now={:?}",
416-
self, revision, revision_now,
419+
self,
420+
revision,
421+
revision_now,
417422
);
418423

419424
// Do an initial probe with just the read-lock.
@@ -680,9 +685,11 @@ where
680685
assert!(self.verified_at != revision_now);
681686
let verified_at = self.verified_at;
682687

683-
debug!(
688+
trace!(
684689
"verify_revisions: verified_at={:?}, revision_now={:?}, inputs={:#?}",
685-
verified_at, revision_now, self.revisions.inputs
690+
verified_at,
691+
revision_now,
692+
self.revisions.inputs
686693
);
687694

688695
if self.check_durability(db.salsa_runtime()) {
@@ -708,7 +715,7 @@ where
708715
let changed_input =
709716
inputs.slice.iter().find(|&&input| db.maybe_changed_after(input, verified_at));
710717
if let Some(input) = changed_input {
711-
debug!("validate_memoized_value: `{:?}` may have changed", input);
718+
trace!("validate_memoized_value: `{:?}` may have changed", input);
712719

713720
return false;
714721
}
@@ -721,7 +728,7 @@ where
721728
/// True if this memo is known not to have changed based on its durability.
722729
fn check_durability(&self, runtime: &Runtime) -> bool {
723730
let last_changed = runtime.last_changed_revision(self.revisions.durability);
724-
debug!(
731+
trace!(
725732
"check_durability(last_changed={:?} <= verified_at={:?}) = {:?}",
726733
last_changed,
727734
self.verified_at,

src/tools/rust-analyzer/crates/ra-salsa/src/derived_lru/slot.rs

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use parking_lot::{RawRwLock, RwLock};
1717
use std::marker::PhantomData;
1818
use std::ops::Deref;
1919
use std::sync::atomic::{AtomicBool, Ordering};
20-
use tracing::{debug, info};
20+
use tracing::trace;
2121

2222
pub(super) struct Slot<Q, MP>
2323
where
@@ -140,7 +140,7 @@ where
140140
// doing any `set` invocations while the query function runs.
141141
let revision_now = runtime.current_revision();
142142

143-
info!("{:?}: invoked at {:?}", self, revision_now,);
143+
trace!("{:?}: invoked at {:?}", self, revision_now,);
144144

145145
// First, do a check with a read-lock.
146146
loop {
@@ -168,7 +168,7 @@ where
168168
) -> StampedValue<Q::Value> {
169169
let runtime = db.salsa_runtime();
170170

171-
debug!("{:?}: read_upgrade(revision_now={:?})", self, revision_now,);
171+
trace!("{:?}: read_upgrade(revision_now={:?})", self, revision_now,);
172172

173173
// Check with an upgradable read to see if there is a value
174174
// already. (This permits other readers but prevents anyone
@@ -202,7 +202,7 @@ where
202202
// inputs and check whether they are out of date.
203203
if let Some(memo) = &mut old_memo {
204204
if let Some(value) = memo.verify_value(db.ops_database(), revision_now, &active_query) {
205-
info!("{:?}: validated old memoized value", self,);
205+
trace!("{:?}: validated old memoized value", self,);
206206

207207
db.salsa_event(Event {
208208
runtime_id: runtime.id(),
@@ -230,7 +230,7 @@ where
230230
old_memo: Option<Memo<Q::Value>>,
231231
key: &Q::Key,
232232
) -> StampedValue<Q::Value> {
233-
tracing::info!("{:?}: executing query", self.database_key_index().debug(db));
233+
tracing::trace!("{:?}: executing query", self.database_key_index().debug(db));
234234

235235
db.salsa_event(Event {
236236
runtime_id: db.salsa_runtime().id(),
@@ -242,7 +242,7 @@ where
242242
let value = match Cycle::catch(|| Q::execute(db, key.clone())) {
243243
Ok(v) => v,
244244
Err(cycle) => {
245-
tracing::debug!(
245+
tracing::trace!(
246246
"{:?}: caught cycle {:?}, have strategy {:?}",
247247
self.database_key_index().debug(db),
248248
cycle,
@@ -293,9 +293,10 @@ where
293293
if revisions.durability >= old_memo.revisions.durability
294294
&& MP::memoized_value_eq(old_value, &value)
295295
{
296-
debug!(
296+
trace!(
297297
"read_upgrade({:?}): value is equal, back-dating to {:?}",
298-
self, old_memo.revisions.changed_at,
298+
self,
299+
old_memo.revisions.changed_at,
299300
);
300301

301302
assert!(old_memo.revisions.changed_at <= revisions.changed_at);
@@ -313,7 +314,7 @@ where
313314
let memo_value =
314315
if self.should_memoize_value(key) { Some(new_value.value.clone()) } else { None };
315316

316-
debug!("read_upgrade({:?}): result.revisions = {:#?}", self, revisions,);
317+
trace!("read_upgrade({:?}): result.revisions = {:#?}", self, revisions,);
317318

318319
panic_guard.proceed(Some(Memo { value: memo_value, verified_at: revision_now, revisions }));
319320

@@ -362,9 +363,11 @@ where
362363
}
363364

364365
QueryState::Memoized(memo) => {
365-
debug!(
366+
trace!(
366367
"{:?}: found memoized value, verified_at={:?}, changed_at={:?}",
367-
self, memo.verified_at, memo.revisions.changed_at,
368+
self,
369+
memo.verified_at,
370+
memo.revisions.changed_at,
368371
);
369372

370373
if memo.verified_at < revision_now {
@@ -378,7 +381,11 @@ where
378381
value: value.clone(),
379382
};
380383

381-
info!("{:?}: returning memoized value changed at {:?}", self, value.changed_at);
384+
trace!(
385+
"{:?}: returning memoized value changed at {:?}",
386+
self,
387+
value.changed_at
388+
);
382389

383390
ProbeState::UpToDate(value)
384391
} else {
@@ -426,7 +433,7 @@ where
426433
}
427434

428435
pub(super) fn invalidate(&self, new_revision: Revision) -> Option<Durability> {
429-
tracing::debug!("Slot::invalidate(new_revision = {:?})", new_revision);
436+
tracing::trace!("Slot::invalidate(new_revision = {:?})", new_revision);
430437
match &mut *self.state.write() {
431438
QueryState::Memoized(memo) => {
432439
memo.revisions.untracked = true;
@@ -450,9 +457,11 @@ where
450457

451458
db.unwind_if_cancelled();
452459

453-
debug!(
460+
trace!(
454461
"maybe_changed_after({:?}) called with revision={:?}, revision_now={:?}",
455-
self, revision, revision_now,
462+
self,
463+
revision,
464+
revision_now,
456465
);
457466

458467
// Do an initial probe with just the read-lock.
@@ -734,9 +743,11 @@ where
734743
assert!(self.verified_at != revision_now);
735744
let verified_at = self.verified_at;
736745

737-
debug!(
746+
trace!(
738747
"verify_revisions: verified_at={:?}, revision_now={:?}, inputs={:#?}",
739-
verified_at, revision_now, self.revisions.inputs
748+
verified_at,
749+
revision_now,
750+
self.revisions.inputs
740751
);
741752

742753
if self.check_durability(db.salsa_runtime()) {
@@ -762,7 +773,7 @@ where
762773
let changed_input =
763774
inputs.slice.iter().find(|&&input| db.maybe_changed_after(input, verified_at));
764775
if let Some(input) = changed_input {
765-
debug!("validate_memoized_value: `{:?}` may have changed", input);
776+
trace!("validate_memoized_value: `{:?}` may have changed", input);
766777

767778
return false;
768779
}
@@ -775,7 +786,7 @@ where
775786
/// True if this memo is known not to have changed based on its durability.
776787
fn check_durability(&self, runtime: &Runtime) -> bool {
777788
let last_changed = runtime.last_changed_revision(self.revisions.durability);
778-
debug!(
789+
trace!(
779790
"check_durability(last_changed={:?} <= verified_at={:?}) = {:?}",
780791
last_changed,
781792
self.verified_at,

src/tools/rust-analyzer/crates/ra-salsa/src/input.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{DatabaseKeyIndex, QueryDb};
1414
use indexmap::map::Entry;
1515
use parking_lot::RwLock;
1616
use std::iter;
17-
use tracing::debug;
17+
use tracing::trace;
1818

1919
/// Input queries store the result plus a list of the other queries
2020
/// that they invoked. This means we can avoid recomputing them when
@@ -73,11 +73,11 @@ where
7373
return true;
7474
};
7575

76-
debug!("maybe_changed_after(slot={:?}, revision={:?})", Q::default(), revision,);
76+
trace!("maybe_changed_after(slot={:?}, revision={:?})", Q::default(), revision,);
7777

7878
let changed_at = slot.stamped_value.read().changed_at;
7979

80-
debug!("maybe_changed_after: changed_at = {:?}", changed_at);
80+
trace!("maybe_changed_after: changed_at = {:?}", changed_at);
8181

8282
changed_at > revision
8383
}
@@ -140,7 +140,7 @@ where
140140
Q: Query,
141141
{
142142
fn set(&self, runtime: &mut Runtime, key: &Q::Key, value: Q::Value, durability: Durability) {
143-
tracing::debug!("{:?}({:?}) = {:?} ({:?})", Q::default(), key, value, durability);
143+
tracing::trace!("{:?}({:?}) = {:?} ({:?})", Q::default(), key, value, durability);
144144

145145
// The value is changing, so we need a new revision (*). We also
146146
// need to update the 'last changed' revision by invoking
@@ -234,14 +234,14 @@ where
234234
) -> bool {
235235
debug_assert!(revision < db.salsa_runtime().current_revision());
236236

237-
debug!("maybe_changed_after(slot={:?}, revision={:?})", Q::default(), revision,);
237+
trace!("maybe_changed_after(slot={:?}, revision={:?})", Q::default(), revision,);
238238

239239
let Some(value) = &*self.slot.stamped_value.read() else {
240240
return true;
241241
};
242242
let changed_at = value.changed_at;
243243

244-
debug!("maybe_changed_after: changed_at = {:?}", changed_at);
244+
trace!("maybe_changed_after: changed_at = {:?}", changed_at);
245245

246246
changed_at > revision
247247
}
@@ -298,7 +298,7 @@ where
298298
Q: Query<Key = ()>,
299299
{
300300
fn set(&self, runtime: &mut Runtime, (): &Q::Key, value: Q::Value, durability: Durability) {
301-
tracing::debug!("{:?} = {:?} ({:?})", Q::default(), value, durability);
301+
tracing::trace!("{:?} = {:?} ({:?})", Q::default(), value, durability);
302302

303303
// The value is changing, so we need a new revision (*). We also
304304
// need to update the 'last changed' revision by invoking

src/tools/rust-analyzer/crates/ra-salsa/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub trait Database: plumbing::DatabaseOps {
7979

8080
let current_revision = runtime.current_revision();
8181
let pending_revision = runtime.pending_revision();
82-
tracing::debug!(
82+
tracing::trace!(
8383
"unwind_if_cancelled: current_revision={:?}, pending_revision={:?}",
8484
current_revision,
8585
pending_revision
@@ -684,7 +684,7 @@ impl Cycle {
684684
}
685685

686686
pub(crate) fn throw(self) -> ! {
687-
tracing::debug!("throwing cycle {:?}", self);
687+
tracing::trace!("throwing cycle {:?}", self);
688688
std::panic::resume_unwind(Box::new(self))
689689
}
690690

0 commit comments

Comments
 (0)