简体   繁体   English

对谷歌数据存储模拟器的查询不断执行

[英]Query to google datastore emulator keeps executing endlessly

When I run my query function to datastore emulator, it just starts executing and doesn't stop.当我将查询函数运行到数据存储模拟器时,它只是开始执行并且不会停止。 No errors are thrown, no nothing.没有错误被抛出,什么都没有。 CPU is heavily loaded until I just kill the job. CPU 负载很重,直到我停止工作。 I did set the environment variables, I even manually provided apiEndpoint to my query function我确实设置了环境变量,我什至手动将 apiEndpoint 提供给我的查询函数

const datastore = new Datastore({
        apiEndpoint: "http://localhost:8081"
    });

Output from SDK is as follows: SDK输出如下:

Executing: cmd /c C:\\Users\\oskid\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\cloud-datastore-emulator\\cloud_datastore_emulator.cmd start --host=localhost --port=8081 --store_on_disk=True --consistency=0.9 --allow_remote_shutdown C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulators\\datastore [datastore] Mar 18, 2020 9:47:38 AM com.google.cloud.datastore.emulator.CloudDatastore$FakeDatastoreAction$9 apply [datastore] INFO: Provided --allow_remote_shutdown to start command which is no longer necessary.执行: cmd /c C:\\Users\\oskid\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\cloud-datastore-emulator\\cloud_datastore_emulator.cmd start --host=localhost --port=8081 - -store_on_disk=True --consistency=0.9 --allow_remote_shutdown C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulators\\datastore [datastore] 2020 年 3 月 18 日上午 9:47:38 com.google.cloud.datastore.emulator .CloudDatastore$FakeDatastoreAction$9 apply [datastore] INFO:提供了 --allow_remote_shutdown 来启动不再需要的命令。 [datastore] Mar 18, 2020 9:47:38 AM com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub [datastore] INFO: Local Datastore initialized: [datastore] [数据存储] 2020 年 3 月 18 日上午 9:47:38 com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub [数据存储] 信息:本地数据存储已初始化:[数据存储]
Type: High Replication [datastore] Storage: C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulators\\datastore\\WEB-INF\\appengine-generated\\local_db.bin [datastore] Mar 18, 2020 9:47:39 AM com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub load [datastore] INFO: The backing store, C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulators\\datastore\\WEB-INF\\appengine-generated\\local_db.bin, does not exist.类型:High Replication [datastore] 存储:C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulators\\datastore\\WEB-INF\\appengine-generated\\local_db.bin [datastore] 2020 年 3 月 18 日上午 9:47:39 com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub load [datastore] INFO:后备存储,C:\\Users\\oskid\\AppData\\Roaming\\gcloud\\emulator\\datastore\\WEB-INF\\appengine-generated\\local_db。斌,不存在。 It will be created.它将被创建。 [datastore] API endpoint: http://localhost:8081 [datastore] If you are using a library that supports the DATASTORE_EMULATOR_HOST environment variable, run: [datastore] [datastore] export DATASTORE_EMULATOR_HOST=localhost:8081 [datastore] [datastore] Dev App Server is now running. [datastore] API 端点: http://localhost:8081 [datastore] 如果您使用的库支持 DATASTORE_EMULATOR_HOST 环境变量,请运行:[datastore] [datastore] export DATASTORE_EMULATOR_HOST=localhost:8081 [datastore] [datastore] Dev应用服务器现在正在运行。 [datastore] [datastore] The previous line was printed for backwards compatibility only. [datastore] [datastore] 打印前一行只是为了向后兼容。 [datastore] If your tests rely on it to confirm emulator startup, [datastore] please migrate to the emulator health check endpoint (/). [datastore] 如果您的测试依赖它来确认模拟器启动,[datastore] 请迁移到模拟器健康检查端点 (/)。 Thank you!谢谢! [datastore] The health check endpoint for this emulator instance is http://localhost:8081/Mar 18, 2020 9:54:25 AM io.gapi.emulators.grpc.GrpcServer$3 operationComplete [datastore] INFO: Adding handler(s) to newly registered Channel. [datastore] 此模拟器实例的运行状况检查端点为http://localhost:8081/Mar 18, 2020 9:54:25 AM io.gapi.emulators.grpc.GrpcServer$3 operationComplete [datastore] INFO:添加处理程序) 到新注册的频道。 [datastore] Mar 18, 2020 9:54:25 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead [datastore] INFO: Detected HTTP/2 connection. [数据存储] 2020 年 3 月 18 日上午 9:54:25 io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead [数据存储] 信息:检测到 HTTP/2 连接。

End output from my query function:我的查询函数的结束输出:

C:\\Users\\oskid\\Desktop\\my_project\\cloud-functions\\queryDS>npm start C:\\Users\\oskid\\Desktop\\my_project\\cloud-functions\\queryDS>npm start

queryDS@1.0.0 start C:\\Users\\oskid\\Desktop\\my_project\\cloud-functions\\queryDS functions-framework --target=staging_queryDS --port=443 queryDS@1.0.0 start C:\\Users\\oskid\\Desktop\\my_project\\cloud-functions\\queryDS functions-framework --target=staging_queryDS --port=443

Serving function... Function: staging_queryDS URL: http://localhost:443/ Supported severity levels: debug, info, notice, warning, error, critical, alert, emergency [notice] in [staging undefined queryDS] {"labels":{"appInstance":"staging","scope":"queryDS"}} : {"message":"[staging undefined queryDS] Invocation of function started"}服务功能... 功能:staging_queryDS URL: http://localhost:443/支持的严重级别:debug、info、notice、warning、error、critical、alert、emergency [notice] in [staging undefined queryDS] {"labels" :{"appInstance":"staging","scope":"queryDS"}} : {"message":"[staging undefined queryDS] 函数调用开始"}

Nothing gets generated in datastore\\WEB-INF\\appengine-generated folder, and no indexes are added to the local index.yaml.在 datastore\\WEB-INF\\appengine-generated 文件夹中没有生成任何内容,并且没有索引添加到本地 index.yaml。 Any ideas how to troubleshoot this?任何想法如何解决这个问题?

The first step would be to make sure that the Datastore Emulator component of the Cloud SDK is updated.第一步是确保更新 Cloud SDK 的 Datastore Emulator 组件。 This can be done via “gcloud components update”, and is referencedhere .这可以通过“gcloud 组件更新”完成,并在此处引用。 In order to make sure that the Cloud Function can execute properly, please run a test with a very simple query which is guaranteed to return successful results quickly as far as the database is concerned.为了确保 Cloud Function 可以正确执行,请使用非常简单的查询运行测试,就数据库而言,该查询保证快速返回成功的结果。 If it does, then it is advised to review the query submitted to target inefficiencies and make sure it follows best practices, detailed here .如果是,则建议检查提交的查询以解决效率低下的问题,并确保其遵循最佳实践,详见 此处 If it does not, you may look into the Cloud Function logs to see which operation fails.如果没有,您可以查看 Cloud Function日志以查看哪个操作失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM