मैं .NET के लिए Windows Azure संग्रहण लाइब्रेरीज़ के संस्करण 4.3.0 का उपयोग कर रहा हूं। , कि DeleteAsync()
विधि ठीक से काम करता"ऑपरेशन के लिए अप्रत्याशित प्रतिक्रिया कोड: 0" Azure टेबल संग्रहण बैच निष्पादित करते समय
public async Task DeleteAsync(IEnumerable<T> entities)
{
await ExecuteAsBatch(entities, (batch, entity) => batch.Delete(entity));
}
private async Task ExecuteAsBatch(IEnumerable<T> entities, Action<TableBatchOperation, T> batchAction)
{
var byPartition = entities.GroupBy(x => x.PartitionKey).ToList();
await byPartition.ForEachParallel(async group =>
{
// A maximum of 100 actions are allowed per batch job
var segments = group.ToList().ToSegmentedList(100);
await segments.ForEachParallel(async segment =>
{
var batch = new TableBatchOperation();
foreach (var entity in segment)
{
batchAction(batch, entity);
}
await Table.ExecuteBatchAsync(batch);
}, 10);
}, 10);
}
मेरी कोड में अन्य स्थानों में: मेरे एटीएस भंडार कक्षा में, मैं बैच के एक जोड़े तरीकों कि इस तरह दिखना हटाना है। हालांकि, एक विशेष स्थान में, मैं यह त्रुटि संदेश जब बैच को क्रियान्वित करने मिलती है:
Unexpected Response Code for Operation: 0
यहाँ कॉल साइट है:
private async Task MergeAtsOrganizationUserEvents(int organizationId, IEnumerable<CustomerUserEvent> fromEvents, CustomerUser to)
{
var toDelete = (await fromEvents.SelectParallel(async fromEvent =>
{
var pkey = AtsOrganizationUserEventByMinute.GetPartitionKey(organizationId, fromEvent.OccurredOn);
var rkey = AtsOrganizationUserEventByMinute.GetRowKey(fromEvent.OccurredOn, fromEvent.CustomerUserEventId);
return await Ats.OrganizationUserEventByMinute.FindByPartitionRowAsync(pkey, rkey);
})).Where(x => x != null).ToList();
var toInsert = toDelete
.Select(x => AtsOrganizationUserEventByMinute.FromBase(x.OrganizationId, x.OccurredOn, x.CookieId,
to.CustomerUserId, x))
.ToList();
try
{
await Ats.OrganizationUserEventByMinute.UpsertAsync(toInsert);
await Ats.OrganizationUserEventByMinute.DeleteAsync(toDelete);
}
catch (Exception ex)
{
_logger.Error("Unable to merge {0} AtsOrganizationEvents for org {1}, to customer user {2}: {3}",
toInsert.Count, organizationId, to.CustomerUserId, ex.CompleteMessage());
throw;
}
}
UpsertAsync()
विधि ऊपर सफल होता है, लेकिन DeleteAsync()
विफल रहता है। ध्यान दें कि यह ठीक उसी इकाई को हटाने में विफल रहता है जो FindByPartitionRowAsync()
तालिका से पुनर्प्राप्त किया गया है, इसलिए मैं कल्पना नहीं कर सकता कि यह विकृत इकाइयों या उस तरह के किसी भी चीज़ के साथ कुछ भी करने के लिए कैसे हो सकता है।
यहाँ "toDelete" वस्तुओं में से एक का एक उदाहरण है (JSON प्रारूप में):
{
"CookieId":null,
"CustomerUserId":185766,
"CustomerUserEventId":3568687,
"OrganizationId":4190,
"EventName":"event1",
"SessionId":null,
"OccurredOn":"2014-10-20T18:17:09.9971379Z",
"UrlId":null,
"Url":null,
"ReferrerUrlId":null,
"ReferrerUrl":null,
"IsSynthetic":false,
"IpAddress":null,
"PartitionKey":"4190.2014.10.20",
"RowKey":"18.17.3568687",
"Timestamp":"2014-10-20T18:17:11.237+00:00",
"ETag":"W/\\" datetime'2014-10-20T18%3A17%3A11.237Z'\\""
}
Azure संग्रहण त्रुटि संदेश कुख्यात और शानदार बेकार हैं, और Googling बैच के बारे में कुछ भी नहीं वापस आ गया है इस विशेष के साथ नाकाम रहने के हटाने से त्रुटि।
यह स्थानीय विकास भंडारण और उत्पादन में दोनों विफल रहता है।
कोई विचार?
हाय केन, क्या आप अपने .EachParallel() और .oSegmentedList() कोड को साझा करना चाहते हैं, यह ऐसा कुछ है जो बहुत आसान दिखता है। धन्यवाद। –
निश्चित रूप से। Https://gist.github.com/smithkl42/ca5b98e909952eddef1e3a076c0dd91d और https://gist.github.com/smithkl42/36ca70a63fe1a3bbf2d03a4d0bbe46c2 देखें। –