RavenDB PeriodicExport 错误 "RequestEntityTooLarge"
RavenDB PeriodicExport Error "RequestEntityTooLarge"
我们为 RavenDB 数据库创建了 PeriodicExport。我们尝试将备份文件上传到 Azure BLOB 容器。
有我们的设置:
在 Azure BLOB 容器中,我可以看到 增量 备份文件。但是我没有看到 完整 备份文件。
我还可以从 Raven 警报中看到下一个错误:
Label
Description
Title
Error in Periodic Export
Message
Status code: RequestEntityTooLarge <?xml version="1.0" encoding="utf-8"?><Error><Code>RequestBodyTooLarge</Code><Message>The request body is too large and exceeds the maximum permissible limit. RequestId:8b013757-401e-0014-4965-b7e992000000 Time:2021-10-02T08:13:54.8562742Z</Message><MaxLimit>67108864</MaxLimit></Error>
Level
Error
并且有完整的异常信息:
Raven.Abstractions.Connection.ErrorResponseException: Status code: RequestEntityTooLarge
<?xml version="1.0" encoding="utf-8"?><Error><Code>RequestBodyTooLarge</Code><Message>The request body is too large and exceeds the maximum permissible limit.
RequestId:8b013757-401e-0014-4965-b7e992000000
Time:2021-10-02T08:13:54.8562742Z</Message><MaxLimit>67108864</MaxLimit></Error>
at Raven.Database.Client.Azure.RavenAzureClient.PutBlob(String containerName, String key, Stream stream, Dictionary`2 metadata) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Client\Azure\RavenAzureClient.cs:line 93
at Raven.Database.Bundles.PeriodicExports.PeriodicExportTask.UploadToAzure(String backupPath, PeriodicExportSetup localExportConfigs, Boolean isFullBackup) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Bundles\PeriodicExports\PeriodicBackupTask.cs:line 397
at Raven.Database.Bundles.PeriodicExports.PeriodicExportTask.<>c__DisplayClasse.<<TimerCallback>b__a>d__10.MoveNext() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Bundles\PeriodicExports\PeriodicBackupTask.cs:line 248
Raven DB 版本为:
{
"ProductVersion": "3.0.0 / cdc39ac / ",
"BuildVersion": "3690"
}
可以修复这个错误吗?
非常感谢任何帮助。
更新
我在 GitHub repository.
中找到了相关构建版本的源代码
下一个方法存在bug:
public void PutBlob(string containerName, string key, Stream stream, Dictionary<string, string> metadata)
{
var url = GetUrl(containerName) + "/" + key;
var now = SystemTime.UtcNow;
var content = new StreamContent(stream)
{
Headers =
{
{ "x-ms-date", now.ToString("R") },
{ "x-ms-version", "2011-08-18" },
{ "x-ms-blob-type", "BlockBlob" },
{ "Content-Length", stream.Length.ToString(CultureInfo.InvariantCulture) }
}
};
foreach (var metadataKey in metadata.Keys)
content.Headers.Add("x-ms-meta-" + metadataKey.ToLower(), metadata[metadataKey]);
var client = GetClient(TimeSpan.FromHours(1));
client.DefaultRequestHeaders.Authorization = CalculateAuthorizationHeaderValue("PUT", url, content.Headers);
var response = client.PutAsync(url, content).ResultUnwrap();
if (response.IsSuccessStatusCode)
return;
throw ErrorResponseException.FromResponseMessage(response);
}
如您所见,此方法使用 Azure API 版本 2011-08-18。 Microsoft documentation.
中描述的此 Azure 版本的限制
关于文档“单次写入操作的最大 blob 大小(通过 Put Blob)”正好是 64 MiB(67108864 字节)。所以Azure提供的异常是绝对正确的。
不幸的是,Raven Build-3690 有一个错误,该错误已在下一版本中修复。可以查看带有修复的源代码 here.
is exists any way to increase "Maximum blob size via single write
operation (via Put Blob)" limit for BLOB storage?
限制不能更改,因为它是设计的。
Azure Storage standard accounts support higher capacity limits and
higher limits for ingress and egress by request. To request an
increase in account limits, contact Azure
Support.
正如您所说,这里 table 描述了服务版本允许的最大块和 blob 大小。
有关详细信息,请参阅此 Azure 博客:Run high scale workloads on Blob storage with new 200 TB object sizes
我们为 RavenDB 数据库创建了 PeriodicExport。我们尝试将备份文件上传到 Azure BLOB 容器。
有我们的设置:
在 Azure BLOB 容器中,我可以看到 增量 备份文件。但是我没有看到 完整 备份文件。
我还可以从 Raven 警报中看到下一个错误:
Label | Description |
---|---|
Title | Error in Periodic Export |
Message | Status code: RequestEntityTooLarge <?xml version="1.0" encoding="utf-8"?><Error><Code>RequestBodyTooLarge</Code><Message>The request body is too large and exceeds the maximum permissible limit. RequestId:8b013757-401e-0014-4965-b7e992000000 Time:2021-10-02T08:13:54.8562742Z</Message><MaxLimit>67108864</MaxLimit></Error> |
Level | Error |
并且有完整的异常信息:
Raven.Abstractions.Connection.ErrorResponseException: Status code: RequestEntityTooLarge
<?xml version="1.0" encoding="utf-8"?><Error><Code>RequestBodyTooLarge</Code><Message>The request body is too large and exceeds the maximum permissible limit.
RequestId:8b013757-401e-0014-4965-b7e992000000
Time:2021-10-02T08:13:54.8562742Z</Message><MaxLimit>67108864</MaxLimit></Error>
at Raven.Database.Client.Azure.RavenAzureClient.PutBlob(String containerName, String key, Stream stream, Dictionary`2 metadata) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Client\Azure\RavenAzureClient.cs:line 93
at Raven.Database.Bundles.PeriodicExports.PeriodicExportTask.UploadToAzure(String backupPath, PeriodicExportSetup localExportConfigs, Boolean isFullBackup) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Bundles\PeriodicExports\PeriodicBackupTask.cs:line 397
at Raven.Database.Bundles.PeriodicExports.PeriodicExportTask.<>c__DisplayClasse.<<TimerCallback>b__a>d__10.MoveNext() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Bundles\PeriodicExports\PeriodicBackupTask.cs:line 248
Raven DB 版本为:
{
"ProductVersion": "3.0.0 / cdc39ac / ",
"BuildVersion": "3690"
}
可以修复这个错误吗?
非常感谢任何帮助。
更新
我在 GitHub repository.
中找到了相关构建版本的源代码下一个方法存在bug:
public void PutBlob(string containerName, string key, Stream stream, Dictionary<string, string> metadata)
{
var url = GetUrl(containerName) + "/" + key;
var now = SystemTime.UtcNow;
var content = new StreamContent(stream)
{
Headers =
{
{ "x-ms-date", now.ToString("R") },
{ "x-ms-version", "2011-08-18" },
{ "x-ms-blob-type", "BlockBlob" },
{ "Content-Length", stream.Length.ToString(CultureInfo.InvariantCulture) }
}
};
foreach (var metadataKey in metadata.Keys)
content.Headers.Add("x-ms-meta-" + metadataKey.ToLower(), metadata[metadataKey]);
var client = GetClient(TimeSpan.FromHours(1));
client.DefaultRequestHeaders.Authorization = CalculateAuthorizationHeaderValue("PUT", url, content.Headers);
var response = client.PutAsync(url, content).ResultUnwrap();
if (response.IsSuccessStatusCode)
return;
throw ErrorResponseException.FromResponseMessage(response);
}
如您所见,此方法使用 Azure API 版本 2011-08-18。 Microsoft documentation.
中描述的此 Azure 版本的限制关于文档“单次写入操作的最大 blob 大小(通过 Put Blob)”正好是 64 MiB(67108864 字节)。所以Azure提供的异常是绝对正确的。
不幸的是,Raven Build-3690 有一个错误,该错误已在下一版本中修复。可以查看带有修复的源代码 here.
is exists any way to increase "Maximum blob size via single write operation (via Put Blob)" limit for BLOB storage?
限制不能更改,因为它是设计的。
Azure Storage standard accounts support higher capacity limits and higher limits for ingress and egress by request. To request an increase in account limits, contact Azure Support.
正如您所说,这里 table 描述了服务版本允许的最大块和 blob 大小。
有关详细信息,请参阅此 Azure 博客:Run high scale workloads on Blob storage with new 200 TB object sizes