# Wait\_for\_completion doesn't seem to be working when making a snapshot

**URL:** <https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767>\
**Category:** Elasticsearch\
**Created:** [April 2, 2014, 1:43pm UTC](https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767 "2014-04-02T13:43:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin\_Clarke](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Robin\_Clarke](https://discuss.elastic.co/u/Robin_Clarke)\
**Post date:** [April 2, 2014, 1:43pm UTC](https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767/1 "2014-04-02T13:43:14Z")

</div>

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](http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty)'

Then make the new snapshot  
curl -XPUT "[http://localhost:9200/\_snapshot/backup/snapshot\_kibana?pretty](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/7962b247-f4d1-47d3-9e73-25544ff7aa84%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 2, 2014, 2:11pm UTC](https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767/2 "2014-04-02T14:11:27Z")

</div>

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&pretty](http://localhost:9200/_snapshot/backup/snapshot_kibana?wait_for_completion=true&pretty)[http://localhost:9200/\_snapshot/backup/snapshot\_kibana?pretty](http://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](http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty)'
> 
> Then make the new snapshot  
> curl -XPUT "[http://localhost:9200/\_snapshot/backup/snapshot\_kibana?pretty](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/beb0d9d0-73ef-4ce1-8e1f-c70e083d65d5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Robin\_Clarke](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@Robin\_Clarke](https://discuss.elastic.co/u/Robin_Clarke)\
**Post date:** [April 2, 2014, 2:32pm UTC](https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767/3 "2014-04-02T14:32:49Z")

</div>

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&pretty](http://localhost:9200/_snapshot/backup/snapshot_kibana?wait_for_completion=true&pretty)[http://localhost:9200/\_snapshot/backup/snapshot\_kibana?pretty](http://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](http://localhost:9200/_snapshot/backup/snapshot_kibana?pretty)'
> > 
> > Then make the new snapshot  
> > curl -XPUT "[http://localhost:9200/\_snapshot/backup/snapshot\_kibana?pretty](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/e4f2dca1-b40e-427d-9bec-a44dcd4479ce%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:38am UTC](https://discuss.elastic.co/t/wait-for-completion-doesnt-seem-to-be-working-when-making-a-snapshot/16767/4 "2017-07-06T01:38:45Z")

</div>


