You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-commits@bookkeeper.apache.org by si...@apache.org on 2017/11/01 16:06:43 UTC
[distributedlog] 01/02: Fix DistributedSchedule.WriteSet
compilation issue
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/distributedlog.git
commit 24abc9e7ff67b3c7291435c18133dac9d42293a3
Author: Sijie Guo <si...@apache.org>
AuthorDate: Tue Oct 31 01:31:51 2017 -0700
Fix DistributedSchedule.WriteSet compilation issue
DisributedSchedule writeset structure is changed in recent 4.6.0-SNAPSHOT version
---
.../main/java/org/apache/bookkeeper/client/LedgerReader.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
index 63c18d4..ccdc52b 100644
--- a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
+++ b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Set;
import java.util.SortedMap;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.bookkeeper.client.DistributionSchedule.WriteSet;
import org.apache.bookkeeper.net.BookieSocketAddress;
import org.apache.bookkeeper.proto.BookieClient;
import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback;
@@ -86,7 +87,7 @@ public class LedgerReader {
public void readEntriesFromAllBookies(final LedgerHandle lh, long eid,
final GenericCallback<Set<ReadResult<ByteBuf>>> callback) {
- List<Integer> writeSet = lh.distributionSchedule.getWriteSet(eid);
+ WriteSet writeSet = lh.distributionSchedule.getWriteSet(eid);
final AtomicInteger numBookies = new AtomicInteger(writeSet.size());
final Set<ReadResult<ByteBuf>> readResults = new HashSet<>();
ReadEntryCallback readEntryCallback = new ReadEntryCallback() {
@@ -118,7 +119,8 @@ public class LedgerReader {
};
ArrayList<BookieSocketAddress> ensemble = lh.getLedgerMetadata().getEnsemble(eid);
- for (Integer idx : writeSet) {
+ for (int i = 0; i < writeSet.size(); i++) {
+ int idx = writeSet.get(i);
bookieClient.readEntry(ensemble.get(idx), lh.getId(), eid, readEntryCallback, ensemble.get(idx));
}
}
@@ -181,7 +183,7 @@ public class LedgerReader {
public void readLacs(final LedgerHandle lh, long eid,
final GenericCallback<Set<ReadResult<Long>>> callback) {
- List<Integer> writeSet = lh.distributionSchedule.getWriteSet(eid);
+ WriteSet writeSet = lh.distributionSchedule.getWriteSet(eid);
final AtomicInteger numBookies = new AtomicInteger(writeSet.size());
final Set<ReadResult<Long>> readResults = new HashSet<ReadResult<Long>>();
ReadEntryCallback readEntryCallback = (rc, lid, eid1, buffer, ctx) -> {
@@ -204,7 +206,8 @@ public class LedgerReader {
};
ArrayList<BookieSocketAddress> ensemble = lh.getLedgerMetadata().getEnsemble(eid);
- for (Integer idx : writeSet) {
+ for (int i = 0; i < writeSet.size(); i++) {
+ int idx = writeSet.get(i);
bookieClient.readEntry(ensemble.get(idx), lh.getId(), eid, readEntryCallback, ensemble.get(idx));
}
}
--
To stop receiving notification emails like this one, please contact
"distributedlog-commits@bookkeeper.apache.org" <di...@bookkeeper.apache.org>.