Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlobTrigger poison queue fix (#804) #956

Closed
wants to merge 2 commits into from
Closed

BlobTrigger poison queue fix (#804) #956

wants to merge 2 commits into from

Conversation

mathewc
Copy link
Member

@mathewc mathewc commented Jan 5, 2017

Fix for #804

_sharedWatcher.Notify(_poisonQueue.Name);
// TODO: this is assuming that the poison queue is in the same
// storage account
_sharedWatcher.Notify(e.PoisonQueue.Name);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to create a bug for this. Not an real issue, but something we should look to improve. This shared watcher notify stuff is just a way to wake up a sleeping queue listener faster when something is written to it on the same instance, so we don't have to wait for the exponential backoff interval.

/// The poison message
/// </summary>
public CloudQueueMessage Message { get; private set; }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean in the Blob case?

Copy link
Member Author

@mathewc mathewc Jan 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing. Remember that blob trigger works by enqueuing messages, which we set up an internal "shared listener" on. It's a message that contains a payload that points to the triggering blob, etc.

@@ -211,13 +213,9 @@ public QueueProcessor(QueueProcessorFactoryContext context)
/// Called to raise the MessageAddedToPoisonQueue event
/// </summary>
/// <param name="e">The event arguments</param>
protected internal virtual void OnMessageAddedToPoisonQueue(EventArgs e)
protected internal virtual void OnMessageAddedToPoisonQueue(PoisonMessageEventArgs e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnMessageAddedToPoisonQueue [](start = 40, length = 27)

Why is this exposed?
If somebody wants to react to the poison message, can they just use a [QueueTrigger] on the poison queue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, customers set up queue trigger functions to process the poison queue. QueueProcessor is a lower level advanced thing, and if you see how it is used, you'll see that other aspects of our infra need to know when a poison message is added.

// by default this should target the same storage account
// as the blob container we're monitoring
var poisonQueueClient = userQueueClient;
if (_dataAccount.Type == StorageAccountType.BlobOnly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to _dataAccount.Type != StorageAccountType.GeneralPurpose, Premium storage would trip here as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - changed

@mathewc mathewc force-pushed the blobfix branch 2 times, most recently from 01419ae to 2dbd92b Compare January 6, 2017 00:01
// as the blob container we're monitoring
var poisonQueueClient = targetQueueClient;
if (_dataAccount.Type != StorageAccountType.GeneralPurpose ||
_blobsConfiguration.CentralizePoisonQueue)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where we use the new flag to force the poison queue to be in the primary account.

/// <summary>
/// Represents configuration for <see cref="BlobTriggerAttribute"/>.
/// </summary>
public class JobHostBlobsConfiguration
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely there will be additional blob scan knobs we want to expose in the future as well. I do remember this coming up before but we didn't have a way previously.

@@ -51,31 +49,6 @@ public static void Run([BlobTrigger(BlobPath)] ICloudBlob blob)
}
}

[Fact]
public void BlobTrigger_IfBindingAlwaysFails_MovesToPoisonQueue()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this test because we already have test coverage for poison scenarios, and the test no longer runs because it relies on mocking of the internal QueueProcessor which isn't possible anymore because I now have a new SharedBlobQueueProcessor in place. I fiddled too long with getting the test to keep running, and it isn't worth it because we have coverage already.

Copy link
Contributor

@mamaso mamaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mathewc
Copy link
Member Author

mathewc commented Jan 6, 2017

Merged in 56b5302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants