Open sachinnagesh opened 1 year ago
Does it started to happen recently? Ours is having the same problem but we never changed the monstache config for 2 months its weird
@yunusemrecatalcam Yes we started facing issue from last 2-3 months.
@yunusemrecatalcam we found the issue from where it's coming. While fetching data from mongo view while processing relate, it doesn't get the record at all during insertion. We have mongo replica set deployment. I feel while writing data to mongo collection, there are services which are not configured with write majority. For now we have added retry mechanism (5 times) with some delay between iteration. But still there is going to be issue during update, it may not get latest updated record.
@yunusemrecatalcam I think another way to solve this is to add readPreference from primary
Hi, I have a very similar problem. im using this versions:
This is my toml file
mongo-url="mongo-url?readPreference=primary"
config-database-name="database-monstache"
elasticsearch-urls =["url"]
elasticsearch-validate-pem-file=false
elasticsearch-user="user"
elasticsearch-password="password"
elasticsearch-max-conns = 50
change-stream-namespaces = [ "collection1","collection2","collection3"]
replay = false
resume = true
resume-name = "default"
index-as-update = true
direct-read-no-timeout = true
elasticsearch-retry = true
fail-fast = false
stats = false
verbose = true
disable-change-events = false
enable-patches = true
[[mapping]]
namespace = "collection1"
index = "index1"
[[mapping]]
namespace = "collection2"
index = "index2"
[[mapping]]
namespace = "collection3"
index = "index3"
[[script]]
namespace = "collection1"
script = """
module.exports = function(doc) {
if (doc.id) {
doc.owner = findId(doc.owner_id, {
collection: "collection1"
});
}
function removeKey(obj) {
Object.keys(obj).forEach(function(key) {
if (key === "_class") delete(obj[key]);
if (typeof obj[key] === 'object' && obj[key] !== null) {
removeKey(obj[key])
}
})
}
removeKey(doc);
function isNumber (value) {
if (value === null || value === undefined) {
return false;
}
if (typeof value === "string") {
return !isNaN(value) && !isNaN(parseFloat(value));
}
return !isNaN(value);
};
if (isNumber(doc.amount)) {
doc.amount = doc.amount * 100
}
if (isNumber(doc.presales_amount)) {
doc.presales_amount = doc.presales_amount * 100
}
return doc;
}
"""
[[relate]]
namespace = "collection1"
with-namespace = "collection2"
src-field = "_id"
match-field = "owner_id"
keep-src = true
It's happening for 5-10 records per 100 records and it's very random exactly like @sachinnagesh reported. Have you got any suggestions?
Hi @rwynn ,
We are facing a very strange issue with monstache. We observed some of the records are not at all synched to elastic-index. It's happening for 5-10 records per 100 records and it's very random. This is observed in case of create and update. Also we don't see any logs at all related to records in monstache logs. Just to give you idea about out setup, we have mongodb deployment with replica set. We have multiple db's (each for a specific company - multi tenant) in deployement. From each company db we want to sync a mongodb view created on
product
collection.e.g. dbName : company1
collections : products, product-features, product-technical-details, product-inventory dbName : company12 collections : products, product-features, product-technical-details, product-inventory
Here is monstache.toml file looks like
We also tried by setting below parameters and removing
namespace-regex
but still issue persistWe think somehow monstache missing those create/update events. We are using
monstache:6.7.10