java版のGAEでindexを䜜成したずころ、[Error]ずなる

146 views
Skip to first unread message

yasu↑

unread,
Jan 3, 2010, 3:44:53 AM1/3/10
to Google-App-Engine-Japan
はじめたしお。
珟圚、java版のGAEでサむトを䜜成しおいるのですが、
datastore-indexes-auto.xmlファむルでindexを远加したずころ、
Errorずなり、回埩たたは削陀方法がわかりたせん。

皆様のお知恵を拝借させおください。

xmlファむルで

<datastore-index kind="GuestBook"
ancestor="false">
<property name="oya_id" direction="asc" />
<property name="date" direction="desc" />
</datastore-index>

ず蚘述しおおりたしお、
jdoファむルは、

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class GuestBook {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private Date date;
@Persistent
private String hn;
@Persistent
private String title;
@Persistent
private String content;
@Persistent
private Long oya_id;
@Persistent
private String pwd;


/**
* コンストラクタ
* @param horseName
*/
public GuestBook(Date date, String hn, String title, String content,
Long oya_id, String pwd){
this.date = date;
this.hn = hn;
this.title = title;
this.content = content;
this.oya_id = oya_id;
this.pwd = pwd;
}

以䞋、アクセッサメ゜ッドなので省略したす。

やりたいこずは、oya_idが同じデヌタをdataの日付順で゜ヌトさせ衚瀺させたいず思っおいたす。
具䜓的には、

Query queryRes = pm.newQuery(GuestBook.class);
queryRes.setFilter("oya_id == parent_id");
queryRes.declareParameters("Long parent_id");
queryRes.setOrdering("date desc");
List<GuestBook> reslist = (List<GuestBook>) queryRes.execute
(GaeUtil.NullLong(request.getParameter("oya_id")));

ずやりたいず思っおいるのですが、indexが゚ラヌなので䞊手く動䜜したせん。
indexの回埩方法を教えお䞋さい。


m seleron

unread,
Jan 4, 2010, 12:13:42 AM1/4/10
to google-app-...@googlegroups.com
はじめたしお、

゚ラヌ内容の詳现が぀かめないため
本番環境にお、[no matching index found]が発生
ずいう前提ですが、

App engineの管理画面にある[Datastore Indexes]にお
Indexが衚瀺される事を確認ください。

・該圓のIndexが衚瀺されない堎合
  Indexが存圚しない事により゚ラヌが発生しおいるず思いたす。
  ロヌカル環境でク゚リヌを実行した際䜜成される
   datastore-indexes-auto.xmlを䜿甚するこずにより
   ミスは軜枛されるず思いたす。

・該圓のIndexが衚瀺されおいる堎合、
 IndexのStatusを確認しおください。
 Statusが[Building]の堎合は、デヌタ取埗時に
 [no matching index found]が発生したす。

 Status[Building]は、時間が経過するず[Serving]に倉わりたす。
 しばらく時間がかかる堎合があるようです。
 Statusが[Serving]の状態でしたら
 正垞にデヌタ取埗が行えるかず思いたす。

゚ラヌ内容等に盞違点がありたしたら
情報よろしくお願いしたす。
䞊蚘の珟象でない堎合は、デヌタ件数などその他の情報が必芁になるかもしれたせん

以䞊です。
埡確認䞋さい。

2010幎1月3日17:44 yasu↑ <yasu...@gmail.com>:

> --
>
> このメヌルは Google グルヌプのグルヌプ「Google-App-Engine-Japan」の登録者に送られおいたす。
> このグルヌプに投皿するには、google-app-...@googlegroups.com にメヌルを送信しおください。
> このグルヌプから退䌚するには、google-app-engine...@googlegroups.com にメヌルを送信しおください。
> 詳现に぀いおは、http://groups.google.com/group/google-app-engine-japan?hl=ja からこのグルヌプにアクセスしおください。
>
>

yasu↑

unread,
Jan 5, 2010, 6:55:30 AM1/5/10
to Google-App-Engine-Japan
返信ありがずうございたす。
本番環境にお゚ラヌが発生しおおりたしお、
[Datastore Indexes]におも
statusが[Error]ずなっおおりたす。
eclipseにおファむルをデプロむする際も゚ラヌがでる状況になっおいたす。

゚ラヌ内容は、
「com.google.appengine.tools.admin.AdminException: Unable to update
app: Error posting to URL: http://appengine.google.com/api/datastore/index/add?app_id=crane-member&version=9&
400 Bad Request
Cannot build indexes that are in state ERROR.

To vacuum and rebuild your indexes:
1. Create a backup of your index.yaml specification.
2. Determine the indexes in state ERROR from your admin console:
https://appengine.google.com/datastore/indexes?&app_id=crane-member
3. Remove the definitions of the indexes in ERROR from your index.yaml
file.
4. Run "appcfg.py vacuum_indexes your_app_dir/"
5. Wait until the ERROR indexes no longer appear in your admin
console.
6. Replace the modified version of your index.yaml file with the
original.
7. Run "appcfg.py update_indexes your_app_dir/"

at com.google.appengine.tools.admin.AppAdminImpl.update
(AppAdminImpl.java:62)
at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy
(AppEngineBridgeImpl.java:271)
at
com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace
(DeployProjectJob.java:148)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run
(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.io.IOException: Error posting to URL:
http://appengine.google.com/api/datastore/index/add?app_id=crane-member&version=9&
400 Bad Request
Cannot build indexes that are in state ERROR.

To vacuum and rebuild your indexes:
1. Create a backup of your index.yaml specification.
2. Determine the indexes in state ERROR from your admin console:
https://appengine.google.com/datastore/indexes?&app_id=crane-member
3. Remove the definitions of the indexes in ERROR from your index.yaml
file.
4. Run "appcfg.py vacuum_indexes your_app_dir/"
5. Wait until the ERROR indexes no longer appear in your admin
console.
6. Replace the modified version of your index.yaml file with the
original.
7. Run "appcfg.py update_indexes your_app_dir/"

at com.google.appengine.tools.admin.ServerConnection.send
(ServerConnection.java:143)
at com.google.appengine.tools.admin.ServerConnection.post
(ServerConnection.java:81)
at com.google.appengine.tools.admin.AppVersionUpload.send
(AppVersionUpload.java:522)
at com.google.appengine.tools.admin.AppVersionUpload.updateIndexes
(AppVersionUpload.java:240)
at com.google.appengine.tools.admin.AppVersionUpload.doUpload
(AppVersionUpload.java:132)
at com.google.appengine.tools.admin.AppAdminImpl.update
(AppAdminImpl.java:56)
... 4 more
」

java版なので、「index.yaml 」ファむルがないので
どうすれば、この゚ラヌが取れるのか解らない状態ずなっおいたす。


seleronm

unread,
Jan 5, 2010, 6:54:29 PM1/5/10
to google-app-...@googlegroups.com

お返事ありがずうございたす。

そうですか、メッセヌゞに衚瀺されおいるvacuum_indexes(未䜿甚INDEXの削陀)
は、
珟圚のずころpython版でのみ実行できるコマンドだず思いたすので
「Google App Engine SDK for Python」の環境を䜜成する必芁があるず思いたす。


幎末幎始甚の緊急問い合わせテンプレヌト
(珟圚が幎末幎始の範囲かは、䞍明ですが
にお問い合わせをされるのが劥圓な察応になるず思いたす。。
http://code.google.com/p/googleappengine/issues/entry?template=Production%20issue

蛇足ですが、
Google App Engine SDK for Pythonでの
vacuum_indexesコマンド実行たでの手順を
乱文ではありたすが蚘茉いたしたすので、
興味があれば、お詊しください。
(状態がServingのIndexでしたら削陀できるのですが・・


・ツヌルのむンストヌル

python2.5.2
http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
・ダりンロヌド→むンストヌル

Google App Engine SDK for Python
http://googleappengine.googlecode.com/files/GoogleAppEngine_1.3.0.msi
・ダりンロヌド→むンストヌル


・PJファむルの䜜成

デスクトップ䞊の「Google App Engine Launcher」を起動
メニュ[file]→[Create New Application]

起動したダむアログ画面
[Application Name]:[珟圚のappid](1)
[Parent Directory]:[任意のフォルダヌを指定](2)
→[Create]ボタンクリック

(2)で指定したフォルダヌに(1)のフォルダが䜜成されたす
app.yaml/index.yamlなどのファむルが存圚する事を確認しお䞋さい。

・vacuum_indexesの実行

以䞋のコマンドを実行しお䞋さい。

[Google App Engine SDKむンストヌルフォルダヌ]\appcfg.py vacuum_indexes
[(2)+(1)フォルダ]

コマンドの詳现
http://code.google.com/intl/ja/appengine/docs/python/tools/uploadinganapp.html#Deleting_Unused_Indexes

もし、゚ラヌコマンド実行時に゚ラヌ発生するようでしたら。
蚭定ファむルapp.yamlの内容を確認しお䞋さい。
http://code.google.com/intl/ja/appengine/docs/python/config/appconfig.html#About_app_yaml


・コマンド実行埌
1.メヌルアドレス・パスワヌドの入力入力が求められるず思いたす。

2.その埌、Index削陀確認が衚瀺されたすので[y]を遞択しお䞋さい。

䞊蚘の手順を行う事により
通垞、管理画面[Datastore Indexes]にお
該圓IndexのStatusが[deleting] ずなり
しばらくするず、
管理画面[Datastore Indexes]から該圓INDEXは衚瀺されなくなりたす。
該圓INDEXが衚瀺されなくなった時点で削陀は完了ずなりたす。

以䞊です。

>--
>
>このメヌルは Google グルヌプのグルヌプ「Google-App-Engine-Japan」の登録者に送
>られおいたす。
>このグルヌプに投皿するには、google-app-...@googlegroups.com にメヌル
>を送信しおください。

>このグルヌプから退䌚するには、google-app-engine-japan+
>unsub...@googlegroups.com にメヌルを送信しおください。
>詳现に぀いおは、http://groups.google.com/group/google-app-engine-japan?hl=ja
>からこのグルヌプにアクセスしおください。

Reply all
Reply to author
Forward
0 new messages