Wait_for_completion doesn't seem to be working when making a snapshot


(Robin Clarke) #1

I am writing a small script to create a snapshot of my kibana-int index,
and hit an odd race condition.

I delete the old snapshot if it exists:
curl -XDELETE
'http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty'

Then make the new snapshot
curl -XPUT "http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty"
-d '{
"indices": "kibana-int",
"ignore_unavailable": true,
"wait_for_completion": true,
"include_global_state": false
}'

Then create a tarball of the backup to transfer to another machine
tar czf /DATA/elasticsearch/kibana-int.tgz -C /DATA/elasticsearch ./backup

When scripted, it seems that the DELETE, and/or PUT are not complete, and I
get this error:
tar: ./backup/indices/kibana-int/4: file changed as we read it
tar: ./backup/indices/kibana-int/2: file changed as we read it
tar: ./backup/indices/kibana-int/3: file changed as we read it

I tried putting a sleep between the DELETE and the PUT, and same error, so
it seems that perhaps the "wait_for_completion" is not doing what it
should...?

Any ideas, other than just putting a sleep in there?

Cheers!

-Robin-

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7962b247-f4d1-47d3-9e73-25544ff7aa84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Igor Motov) #2

The wait_for_completion flag has to be specified on URL not in the body.
Try this:

curl -XPUT "
http://localhost:9200/_snapshot/backup/snapshot_kibana?wait_for_completion=true&prettyhttp://localhost:9200/_snapshot/backup/snapshot_kibana?pretty"
-d '{
"indices": "kibana-int",
"ignore_unavailable": true,
"include_global_state": false
}'

On Wednesday, April 2, 2014 9:43:14 AM UTC-4, Robin Clarke wrote:

I am writing a small script to create a snapshot of my kibana-int index,
and hit an odd race condition.

I delete the old snapshot if it exists:
curl -XDELETE '
http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty'

Then make the new snapshot
curl -XPUT "http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty"
-d '{
"indices": "kibana-int",
"ignore_unavailable": true,
"wait_for_completion": true,
"include_global_state": false
}'

Then create a tarball of the backup to transfer to another machine
tar czf /DATA/elasticsearch/kibana-int.tgz -C /DATA/elasticsearch ./backup

When scripted, it seems that the DELETE, and/or PUT are not complete, and
I get this error:
tar: ./backup/indices/kibana-int/4: file changed as we read it
tar: ./backup/indices/kibana-int/2: file changed as we read it
tar: ./backup/indices/kibana-int/3: file changed as we read it

I tried putting a sleep between the DELETE and the PUT, and same error, so
it seems that perhaps the "wait_for_completion" is not doing what it
should...?

Any ideas, other than just putting a sleep in there?

Cheers!

-Robin-

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/beb0d9d0-73ef-4ce1-8e1f-c70e083d65d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Robin Clarke) #3

Thanks that works! I didn't notice that detail. Odd that some parameters
work in the URL or body, and some only in the URL... o_O

Cheers,
-Robin-

On Wednesday, 2 April 2014 16:11:27 UTC+2, Igor Motov wrote:

The wait_for_completion flag has to be specified on URL not in the body.
Try this:

curl -XPUT "
http://localhost:9200/_snapshot/backup/snapshot_kibana?wait_for_completion=true&prettyhttp://localhost:9200/_snapshot/backup/snapshot_kibana?pretty"
-d '{
"indices": "kibana-int",
"ignore_unavailable": true,
"include_global_state": false
}'

On Wednesday, April 2, 2014 9:43:14 AM UTC-4, Robin Clarke wrote:

I am writing a small script to create a snapshot of my kibana-int index,
and hit an odd race condition.

I delete the old snapshot if it exists:
curl -XDELETE '
http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty'

Then make the new snapshot
curl -XPUT "http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty"
-d '{
"indices": "kibana-int",
"ignore_unavailable": true,
"wait_for_completion": true,
"include_global_state": false
}'

Then create a tarball of the backup to transfer to another machine
tar czf /DATA/elasticsearch/kibana-int.tgz -C /DATA/elasticsearch ./backup

When scripted, it seems that the DELETE, and/or PUT are not complete, and
I get this error:
tar: ./backup/indices/kibana-int/4: file changed as we read it
tar: ./backup/indices/kibana-int/2: file changed as we read it
tar: ./backup/indices/kibana-int/3: file changed as we read it

I tried putting a sleep between the DELETE and the PUT, and same error,
so it seems that perhaps the "wait_for_completion" is not doing what it
should...?

Any ideas, other than just putting a sleep in there?

Cheers!

-Robin-

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e4f2dca1-b40e-427d-9bec-a44dcd4479ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4