Fixed tests for FDB and SQL stores

This commit is contained in:
mdecimus
2025-05-23 17:07:36 +02:00
parent 2eb99ed3bd
commit c19d2ceb43
16 changed files with 113 additions and 42 deletions

View File

@@ -355,7 +355,7 @@ impl BatchBuilder {
}
pub fn commit_point(&mut self) -> &mut Self {
if self.batch_size > 5_000_000 || self.batch_ops > 1000 {
if self.is_large_batch() {
self.serialize_changes();
self.commit_points.push(self.ops.len());
self.batch_ops = 0;
@@ -370,6 +370,11 @@ impl BatchBuilder {
self
}
#[inline]
pub fn is_large_batch(&self) -> bool {
self.batch_size > 5_000_000 || self.batch_ops > 1000
}
pub fn any_op(&mut self, op: Operation) -> &mut Self {
self.ops.push(op);
self.batch_ops += 1;

View File

@@ -215,7 +215,7 @@ impl Store {
let mut batch = BatchBuilder::new();
let mut last_account_id = u32::MAX;
for (account_id, op) in delete_keys.into_iter() {
if batch.len() >= 1000 {
if batch.is_large_batch() {
last_account_id = u32::MAX;
self.write(batch.build_all())
.await
@@ -290,7 +290,7 @@ impl Store {
batch.with_account_id(account_id);
let mut last_collection = u8::MAX;
for (collection, document_id, op) in delete_keys.into_iter() {
if batch.len() >= 1000 {
if batch.is_large_batch() {
self.write(batch.build_all())
.await
.caused_by(trc::location!())?;