*** empty log message ***
authorhkhang <hkhang>
Wed, 18 Nov 2009 19:38:49 +0000 (19:38 +0000)
committerhkhang <hkhang>
Wed, 18 Nov 2009 19:38:49 +0000 (19:38 +0000)
Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java

index cf29f3bf7403d6ee7c9ebd73aac3bfa83e2f999e..938321c171ae414fceda946a8a0254bec43f3af6 100644 (file)
@@ -36,33 +36,60 @@ public class LookUpService extends Task {
 \r
                atomic {\r
                        c = 'w';\r
-                       for (int i = 0; i < 100; i++) {\r
-                               directory = global new GlobalString("/home/folder_"+i+"/");\r
-                               str = new String("/home/folder_"+i+"/");\r
-                               t = global new Transaction(c, directory);\r
-                               todoList.push(t);\r
-       \r
-                                       for (int j = 0; j < 100; j++) {\r
-                                       file = global new GlobalString(str+"file_"+j);\r
-                                       str2 = new String(str+"file_"+j);\r
-                                       val = global new GlobalString("This is "+str2);\r
-                                       t = global new Transaction(c, file, val);\r
-                                       todoList.push(t);\r
-                               }\r
-                       }\r
-       \r
-                       c = 'r';\r
-                       directory = global new GlobalString("/home/");\r
-                       t = global new Transaction(c, directory);\r
-                       todoList.push(t);\r
 \r
-                       directory = global new GlobalString("/home/folder_28/");\r
+                       directory = global new GlobalString("/home/folder/");\r
+                       str = new String("/home/folder/");\r
                        t = global new Transaction(c, directory);\r
                        todoList.push(t);\r
 \r
-                       file = global new GlobalString("/home/folder_98/file_87");\r
-                       t = global new Transaction(c, file);\r
-                       todoList.push(t);\r
+                       for (int i = 0; i < 1000; i++) {\r
+                               file = global new GlobalString(str+"file_"+i);\r
+                               str2 = new String(str+"file_"+i);\r
+                               val = global new GlobalString("This is "+str2);\r
+                               t = global new Transaction(c, file, val);\r
+                               todoList.push(t);\r
+                       }\r
+               }\r
+\r
+               int rdprob = 95;\r
+               int dirprob = 90;\r
+               int rdwr;\r
+               int isdir;\r
+               int findex;\r
+               Random rand = new Random(0);\r
+\r
+               atomic {\r
+                       for (int i = 0; i < 10000; i++) {\r
+                               rdwr = rand.nextInt(100);\r
+                               isdir = rand.nextInt(100);\r
+                               findex = rand.nextInt(1000);\r
+       \r
+                               if (rdwr < rdprob) {\r
+                                       c = 'r';\r
+                                       if (isdir < dirprob) {          // file\r
+                                               file = global new GlobalString(str+"file_"+findex);\r
+                                               t = global new Transaction(c, file);\r
+                                       }\r
+                                       else {                                                                          // dir\r
+                                               directory = global new GlobalString(str);\r
+                                               t = global new Transaction(c, directory);\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       c = 'w';\r
+                                       if (isdir < dirprob) {          // file\r
+                                               file = global new GlobalString(str+"file_"+findex);\r
+                                               str2 = new String(str+"file_"+findex);\r
+                                               val = global new GlobalString(str2+" has been modified!!");\r
+                                               t = global new Transaction(c, file, val);\r
+                                       }\r
+                                       else {                                                                          // dir\r
+                                               directory = global new GlobalString(str+"new_dir_"+findex+"/");\r
+                                               t = global new Transaction(c, directory);\r
+                                       }\r
+                               }\r
+                               todoList.push(t);\r
+                       }\r
                }\r
        }\r
        \r
@@ -126,7 +153,7 @@ public class LookUpService extends Task {
 \r
                gval = (GlobalString)(fs.get(gkey));\r
                if (gval != null) {\r
-                       System.out.println("<"+gval.toLocalString()+">");\r
+//                     System.out.println("<"+gval.toLocalString()+">");\r
                }\r
                else {\r
                        System.out.println("No such file or directory");\r
@@ -144,9 +171,9 @@ public class LookUpService extends Task {
                        iter = list.iterator();\r
                        while (iter.hasNext() == true) {\r
                                gval = (GlobalString)(iter.next());\r
-                               System.out.print("["+gval.toLocalString()+"] ");\r
+//                             System.out.print("["+gval.toLocalString()+"] ");\r
                        }\r
-                       System.out.println("");\r
+//                     System.out.println("");\r
                }\r
                else {\r
                        System.out.println("No such file or directory");\r