You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/06/15 15:29:13 UTC

[GitHub] keith-turner closed pull request #12: Updates to Undefined Analyzer made for apache/accumulo#441

keith-turner closed pull request #12: Updates to Undefined Analyzer made for apache/accumulo#441
URL: https://github.com/apache/accumulo-testing/pull/12
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/.gitignore b/core/.gitignore
index 17bb010..7e54b72 100644
--- a/core/.gitignore
+++ b/core/.gitignore
@@ -1,2 +1,7 @@
+/.classpath
+/.project
+/.settings/
 /target/
 /*.iml
+/.idea
+/logs/
diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/UndefinedAnalyzer.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/UndefinedAnalyzer.java
index 7158491..30eae92 100644
--- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/UndefinedAnalyzer.java
+++ b/core/src/main/java/org/apache/accumulo/testing/core/continuous/UndefinedAnalyzer.java
@@ -25,7 +25,6 @@
 import java.io.InputStreamReader;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -164,17 +163,25 @@ public boolean contains(String row) {
     List<TabletAssignment> assignments = new ArrayList<>();
 
     TabletHistory(String tableId, String acuLogDir) throws Exception {
+      // looks for a file called load_events.log... the expected format of lines in this file is
+      // <date> <time> <tablet> <tserver>
+      //
+      // These lines represent when tablets were loaded, this file may be produced from master logs
+      // with following command :
+      //
+      // grep -h "was loaded on" *master*debug* | cut -d ' ' -f 1,2,7,11 | sort > load_events.log
+      //
+      // The command may need to be adjusted if formatting changes.
+
       File dir = new File(acuLogDir);
       File[] masterLogs = dir.listFiles(new FilenameFilter() {
         @Override
         public boolean accept(File dir, String name) {
-          return name.matches("master.*debug.log.*");
+          return name.matches("load_events.log");
         }
       });
 
-      SimpleDateFormat sdf = new SimpleDateFormat("dd HH:mm:ss,SSS yyyy MM");
-      String currentYear = (Calendar.getInstance().get(Calendar.YEAR)) + "";
-      String currentMonth = (Calendar.getInstance().get(Calendar.MONTH) + 1) + "";
+      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
 
       if (masterLogs != null) {
         for (File masterLog : masterLogs) {
@@ -183,43 +190,42 @@ public boolean accept(File dir, String name) {
           String line;
           try {
             while ((line = reader.readLine()) != null) {
-              if (line.contains("TABLET_LOADED")) {
-                String[] tokens = line.split("\\s+");
-                String tablet = tokens[8];
-                String server = tokens[10];
-
-                int pos1 = -1;
-                int pos2 = -1;
-                int pos3 = -1;
-
-                for (int i = 0; i < tablet.length(); i++) {
-                  if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') {
-                    if (pos1 == -1) {
-                      pos1 = i;
-                    } else if (pos2 == -1) {
-                      pos2 = i;
-                    } else {
-                      pos3 = i;
-                    }
+              String[] tokens = line.split("\\s+");
+              String day = tokens[0];
+              String time = tokens[1];
+              String tablet = tokens[2];
+              String server = tokens[3];
+
+              int pos1 = -1;
+              int pos2 = -1;
+              int pos3 = -1;
+
+              for (int i = 0; i < tablet.length(); i++) {
+                if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') {
+                  if (pos1 == -1) {
+                    pos1 = i;
+                  } else if (pos2 == -1) {
+                    pos2 = i;
+                  } else {
+                    pos3 = i;
                   }
                 }
+              }
 
-                if (pos1 > 0 && pos2 > 0 && pos3 == -1) {
-                  String tid = tablet.substring(0, pos1);
-                  String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1 + 1, pos2);
-                  String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2 + 1);
-                  if (tid.equals(tableId)) {
-                    // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow);
-                    Date date = sdf.parse(tokens[0] + " " + tokens[1] + " " + currentYear + " " + currentMonth);
-                    // System.out.println(" "+date);
+              if (pos1 > 0 && pos2 > 0 && pos3 == -1) {
+                String tid = tablet.substring(0, pos1);
+                String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1 + 1, pos2);
+                String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2 + 1);
+                if (tid.equals(tableId)) {
+                  // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow);
+                  Date date = sdf.parse(day + " " + time);
+                  // System.out.println(" "+date);
 
-                    assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server, date.getTime()));
+                  assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server, date.getTime()));
 
-                  }
-                } else if (!tablet.startsWith("!0")) {
-                  System.err.println("Cannot parse tablet " + tablet);
                 }
-
+              } else if (!tablet.startsWith("!0")) {
+                System.err.println("Cannot parse tablet " + tablet);
               }
             }
           } finally {
diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTablePerm.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTablePerm.java
index 85372fb..94a972d 100644
--- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTablePerm.java
+++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTablePerm.java
@@ -21,7 +21,7 @@
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.admin.SecurityOperations;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
@@ -80,8 +80,7 @@ public static void alter(State state, RandWalkEnv env, Properties props) throws
     SecurityOperations secOps = conn.securityOperations();
 
     try {
-      canGive = secOps.hasSystemPermission(sourceUser, SystemPermission.ALTER_TABLE)
-              || secOps.hasTablePermission(sourceUser, tableName, TablePermission.GRANT);
+      canGive = secOps.hasSystemPermission(sourceUser, SystemPermission.ALTER_TABLE) || secOps.hasTablePermission(sourceUser, tableName, TablePermission.GRANT);
     } catch (AccumuloSecurityException ae) {
       if (ae.getSecurityErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST)) {
         if (tableExists)
diff --git a/yarn/.gitignore b/yarn/.gitignore
index 17bb010..7e54b72 100644
--- a/yarn/.gitignore
+++ b/yarn/.gitignore
@@ -1,2 +1,7 @@
+/.classpath
+/.project
+/.settings/
 /target/
 /*.iml
+/.idea
+/logs/


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services