Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import19: add exception handling for drop_and_recreate_index #1785

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/moin/cli/migration/moin19/import19.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import os
import re
import sys
import codecs
import importlib
from io import BytesIO
Expand Down Expand Up @@ -272,13 +273,20 @@ def ImportMoin19(data_dir=None, markup_out=None, namespace=None, procs=None, lim
backend.store(meta, out)

logging.info("PHASE4: Rebuilding the index ...")
drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True)
msg = ""
try:
drop_and_recreate_index(app.storage, procs=procs, limitmb=limitmb, multisegment=True)
except Exception:
logging.exception("Index build failed. You can try to destroy, create and rebuild the index manually")
msg = " with errors"

logging.info("Finished conversion!")
logging.info(f"Finished conversion{msg}.")
if hasattr(conv_out, "unknown_macro_list"):
migr_statistics(unknown_macros=conv_out.unknown_macro_list)
else:
migr_statistics([])
if msg:
sys.exit(1)


class KillRequested(Exception):
Expand Down