Skip to content
This repository

Remove ShardRejectedOperationException which is unused. Catch ShardOfflin #72

Merged
merged 2 commits into from almost 3 years ago

2 participants

Ross Cohen Matt Freels
Ross Cohen
Collaborator

Remove ShardRejectedOperationException which is unused. Catch ShardOfflineException in JobScheduler, which is the actual exception raised by a blocked shard now. Rename job-darkmoded-count to job-blocked-count for clarity.

rcohen added some commits
Ross Cohen rcohen Remove ShardRejectedOperationException which is unused. Catch ShardOf…
…flineException in JobScheduler, which is the actual exception raised by a blocked shard now. Rename job-darkmoded-count to job-blocked-count for clarity.
da18a2f
Ross Cohen rcohen Explicitly close the journal file when done reading instead of waitin…
…g for the GC to do it.
ebd4b78
Matt Freels

shipit

Ross Cohen rcohen merged commit e557068 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Sep 19, 2011
Ross Cohen rcohen Remove ShardRejectedOperationException which is unused. Catch ShardOf…
…flineException in JobScheduler, which is the actual exception raised by a blocked shard now. Rename job-darkmoded-count to job-blocked-count for clarity.
da18a2f
Sep 23, 2011
Ross Cohen rcohen Explicitly close the journal file when done reading instead of waitin…
…g for the GC to do it.
ebd4b78
This page is out of date. Refresh to see the latest.
6 src/main/scala/com/twitter/gizzard/scheduler/JobScheduler.scala
@@ -8,7 +8,7 @@ import com.twitter.util.Duration
8 8 import com.twitter.conversions.time._
9 9 import com.twitter.logging.Logger
10 10 import com.twitter.gizzard.Stats
11   -import com.twitter.gizzard.shards.{ShardBlackHoleException, ShardRejectedOperationException}
  11 +import com.twitter.gizzard.shards.{ShardBlackHoleException, ShardOfflineException}
12 12 import com.twitter.gizzard.util.Process
13 13
14 14
@@ -152,8 +152,8 @@ extends Process with JobConsumer {
152 152 Stats.incr("job-success-count")
153 153 } catch {
154 154 case e: ShardBlackHoleException => Stats.incr("job-blackholed-count")
155   - case e: ShardRejectedOperationException =>
156   - Stats.incr("job-darkmoded-count")
  155 + case e: ShardOfflineException =>
  156 + Stats.incr("job-blocked-count")
157 157 errorQueue.put(job)
158 158 case e =>
159 159 Stats.incr("job-error-count")
9 src/main/scala/com/twitter/gizzard/shards/ShardException.scala
@@ -42,15 +42,6 @@ class ShardDatabaseTimeoutException(timeout: Duration, shardId: ShardId, cause:
42 42 }
43 43
44 44 /**
45   - * Shard refused to do the operation, possibly because it's blocked. This is not a retryable error.
46   - *
47   - * Often this exception is used to signal a ReplicatingShard that it should try another shard,
48   - * because this shard is read-only, write-only, or blocked (offline).
49   - */
50   -class ShardRejectedOperationException(description: String, shardId: ShardId) extends
51   - NormalShardException(description, shardId)
52   -
53   -/**
54 45 * Shard cannot do the operation because all possible child shards are unavailable. This is only
55 46 * thrown by a ReplicatingShard. This is not a retryable error.
56 47 */
1  src/main/scala/net/lag/kestrel/Journal.scala
@@ -209,6 +209,7 @@ class Journal(queuePath: String, queueName: String, syncJournal: => Boolean, mul
209 209 f(item)
210 210 case (JournalItem.EndOfFile, _) =>
211 211 // move to next file and try again.
  212 + rj.close
212 213 readerFilename = Journal.journalAfter(new File(queuePath), queueName, readerFilename.get)
213 214 reader = Some(new FileInputStream(new File(queuePath, readerFilename.get)).getChannel)
214 215 fillReadBehind(f)
4 src/test/scala/com/twitter/gizzard/scheduler_new/JobSchedulerSpec.scala
@@ -148,11 +148,11 @@ class JobSchedulerSpec extends ConfiguredSpecification with JMocker with ClassMo
148 148 jobScheduler.process()
149 149 }
150 150
151   - "darkmode" in {
  151 + "blocked" in {
152 152 expect {
153 153 one(queue).get() willReturn Some(ticket1)
154 154 one(ticket1).job willReturn job1
155   - one(job1).apply() willThrow new ShardRejectedOperationException("darkmoded!", shardId)
  155 + one(job1).apply() willThrow new ShardOfflineException(shardId)
156 156 one(ticket1).ack()
157 157 one(job1).nextJob willReturn None
158 158 one(errorQueue).put(job1)

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.