piz*_*fox 7 database indexing node.js grpc google-cloud-firestore
几天前,数千个错误开始Error: too many index entries for entity
从我们的云功能之一涌入 Google Stackdriver。
我们的代码已经有一段时间没有更改了,所以我相信该错误是由于 Firestore 中的某些内容发生更改导致查询或写入操作在此函数中失败。
完整的堆栈跟踪如下。
请注意,引用的文件都不是我们编写的代码,只是 Google 的内部函数内容。
Error: too many index entries for entity
at Http2CallStream.call.on (/srv/functions/node_modules/@grpc/grpc-js/build/src/client.js:96:45)
at Http2CallStream.emit (events.js:194:15)
at Http2CallStream.EventEmitter.emit (domain.js:459:23)
at process.nextTick (/srv/functions/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
Run Code Online (Sandbox Code Playgroud)
简短的研究使我们相信索引下包含的文档太多。该函数正在访问的集合目前约有 35,000 个文档。我们删除了创建的一个复合索引,但错误仍然发生。该错误将导致函数崩溃,并且触发该错误的 HTTP 请求将返回错误页面。这种情况无法始终如一地重现,并且似乎是随机发生的(大约 5% 的请求失败)。
如有必要,我很乐意提供有关 Firestore 设置或函数源代码的更多信息。任何帮助是极大的赞赏。