Skip to content

Commit

Permalink
indexer: epoch commit debugging (MystenLabs#10565)
Browse files Browse the repository at this point in the history
## Description 

I saw error msg of 
```
INFO sui_indexer::handlers::checkpoint_handler: Epoch 750 committed.
....
2023-04-07T22:54:49.669481Z  WARN sui_indexer::handlers::checkpoint_handler: Indexer epoch commit failed with error: PostgresWriteError("empty range bound specified for partition \"objects_history_partition_749\""), retrying after 100 milli-secs...
```

I do not have a theory, this seems unlikely at the first glance, added
some loggings there then.

## Test Plan 

eyeball
  • Loading branch information
gegaowp authored Apr 8, 2023
1 parent 2331f7c commit 6305f9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/sui-indexer/src/handlers/checkpoint_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ where
}
epoch_db_guard.stop_and_record();
self.metrics.total_epoch_committed.inc();
info!("Epoch {} committed.", indexed_epoch.new_epoch.epoch,);
info!("Epoch {} committed.", indexed_epoch.new_epoch.epoch);
}
} else {
// sleep for 1 sec to avoid occupying the mutex, as this happens once per epoch / day
Expand Down
2 changes: 2 additions & 0 deletions crates/sui-indexer/src/store/pg_indexer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,9 @@ impl PartitionManager {
"ALTER TABLE {table} DETACH PARTITION {table}_partition_{last_epoch_id};"
);
let attach_partition_with_new_range = format!("ALTER TABLE {table} ATTACH PARTITION {table}_partition_{last_epoch_id} FOR VALUES FROM ('{last_epoch_start_cp}') TO ('{next_epoch_start_cp}');");
info! {"Changed last epoch partition {last_epoch_id} for {table}, with new range {last_epoch_start_cp} to {next_epoch_start_cp}"};
let new_partition = format!("CREATE TABLE {table}_partition_{next_epoch_id} PARTITION OF {table} FOR VALUES FROM ({next_epoch_start_cp}) TO (MAXVALUE);");
info! {"Created epoch partition {next_epoch_id} for {table}, with new range {next_epoch_start_cp} to MAXVALUE"};
diesel::RunQueryDsl::execute(diesel::sql_query(detach_partition), conn)?;
diesel::RunQueryDsl::execute(
diesel::sql_query(attach_partition_with_new_range),
Expand Down

0 comments on commit 6305f9b

Please sign in to comment.