mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
Instrument rocksdb functions at TRACE level
This allows e.g. aggregate time statistics if you really care about it by adding grapevine::database::abstraction::rocksdb=trace to the tracing filter.
This commit is contained in:
parent
6fb9abed62
commit
b11cbb6991
2 changed files with 13 additions and 1 deletions
|
|
@ -100,7 +100,8 @@ This will be the first release of Grapevine since it was forked from Conduit
|
||||||
(merged as [ac42e0b](https://gitlab.computer.surgery/matrix/grapevine-fork/-/commit/ac42e0bfff6af8677636a3dc1a56701a3255071d)),
|
(merged as [ac42e0b](https://gitlab.computer.surgery/matrix/grapevine-fork/-/commit/ac42e0bfff6af8677636a3dc1a56701a3255071d)),
|
||||||
[!18](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/18),
|
[!18](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/18),
|
||||||
[!26](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/26),
|
[!26](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/26),
|
||||||
[!50](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/50))
|
[!50](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/50),
|
||||||
|
[!52](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/52))
|
||||||
5. Stop returning unnecessary member counts from `/_matrix/client/{r0,v3}/sync`.
|
5. Stop returning unnecessary member counts from `/_matrix/client/{r0,v3}/sync`.
|
||||||
([!12](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/12))
|
([!12](https://gitlab.computer.surgery/matrix/grapevine-fork/-/merge_requests/12))
|
||||||
6. **BREAKING:** Allow federation by default.
|
6. **BREAKING:** Allow federation by default.
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use rocksdb::{
|
||||||
DBRecoveryMode, DBWithThreadMode, Direction, IteratorMode, MultiThreaded,
|
DBRecoveryMode, DBWithThreadMode, Direction, IteratorMode, MultiThreaded,
|
||||||
Options, ReadOptions, WriteOptions,
|
Options, ReadOptions, WriteOptions,
|
||||||
};
|
};
|
||||||
|
use tracing::Level;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree,
|
super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree,
|
||||||
|
|
@ -165,12 +166,14 @@ impl RocksDbEngineTree<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KvTree for RocksDbEngineTree<'_> {
|
impl KvTree for RocksDbEngineTree<'_> {
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
|
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
|
||||||
let readoptions = ReadOptions::default();
|
let readoptions = ReadOptions::default();
|
||||||
|
|
||||||
Ok(self.db.rocks.get_cf_opt(&self.cf(), key, &readoptions)?)
|
Ok(self.db.rocks.get_cf_opt(&self.cf(), key, &readoptions)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
|
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
|
||||||
let writeoptions = WriteOptions::default();
|
let writeoptions = WriteOptions::default();
|
||||||
let lock = self.write_lock.read().unwrap();
|
let lock = self.write_lock.read().unwrap();
|
||||||
|
|
@ -182,6 +185,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn insert_batch(
|
fn insert_batch(
|
||||||
&self,
|
&self,
|
||||||
iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>,
|
iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>,
|
||||||
|
|
@ -194,11 +198,13 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn remove(&self, key: &[u8]) -> Result<()> {
|
fn remove(&self, key: &[u8]) -> Result<()> {
|
||||||
let writeoptions = WriteOptions::default();
|
let writeoptions = WriteOptions::default();
|
||||||
Ok(self.db.rocks.delete_cf_opt(&self.cf(), key, &writeoptions)?)
|
Ok(self.db.rocks.delete_cf_opt(&self.cf(), key, &writeoptions)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a> {
|
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a> {
|
||||||
let readoptions = ReadOptions::default();
|
let readoptions = ReadOptions::default();
|
||||||
|
|
||||||
|
|
@ -211,6 +217,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn iter_from<'a>(
|
fn iter_from<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
from: &[u8],
|
from: &[u8],
|
||||||
|
|
@ -238,6 +245,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
|
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
|
||||||
let readoptions = ReadOptions::default();
|
let readoptions = ReadOptions::default();
|
||||||
let writeoptions = WriteOptions::default();
|
let writeoptions = WriteOptions::default();
|
||||||
|
|
@ -252,6 +260,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
Ok(new)
|
Ok(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn increment_batch(
|
fn increment_batch(
|
||||||
&self,
|
&self,
|
||||||
iter: &mut dyn Iterator<Item = Vec<u8>>,
|
iter: &mut dyn Iterator<Item = Vec<u8>>,
|
||||||
|
|
@ -273,6 +282,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn scan_prefix<'a>(
|
fn scan_prefix<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
prefix: Vec<u8>,
|
prefix: Vec<u8>,
|
||||||
|
|
@ -293,6 +303,7 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = Level::TRACE, skip_all)]
|
||||||
fn watch_prefix<'a>(
|
fn watch_prefix<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
prefix: &[u8],
|
prefix: &[u8],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue