Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a5f35f

Browse files
committed
2 parents558d2a2 +56fc560 commit2a5f35f

File tree

12 files changed

+237
-119
lines changed

12 files changed

+237
-119
lines changed

‎README‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pPostgreSQL Database Management System
1+
PostgreSQL Database Management System
22
=====================================
33

44
This directory contains the source code distribution of the PostgreSQL
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
packageCombineaux;
2+
3+
use Troubleaux;
4+
use Stresseaux;
5+
use Starteaux;
6+
7+
subcombine
8+
{
9+
my ($stresses,$troubles) =@_;
10+
11+
my$cluster = Starteaux->deploy('lxc');
12+
13+
foreachmy$stress (@$stresses)
14+
{
15+
foreachmy$trouble (@$troubles)
16+
{
17+
print("---$stress vs.$trouble ---\n");
18+
my$id ="$stress+$trouble";
19+
Stresseaux::start($id,$stress,$cluster) ||die"stress wouldn't start";
20+
sleep(1);# FIXME: will this work?
21+
Troubleaux::cause($cluster,$trouble);
22+
sleep(1);# FIXME: will this work?
23+
Stresseaux::stop($id) ||die"stress wouldn't stop";
24+
Troubleaux::fix($cluster);
25+
}
26+
}
27+
28+
$cluster->destroy();
29+
}
30+
31+
1;

‎contrib/mmts/testeaux/Starteaux.pm‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
packageStarteaux;
2+
3+
subdeploy
4+
{
5+
my ($class,$driver,@args) =@_;
6+
my$self = {};
7+
print("deploy cluster using driver$driver\n");
8+
# fixme: implement
9+
returnbless$self,'Starteaux';
10+
}
11+
12+
subup
13+
{
14+
my ($self,$id) =@_;
15+
print("up node$id\n");
16+
# FIXME: implement
17+
}
18+
19+
subdown
20+
{
21+
my ($self,$id) =@_;
22+
print("down node$id\n");
23+
# FIXME: implement
24+
}
25+
26+
subdrop
27+
{
28+
my ($self,$src,$dst,$ratio) =@_;
29+
print("drop$ratio packets from$src to$dst\n");
30+
# FIXME: implement
31+
}
32+
33+
subdelay
34+
{
35+
my ($self,$src,$dst,$msec) =@_;
36+
print("delay packets from$src to$dst by$msec msec\n");
37+
# FIXME: implement
38+
}
39+
40+
subdestroy
41+
{
42+
my ($self) =@_;
43+
print("destroy cluster$cluster\n");
44+
# FIXME: implement
45+
}
46+
47+
1;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
packageStresseaux;
2+
3+
my%running = ();
4+
5+
substart
6+
{
7+
my ($id,$stressname,$cluster,@args) =@_;
8+
9+
if (exists$running{$id})
10+
{
11+
print("cannot start stress$stressname as$id: that id has already been taken\n");
12+
return 0;
13+
}
14+
15+
require"stress/$stressname.pm";
16+
$running{$id} ="stress::$stressname"->start($id,$cluster,@args);
17+
18+
return 1;
19+
}
20+
21+
substop
22+
{
23+
my$id =shift;
24+
25+
my$stress =delete$running{$id};
26+
27+
if (!defined$stress)
28+
{
29+
print("cannot stop stress$id: that id is not running\n");
30+
return 0;
31+
}
32+
33+
$stress->stop();
34+
35+
return 1;
36+
}
37+
38+
1;

‎contrib/mmts/testeaux/Testeaux.pm‎

Lines changed: 0 additions & 111 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
my@caused = ();
2+
3+
packageTroubleaux
4+
{
5+
subcause
6+
{
7+
my$cluster =shift;
8+
my$troublename =shift;
9+
my@args =@_;
10+
11+
require"trouble/$troublename.pm";
12+
push@caused,"trouble::$troublename"->cause(@args);
13+
}
14+
15+
subfix
16+
{
17+
my ($cluster) =@_;
18+
19+
while (@caused)
20+
{
21+
my$trouble =pop@caused;
22+
$trouble->fix();
23+
}
24+
}
25+
}
26+
27+
1;

‎contrib/mmts/testeaux/eaux.pl‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
#!/usr/bin/perl
22

3-
useTesteaux;
3+
useCombineaux;
44

5-
Combineaux::combine(
6-
['bank-transfers','pgbench-default'],
7-
['split-brain','time-shift'],
8-
)
5+
sublist_modules
6+
{
7+
my$dir =shift;
8+
my@modules = ();
9+
10+
opendir DIR,$dirordie"Cannot open directory:$!";
11+
12+
while (my$file =readdir(DIR)) {
13+
# Use a regular expression to ignore files beginning with a period
14+
nextunless ($file =~m/\.pm$/);
15+
push@modules,substr($file, 0, -3);
16+
}
17+
18+
closedir DIR;
19+
20+
return@modules;
21+
}
22+
23+
my@stresses = list_modules('stress');
24+
my@troubles = list_modules('trouble');
25+
26+
Combineaux::combine(\@stresses, \@troubles);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packagestress::banktransfer;
2+
3+
substart
4+
{
5+
my ($class,@args) =@_;
6+
my$self = {};
7+
print("start$class with args" .join(',',@args) ."\n");
8+
returnbless$self,$class;
9+
}
10+
11+
substop
12+
{
13+
my$self =shift;
14+
print("stop$self\n");
15+
}
16+
17+
1;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packagestress::pgbench;
2+
3+
substart
4+
{
5+
my ($class,@args) =@_;
6+
my$self = {};
7+
print("start$class with args" .join(',',@args) ."\n");
8+
returnbless$self,$class;
9+
}
10+
11+
substop
12+
{
13+
my$self =shift;
14+
print("stop$self\n");
15+
}
16+
17+
1;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packagetrouble::splitbrain;
2+
3+
subcause
4+
{
5+
my ($class,@args) =@_;
6+
my$self = {};
7+
print("cause$class with args" .join(',',@args) ."\n");
8+
returnbless$self,$class;
9+
}
10+
11+
subfix
12+
{
13+
my$self =shift;
14+
print("fix$self\n");
15+
}
16+
17+
1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp