Skip to content

Commit 35b44e3

Browse files
committed
TMP
1 parent a8011c0 commit 35b44e3

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

crates/iota-indexer/src/apis/write_api.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ impl WriteApi {
131131
// index it safely since we may have already pruned optimistic
132132
// tables from that epoch. It's very likely that it's already
133133
// indexed anyway, let's just wait for it.
134+
println!(
135+
"Epoch change from {} to {}",
136+
effects.executed_epoch(),
137+
latest_epoch.epoch
138+
);
134139
} else if let (Some(input_objects), Some(output_objects)) = (input_objects, output_objects)
135140
{
136141
// We have all needed data, let's optimistically index the tx.
@@ -145,6 +150,7 @@ impl WriteApi {
145150
} else {
146151
// TODO: input/output objects are missing, let's create some metric
147152
// for this
153+
println!("Missing in/out objs");
148154
}
149155

150156
let tx_block_response = self
@@ -163,8 +169,10 @@ impl WriteApi {
163169
tx_digest: TransactionDigest,
164170
options: Option<IotaTransactionBlockResponseOptions>,
165171
) -> Result<IotaTransactionBlockResponse, IndexerError> {
166-
let mut backoff = backoff::ExponentialBackoff::default();
167-
backoff.max_elapsed_time = Some(Duration::from_secs(30));
172+
let backoff = backoff::ExponentialBackoff {
173+
max_elapsed_time: Some(Duration::from_secs(30)),
174+
..Default::default()
175+
};
168176

169177
backoff::future::retry(backoff, async || {
170178
let tx_block_response = self
@@ -181,15 +189,11 @@ impl WriteApi {
181189
.pop();
182190

183191
match tx_block_response {
184-
Some(tx_block_response) => return Ok(tx_block_response),
185-
None => {
186-
return Err(backoff::Error::Transient {
187-
err: IndexerError::PostgresRead(
188-
"Transaction not present in DB".to_string(),
189-
),
190-
retry_after: None,
191-
});
192-
}
192+
Some(tx_block_response) => Ok(tx_block_response),
193+
None => Err(backoff::Error::Transient {
194+
err: IndexerError::PostgresRead("Transaction not present in DB".to_string()),
195+
retry_after: None,
196+
}),
193197
}
194198
})
195199
.await

crates/iota-indexer/src/models/objects.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use serde::de::DeserializeOwned;
1919

2020
use crate::{
2121
errors::IndexerError,
22-
schema::{objects, objects_history, objects_snapshot},
22+
schema::{objects, objects_history, objects_snapshot, optimistic_deleted_objects_versions},
2323
types::{IndexedDeletedObject, IndexedObject, ObjectStatus, owner_to_owner_info},
2424
};
2525

@@ -76,6 +76,13 @@ pub struct StoredObjectSnapshot {
7676
pub df_kind: Option<i16>,
7777
}
7878

79+
#[derive(Queryable, Insertable, Debug, Identifiable, Clone, QueryableByName)]
80+
#[diesel(table_name = optimistic_deleted_objects_versions, primary_key(object_id))]
81+
pub struct OptimisticDeletedObjectVersion {
82+
pub object_id: Vec<u8>,
83+
pub object_version: i64,
84+
}
85+
7986
impl From<IndexedObject> for StoredObjectSnapshot {
8087
fn from(o: IndexedObject) -> Self {
8188
let IndexedObject {

crates/iota-indexer/tests/rpc-tests/write_api.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ fn test_consecutive_modifications_of_owned_object() -> Result<(), anyhow::Error>
354354

355355
#[test]
356356
fn test_consecutive_wrap_unwrap() -> Result<(), anyhow::Error> {
357+
let _guard = telemetry_subscribers::TelemetryConfig::new()
358+
.with_env()
359+
.init();
360+
357361
let ApiTestSetup {
358362
runtime,
359363
store,
@@ -363,7 +367,7 @@ fn test_consecutive_wrap_unwrap() -> Result<(), anyhow::Error> {
363367
runtime.block_on(async move {
364368
indexer_wait_for_checkpoint(store, 1).await;
365369
let (sender, sender_kp): (_, AccountKeyPair) = get_key_pair();
366-
let consecutive_updates = 50;
370+
let consecutive_updates = 2500;
367371

368372
let gas = cluster
369373
.fund_address_and_return_gas(
@@ -546,7 +550,7 @@ fn test_repeatedly_update_display() {
546550
} = ApiTestSetup::get_or_init();
547551

548552
runtime.block_on(async {
549-
let consecutive_updates = 50;
553+
let consecutive_updates = 150;
550554
indexer_wait_for_checkpoint(store, 1).await;
551555

552556
let (sender, sender_kp): (_, AccountKeyPair) = get_key_pair();

0 commit comments

Comments
 (0)