Fix random tikv tests after ts_to_vs test to not fail anymore (#2472)

This commit is contained in:
Yusuke Kuoka 2023-08-20 20:26:19 +09:00 committed by GitHub
parent 83be65125b
commit 3ea3c34f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,23 +11,31 @@
// We need to translate the timestamp to the versionstamp due to that; `now - 1h` to a key suffixed by the versionstamp. // We need to translate the timestamp to the versionstamp due to that; `now - 1h` to a key suffixed by the versionstamp.
#[tokio::test] #[tokio::test]
#[serial] #[serial]
#[ignore]
async fn timestamp_to_versionstamp() { async fn timestamp_to_versionstamp() {
// Create a new datastore // Create a new datastore
let ds = new_ds(Uuid::parse_str("A905CA25-56ED-49FB-B759-696AEA87C342").unwrap()).await; let ds = new_ds(Uuid::parse_str("A905CA25-56ED-49FB-B759-696AEA87C342").unwrap()).await;
// Give the current versionstamp a timestamp of 0 // Give the current versionstamp a timestamp of 0
let mut tx = ds.transaction(true, false).await.unwrap(); let mut tx = ds.transaction(true, false).await.unwrap();
tx.set_timestamp_for_versionstamp(0, "myns", "mydb", true).await.unwrap(); tx.set_timestamp_for_versionstamp(0, "myns", "mydb", true).await.unwrap();
tx.commit().await.unwrap();
// Get the versionstamp for timestamp 0
let mut tx = ds.transaction(true, false).await.unwrap();
let vs1 = tx.get_versionstamp_from_timestamp(0, "myns", "mydb", true).await.unwrap().unwrap(); let vs1 = tx.get_versionstamp_from_timestamp(0, "myns", "mydb", true).await.unwrap().unwrap();
tx.commit().await.unwrap(); tx.commit().await.unwrap();
// Give the current versionstamp a timestamp of 1 // Give the current versionstamp a timestamp of 1
let mut tx = ds.transaction(true, false).await.unwrap(); let mut tx = ds.transaction(true, false).await.unwrap();
tx.set_timestamp_for_versionstamp(1, "myns", "mydb", true).await.unwrap(); tx.set_timestamp_for_versionstamp(1, "myns", "mydb", true).await.unwrap();
tx.commit().await.unwrap();
// Get the versionstamp for timestamp 1
let mut tx = ds.transaction(true, false).await.unwrap();
let vs2 = tx.get_versionstamp_from_timestamp(1, "myns", "mydb", true).await.unwrap().unwrap(); let vs2 = tx.get_versionstamp_from_timestamp(1, "myns", "mydb", true).await.unwrap().unwrap();
tx.commit().await.unwrap(); tx.commit().await.unwrap();
// Give the current versionstamp a timestamp of 2 // Give the current versionstamp a timestamp of 2
let mut tx = ds.transaction(true, false).await.unwrap(); let mut tx = ds.transaction(true, false).await.unwrap();
tx.set_timestamp_for_versionstamp(2, "myns", "mydb", true).await.unwrap(); tx.set_timestamp_for_versionstamp(2, "myns", "mydb", true).await.unwrap();
tx.commit().await.unwrap();
// Get the versionstamp for timestamp 2
let mut tx = ds.transaction(true, false).await.unwrap();
let vs3 = tx.get_versionstamp_from_timestamp(2, "myns", "mydb", true).await.unwrap().unwrap(); let vs3 = tx.get_versionstamp_from_timestamp(2, "myns", "mydb", true).await.unwrap().unwrap();
tx.commit().await.unwrap(); tx.commit().await.unwrap();
assert!(vs1 < vs2); assert!(vs1 < vs2);