cshannon commented on code in PR #4129:
URL: https://github.com/apache/accumulo/pull/4129#discussion_r1442914630


##########
test/src/main/java/org/apache/accumulo/test/fate/FateIT.java:
##########
@@ -184,7 +167,7 @@ protected void testCancelWhileNew(FateStore<TestEnv> store, 
ServerContext sctx)
       // nothing should have run
       assertEquals(1, callStarted.getCount());
       fate.delete(txid);
-      assertThrows(getNoTxExistsException(), () -> getTxStatus(sctx, txid));
+      assertEquals(UNKNOWN, getTxStatus(sctx, txid));

Review Comment:
   I'm glad you fixed this issue, I made the comment about the race condition 
because I encountered the same bug and I forgot to make a follow on issue to 
fix the test because it kept failing for me on occasion too



##########
core/src/main/java/org/apache/accumulo/core/fate/accumulo/AccumuloStore.java:
##########
@@ -70,12 +71,22 @@ public long create() {
   }
 
   @Override
-  protected List<String> getTransactions() {
-    return scanTx(scanner -> {
+  protected Stream<FateIdStatus> getTransactions() {
+    try {
+      Scanner scanner = context.createScanner(tableName, Authorizations.EMPTY);
       scanner.setRange(new Range());
       TxColumnFamily.STATUS_COLUMN.fetch(scanner);
-      return scanner.stream().map(e -> 
e.getKey().getRow().toString()).collect(Collectors.toList());
-    });
+      return scanner.stream().onClose(scanner::close).map(e -> {
+        return new FateIdStatus(parseTid(e.getKey().getRow().toString())) {
+          @Override
+          public TStatus getStatus() {
+            return TStatus.valueOf(e.getValue().toString());
+          }
+        };
+      });

Review Comment:
   Just a small simplification which you can ignore



##########
core/src/main/java/org/apache/accumulo/core/fate/accumulo/AccumuloStore.java:
##########
@@ -70,12 +71,22 @@ public long create() {
   }
 
   @Override
-  protected List<String> getTransactions() {
-    return scanTx(scanner -> {
+  protected Stream<FateIdStatus> getTransactions() {
+    try {
+      Scanner scanner = context.createScanner(tableName, Authorizations.EMPTY);
       scanner.setRange(new Range());
       TxColumnFamily.STATUS_COLUMN.fetch(scanner);
-      return scanner.stream().map(e -> 
e.getKey().getRow().toString()).collect(Collectors.toList());
-    });
+      return scanner.stream().onClose(scanner::close).map(e -> {
+        return new FateIdStatus(parseTid(e.getKey().getRow().toString())) {
+          @Override
+          public TStatus getStatus() {
+            return TStatus.valueOf(e.getValue().toString());
+          }
+        };
+      });

Review Comment:
   ```suggestion
         return scanner.stream().onClose(scanner::close)
             .map(e -> new 
FateIdStatus(parseTid(e.getKey().getRow().toString())) {
               @Override
               public TStatus getStatus() {
                 return TStatus.valueOf(e.getValue().toString());
               }
             });
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to