mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-16 09:52:54 +00:00
cargo fmt
This commit is contained in:
@@ -113,7 +113,7 @@ impl ComputeControlPlane {
|
||||
|
||||
pub fn new_test_master_node(&mut self) -> Arc<PostgresNode> {
|
||||
let node = self.new_vanilla_node(true).unwrap();
|
||||
println!("Create vanilla node at {:?}", node.address);
|
||||
println!("Create vanilla node at {:?}", node.address);
|
||||
node.append_conf(
|
||||
"postgresql.conf",
|
||||
"synchronous_standby_names = 'safekeeper_proxy'\n",
|
||||
@@ -405,9 +405,12 @@ impl PostgresNode {
|
||||
.args(&["-h", &self.address.ip().to_string()])
|
||||
.args(&["-p", &self.address.port().to_string()])
|
||||
.arg("-v")
|
||||
.stderr(OpenOptions::new()
|
||||
.append(true)
|
||||
.open(self.env.data_dir.join("safepkeeper_proxy.log")).unwrap())
|
||||
.stderr(
|
||||
OpenOptions::new()
|
||||
.append(true)
|
||||
.open(self.env.data_dir.join("safepkeeper_proxy.log"))
|
||||
.unwrap(),
|
||||
)
|
||||
.spawn()
|
||||
{
|
||||
Ok(child) => WalProposerNode { pid: child.id() },
|
||||
|
||||
@@ -51,41 +51,41 @@ fn test_multitenancy() {
|
||||
let wal_acceptors = storage_cplane.get_wal_acceptor_conn_info();
|
||||
|
||||
// start postgres
|
||||
let mut nodes = Vec::new();
|
||||
let mut proxies = Vec::new();
|
||||
for _ in 0..N_NODES {
|
||||
let node = compute_cplane.new_test_master_node();
|
||||
nodes.push(node);
|
||||
nodes.last().unwrap().start().unwrap();
|
||||
proxies.push(nodes.last().unwrap().start_proxy(wal_acceptors.clone()));
|
||||
}
|
||||
let mut nodes = Vec::new();
|
||||
let mut proxies = Vec::new();
|
||||
for _ in 0..N_NODES {
|
||||
let node = compute_cplane.new_test_master_node();
|
||||
nodes.push(node);
|
||||
nodes.last().unwrap().start().unwrap();
|
||||
proxies.push(nodes.last().unwrap().start_proxy(wal_acceptors.clone()));
|
||||
}
|
||||
|
||||
// create schema
|
||||
for node in &nodes {
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"CREATE TABLE t(key int primary key, value text)",
|
||||
);
|
||||
}
|
||||
for node in &nodes {
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"CREATE TABLE t(key int primary key, value text)",
|
||||
);
|
||||
}
|
||||
|
||||
// Populate data
|
||||
for node in &nodes {
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"INSERT INTO t SELECT generate_series(1,100000), 'payload'",
|
||||
);
|
||||
}
|
||||
// Populate data
|
||||
for node in &nodes {
|
||||
node.safe_psql(
|
||||
"postgres",
|
||||
"INSERT INTO t SELECT generate_series(1,100000), 'payload'",
|
||||
);
|
||||
}
|
||||
|
||||
// Check data
|
||||
for node in &nodes {
|
||||
let count: i64 = node
|
||||
.safe_psql("postgres", "SELECT sum(key) FROM t")
|
||||
.first()
|
||||
.unwrap()
|
||||
.get(0);
|
||||
println!("sum = {}", count);
|
||||
assert_eq!(count, 5000050000);
|
||||
}
|
||||
// Check data
|
||||
for node in &nodes {
|
||||
let count: i64 = node
|
||||
.safe_psql("postgres", "SELECT sum(key) FROM t")
|
||||
.first()
|
||||
.unwrap()
|
||||
.get(0);
|
||||
println!("sum = {}", count);
|
||||
assert_eq!(count, 5000050000);
|
||||
}
|
||||
}
|
||||
|
||||
// Majority is always alive
|
||||
|
||||
Reference in New Issue
Block a user