From 8db449a90292a73e17843d3ae0383970cdab492a Mon Sep 17 00:00:00 2001 From: hkhang Date: Tue, 24 Nov 2009 22:13:09 +0000 Subject: [PATCH] *** empty log message *** --- .../Recovery/FileSystem/LookUpService.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java b/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java index 938321c1..2a264a99 100644 --- a/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java +++ b/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java @@ -1,6 +1,7 @@ public class LookUpService extends Task { DistributedHashMap dir; DistributedHashMap fs; + GlobalString error[]; // String for incorrect path, etc. public LookUpService(Queue todoList, DistributedHashMap dir, DistributedHashMap fs) { this.todoList = todoList; @@ -9,16 +10,31 @@ public class LookUpService extends Task { } public void init() { + makeErrorStatement(); fillHashTable(); fillTodoList(); } + + public void makeErrorStatement() { + int num = 4; + int i = 0; + + atomic { + error = global new GlobalString[num]; + + error[i++] = global new GlobalString("/hkhang/error/"); // w: no root (hkhang), r: non existed path + error[i++] = global new GlobalString("/home/abc/def/ghi/"); // w: create multiple directories, r: non existed path + error[i++] = global new GlobalString("/home/hkhang/abc"); // w: create directory and file together + error[i++] = global new GlobalString("/home/hkhang/abc/def"); // w: create directory and file together + } + } public void fillHashTable() { GlobalString path; DistributedLinkedList list; atomic { - path = global new GlobalString("/home/"); + path = global new GlobalString("/home/"); // root is home list = global new DistributedLinkedList(); dir.put(path, list); @@ -51,7 +67,8 @@ public class LookUpService extends Task { } } - int rdprob = 95; + int rdprob = 93; + int wrtprob = 98; int dirprob = 90; int rdwr; int isdir; @@ -64,7 +81,7 @@ public class LookUpService extends Task { isdir = rand.nextInt(100); findex = rand.nextInt(1000); - if (rdwr < rdprob) { + if (rdwr < rdprob) { // read c = 'r'; if (isdir < dirprob) { // file file = global new GlobalString(str+"file_"+findex); @@ -75,7 +92,7 @@ public class LookUpService extends Task { t = global new Transaction(c, directory); } } - else { + else if (rdwr >= rdprob && rdwr < wrtprob) { // write c = 'w'; if (isdir < dirprob) { // file file = global new GlobalString(str+"file_"+findex); @@ -88,6 +105,12 @@ public class LookUpService extends Task { t = global new Transaction(c, directory); } } + else { // error + int err = rand.nextInt(4); + file = error[err]; + val = global new GlobalString("It is error path!!"); + t = global new Transaction(c, file, val); + } todoList.push(t); } } -- 2.34.1