Skip to content

Commit

Permalink
docs: mention automatic awaiting schema agreement
Browse files Browse the repository at this point in the history
The mechanism of automatically awaiting schema agreement after a
schema-altering request is executed was missing mention in docs.
  • Loading branch information
wprzytula committed Aug 18, 2023
1 parent 4c6f5d5 commit 61275cb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/source/queries/schema-agreement.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,24 @@ if session.check_schema_agreement().await?.is_some() {
# Ok(())
# }
```

### Automated awaiting schema agreement

The driver automatically awaits schema agreement after a schema-altering query is executed.
Waiting for schema agreement more than necessary is never a bug, but might slow down applications which do a lot of schema changes (e.g. a migration).
For instance, in case where somebody wishes to create a keyspace and then a lot of tables in it, it makes sense only to wait after creating a keyspace
and after creating all the tables rather than after every query. Therefore, the said behaviour can be disabled:

```rust
# extern crate scylla;
# use scylla::SessionBuilder;
# use std::error::Error;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
let session = SessionBuilder::new()
.known_node("127.0.0.1:9042")
.auto_await_schema_agreement(false)
.build()
.await?;
# Ok(())
# }
```

0 comments on commit 61275cb

Please sign in to comment.