{"action":"created","issue":{"url":"https://api.github.com/repos/LMFDB/lmfdb/issues/1169","repository_url":"https://api.github.com/repos/LMFDB/lmfdb","labels_url":"https://api.github.com/repos/LMFDB/lmfdb/issues/1169/labels{/name}","comments_url":"https://api.github.com/repos/LMFDB/lmfdb/issues/1169/comments","events_url":"https://api.github.com/repos/LMFDB/lmfdb/issues/1169/events","html_url":"https://github.com/LMFDB/lmfdb/issues/1169","id":153118503,"number":1169,"title":"Avoiding ensure_index/create_index","user":{"login":"edgarcosta","id":322822,"avatar_url":"https://avatars.githubusercontent.com/u/322822?v=3","gravatar_id":"","url":"https://api.github.com/users/edgarcosta","html_url":"https://github.com/edgarcosta","followers_url":"https://api.github.com/users/edgarcosta/followers","following_url":"https://api.github.com/users/edgarcosta/following{/other_user}","gists_url":"https://api.github.com/users/edgarcosta/gists{/gist_id}","starred_url":"https://api.github.com/users/edgarcosta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edgarcosta/subscriptions","organizations_url":"https://api.github.com/users/edgarcosta/orgs","repos_url":"https://api.github.com/users/edgarcosta/repos","events_url":"https://api.github.com/users/edgarcosta/events{/privacy}","received_events_url":"https://api.github.com/users/edgarcosta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LMFDB/lmfdb/labels/backend","name":"backend","color":"000000"},{"url":"https://api.github.com/repos/LMFDB/lmfdb/labels/critical","name":"critical","color":"c11d91"}],"state":"open","locked":false,"assignee":{"login":"haraldschilly","id":207405,"avatar_url":"https://avatars.githubusercontent.com/u/207405?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldschilly","html_url":"https://github.com/haraldschilly","followers_url":"https://api.github.com/users/haraldschilly/followers","following_url":"https://api.github.com/users/haraldschilly/following{/other_user}","gists_url":"https://api.github.com/users/haraldschilly/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldschilly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldschilly/subscriptions","organizations_url":"https://api.github.com/users/haraldschilly/orgs","repos_url":"https://api.github.com/users/haraldschilly/repos","events_url":"https://api.github.com/users/haraldschilly/events{/privacy}","received_events_url":"https://api.github.com/users/haraldschilly/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-05-04T21:25:11Z","updated_at":"2016-05-05T15:42:08Z","closed_at":null,"body":"Hello,\r\n\r\nThe functions: ensure_index/create_index must be avoided in the flask app.\r\nPerhaps the exception is when app saves a knowl.\r\nThe two main reasons are:\r\n- this operations must be done in the primary instance\r\n- and can lock writes and reads.\r\n\r\nIf we are running a client in the cloud, and warwick is the primary, the ensure_index knowles adds a 5/10s delay.\r\n\r\nAlso, since 3.0, ensureIndex()  == createIndex(), see https://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/.\r\n\r\nFrom: https://docs.mongodb.org/manual/core/index-creation/\r\n> By default, creating an index blocks all other operations on a database. When building an index on a collection, the database that holds the collection is unavailable for read or write operations until the index build completes. Any operation that requires a read or write lock on all databases (e.g. listDatabases) will wait for the foreground index build to \r\n\r\nFor example, in these 3 examples the index should be done after a write, not before a read:\r\n- [x] lmfdb/lmfdb/knowledge/knowl.py\r\n- [x] lmfdb/knowledge/main.py \r\n- [x] lmfdb/lmfdb/users/main.py \r\n\r\nI'm not sure what do with this one:\r\n- [ ] lmfdb/raw.py\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/LMFDB/lmfdb/issues/comments/217189893","html_url":"https://github.com/LMFDB/lmfdb/issues/1169#issuecomment-217189893","issue_url":"https://api.github.com/repos/LMFDB/lmfdb/issues/1169","id":217189893,"user":{"login":"jwj61","id":1873320,"avatar_url":"https://avatars.githubusercontent.com/u/1873320?v=3","gravatar_id":"","url":"https://api.github.com/users/jwj61","html_url":"https://github.com/jwj61","followers_url":"https://api.github.com/users/jwj61/followers","following_url":"https://api.github.com/users/jwj61/following{/other_user}","gists_url":"https://api.github.com/users/jwj61/gists{/gist_id}","starred_url":"https://api.github.com/users/jwj61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwj61/subscriptions","organizations_url":"https://api.github.com/users/jwj61/orgs","repos_url":"https://api.github.com/users/jwj61/repos","events_url":"https://api.github.com/users/jwj61/events{/privacy}","received_events_url":"https://api.github.com/users/jwj61/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T15:42:08Z","updated_at":"2016-05-05T15:42:08Z","body":"Raw was created before my time.  I think it was essentially a preliminary/debugging tool.  If you just go to /raw, you _should_ get a list of databases (I think).  This is from memory since it is broken now (without any of today's pull requests).\r\n\r\n/raw is one of the \"secret urls\" in the sense that nothing links to it, so I think it is ok to break it for now, and then we can revisit it at a workshop to decide if it should be fixed/preserved, or removed.\r\n"}}