mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
autobackup before making any changes, fixing number_of_replicas datatype
This commit is contained in:
parent
dc9fd72cde
commit
6510b5af15
@ -64,7 +64,7 @@ INDEX_CONFIG = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"number_of_replicas": 0
|
"number_of_replicas": "0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -155,7 +155,7 @@ INDEX_CONFIG = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"number_of_replicas": 0
|
"number_of_replicas": "0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -206,7 +206,7 @@ INDEX_CONFIG = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"number_of_replicas": 0
|
"number_of_replicas": "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -489,6 +489,9 @@ def restore_from_backup():
|
|||||||
|
|
||||||
def index_check(force_restore=False):
|
def index_check(force_restore=False):
|
||||||
""" check if all indexes are created and have correct mapping """
|
""" check if all indexes are created and have correct mapping """
|
||||||
|
|
||||||
|
backed_up = False
|
||||||
|
|
||||||
for index in INDEX_CONFIG:
|
for index in INDEX_CONFIG:
|
||||||
index_name = index['index_name']
|
index_name = index['index_name']
|
||||||
expected_map = index['expected_map']
|
expected_map = index['expected_map']
|
||||||
@ -509,6 +512,12 @@ def index_check(force_restore=False):
|
|||||||
# validate index
|
# validate index
|
||||||
rebuild = handler.validate()
|
rebuild = handler.validate()
|
||||||
if rebuild:
|
if rebuild:
|
||||||
|
# make backup before rebuild
|
||||||
|
if not backed_up:
|
||||||
|
print('running backup first')
|
||||||
|
backup_all_indexes()
|
||||||
|
backed_up = True
|
||||||
|
|
||||||
print(f'applying new mappings to index ta_{index_name}...')
|
print(f'applying new mappings to index ta_{index_name}...')
|
||||||
handler.rebuild_index()
|
handler.rebuild_index()
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user