bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-886: Allow to disable ledgers operation throttling
Date Tue, 09 Feb 2016 07:32:32 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master 63a2a91eb -> d96a2db91


BOOKKEEPER-886: Allow to disable ledgers operation throttling

Author: Matteo Merli <mmerli@yahoo-inc.com>

Reviewers: Sijie Guo <sijie@apache.org>

Closes #7 from merlimat/bk-886-disable-throttling


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/d96a2db9
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/d96a2db9
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/d96a2db9

Branch: refs/heads/master
Commit: d96a2db912278e3d88ed59d8d3e15b62bc37ffd4
Parents: 63a2a91
Author: Matteo Merli <mmerli@yahoo-inc.com>
Authored: Mon Feb 8 23:32:28 2016 -0800
Committer: Sijie Guo <sijie@apache.org>
Committed: Mon Feb 8 23:32:28 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/bookkeeper/client/LedgerHandle.java  | 11 +++++++++--
 .../java/org/apache/bookkeeper/client/PendingReadOp.java |  4 +++-
 .../org/apache/bookkeeper/conf/ClientConfiguration.java  |  6 ++++--
 3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/d96a2db9/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
index 61cc603..12d689c 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
@@ -101,7 +101,11 @@ public class LedgerHandle {
 
         this.ledgerId = ledgerId;
 
-        this.throttler = RateLimiter.create(bk.getConf().getThrottleValue());
+        if (bk.getConf().getThrottleValue() > 0) { 
+            this.throttler = RateLimiter.create(bk.getConf().getThrottleValue());
+        } else {
+            this.throttler = null;
+        }
 
         macManager = DigestManager.instantiate(ledgerId, password, digestType);
         this.ledgerKey = MacDigestManager.genDigest("ledger", password);
@@ -648,7 +652,10 @@ public class LedgerHandle {
                     "Invalid values for offset(" +offset
                     +") or length("+length+")");
         }
-        throttler.acquire();
+
+        if (throttler != null) {
+            throttler.acquire();
+        }
 
         final long entryId;
         final long currentLength;

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/d96a2db9/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
index 102d38e..d9c11d1 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
@@ -343,7 +343,9 @@ class PendingReadOp implements Enumeration<LedgerEntry>, ReadEntryCallback
{
     }
 
     void sendReadTo(BookieSocketAddress to, LedgerEntryRequest entry) throws InterruptedException
{
-        lh.throttler.acquire();
+        if (lh.throttler != null) {
+            lh.throttler.acquire();
+        }
 
         lh.bk.bookieClient.readEntry(to, lh.ledgerId, entry.entryId,
                                      this, new ReadContext(to, entry));

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/d96a2db9/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
----------------------------------------------------------------------
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
index fdbfd53..7a99559 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
@@ -106,10 +106,12 @@ public class ClientConfiguration extends AbstractConfiguration {
     /**
      * Set throttle value.
      *
-     * Since BookKeeper process requests in asynchrous way, it will holds
+     * Since BookKeeper process requests in asynchronous way, it will holds
      * those pending request in queue. You may easily run it out of memory
      * if producing too many requests than the capability of bookie servers can handle.
-     * To prevent that from happeding, you can set a throttle value here.
+     * To prevent that from happening, you can set a throttle value here.
+     *
+     * Setting the throttle value to 0, will disable any throttling.
      *
      * @param throttle
      *          Throttle Value


Mime
View raw message