GithubHelp home page GithubHelp logo

Comments (5)

yunusemrecatalcam avatar yunusemrecatalcam commented on May 28, 2024

Does it started to happen recently? Ours is having the same problem but we never changed the monstache config for 2 months its weird

from monstache.

sachinnagesh avatar sachinnagesh commented on May 28, 2024

@yunusemrecatalcam Yes we started facing issue from last 2-3 months.

from monstache.

sachinnagesh avatar sachinnagesh commented on May 28, 2024

@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.

from monstache.

sachinnagesh avatar sachinnagesh commented on May 28, 2024

@yunusemrecatalcam I think another way to solve this is to add readPreference from primary

from monstache.

arcimen54 avatar arcimen54 commented on May 28, 2024

Hi,
I have a very similar problem.
im using this versions:

  • Elastic v7.17.9
  • Mongodb 6.0.14
  • Monstache 6.7.17

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?

from monstache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.