Last active
August 2, 2017 12:51
-
-
Save ElemarJR/b4cfae2f2e9eae09e736eec32c59476b to your computer and use it in GitHub Desktop.
Esent: out of memory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class Debts_ByPayer : AbstractMultiMapIndexCreationTask<PayerInfoForBilling> | |
{ | |
public Debts_ByPayer() | |
{ | |
AddMap<Debt>(debts => | |
from debt in debts | |
let person = LoadDocument<Person>("people/" + debt.Charging.PersonId.ToString()) | |
let agreement = LoadDocument<Agreement>(debt.Source.ToString()) | |
let personIds = person.Id.ToString().Split('/') | |
let agreementIds = agreement.Id.ToString().Split('/') | |
where debt.CurrentStatus == Debt.Status.Generated | |
select new | |
{ | |
PersonId = personIds[1], | |
Agreement = new { | |
Id = agreementIds[1], | |
CurrentSituation = agreement.CurrentSituation | |
}, | |
Name = person.Name, | |
Cpf = person.Cpf, | |
Address = person.Addresses.FirstOrDefault(a => a.Type == Shared.Domain.Address.EType.Home), | |
CollectorId = debt.Charging.CollectorId, | |
FormOfChargingId = debt.Charging.Id, | |
BillingDay = debt.Charging.BillingDay, | |
DueDates = debt.DueDate | |
}); | |
Reduce = results => | |
from result in results | |
group result by new | |
{ | |
PersonId = result.PersonId, | |
Agreement =result.Agreement, | |
Name = result.Name, | |
Cpf = result.Cpf, | |
Address = result.Address, | |
CollectorId = result.CollectorId, | |
FormOfChargingId = result.FormOfChargingId, | |
BillingDay = result.BillingDay | |
} into g | |
select new | |
{ | |
PersonId = g.Key.PersonId, | |
Agreement = g.Key.Agreement, | |
Name = g.Key.Name, | |
Cpf = g.Key.Cpf, | |
Address = g.Key.Address, | |
CollectorId = g.Key.CollectorId, | |
FormOfChargingId = g.Key.FormOfChargingId, | |
BillingDay = g.Key.BillingDay, | |
DueDates = g.Select(c => c.DueDates) | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the detailed exception:
Esent out of memory exception for index "Debts/ByPayer", id: 34
Out of memory exception occurred in storage during indexing process for "Debts/ByPayer". Will try to reduce batch size. Consider increasing "Raven/Esent/MaxVerPages" value in configuration. Error: Version store out of memory (cleanup already attempted).
The avg size of the documents is 1,29 Kb