cshannon commented on code in PR #4121:
URL: https://github.com/apache/accumulo/pull/4121#discussion_r1441006495
##########
core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java:
##########
@@ -52,7 +52,7 @@ public abstract class AbstractFateStore<T> implements
FateStore<T> {
private static final Logger log =
LoggerFactory.getLogger(AbstractFateStore.class);
protected final Set<Long> reserved;
- protected final Map<Long,Long> defered;
+ protected final Map<Long,Long> deferred;
Review Comment:
This is refactored from the ZooStore and is actually misspelled in 2.1 and
main as well so we should fix it there too.
https://github.com/apache/accumulo/blob/d97317945290fcd4e3a4eb8b3cf7e427fcc322bd/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java#L64
##########
core/src/main/java/org/apache/accumulo/core/fate/accumulo/AccumuloStore.java:
##########
@@ -188,27 +186,23 @@ public long timeCreated() {
return scanTx(scanner -> {
scanner.setRange(getRow(tid));
TxColumnFamily.CREATE_TIME_COLUMN.fetch(scanner);
- return StreamSupport.stream(scanner.spliterator(), false)
- .map(e ->
Long.parseLong(e.getValue().toString())).findFirst().orElse(0L);
+ return scanner.stream().map(e ->
Long.parseLong(e.getValue().toString())).findFirst()
+ .orElse(0L);
});
}
@Override
public void push(Repo<T> repo) throws StackOverflowException {
verifyReserved(true);
- try {
- Optional<Integer> top = findTop();
-
- if (top.filter(t -> t >= maxRepos).isPresent()) {
- throw new StackOverflowException("Repo stack size too large");
- }
+ Optional<Integer> top = findTop();
- FateMutator<T> fateMutator = newMutator(tid);
- fateMutator.putRepo(top.map(t -> t + 1).orElse(1), repo).mutate();
- } catch (StackOverflowException soe) {
Review Comment:
Another nice catch as it makes no sense to catch and immediately re-throw
here
##########
core/src/main/java/org/apache/accumulo/core/fate/AbstractFateStore.java:
##########
@@ -62,16 +62,13 @@ public abstract class AbstractFateStore<T> implements
FateStore<T> {
public AbstractFateStore() {
this.reserved = new HashSet<>();
- this.defered = new HashMap<>();
+ this.deferred = new HashMap<>();
}
public static byte[] serialize(Object o) {
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
Review Comment:
Same comment, this is also an issue in 2.1
https://github.com/apache/accumulo/blob/d97317945290fcd4e3a4eb8b3cf7e427fcc322bd/core/src/main/java/org/apache/accumulo/core/fate/ZooStore.java#L69
##########
core/src/main/java/org/apache/accumulo/core/fate/accumulo/AccumuloStore.java:
##########
@@ -75,8 +74,7 @@ protected List<String> getTransactions() {
return scanTx(scanner -> {
scanner.setRange(new Range());
TxColumnFamily.STATUS_COLUMN.fetch(scanner);
- return StreamSupport.stream(scanner.spliterator(), false)
- .map(e ->
e.getKey().getRow().toString()).collect(Collectors.toList());
+ return scanner.stream().map(e ->
e.getKey().getRow().toString()).collect(Collectors.toList());
Review Comment:
Nice catch, for some reason I missed the stream() method on the scanner
--
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]