-
Notifications
You must be signed in to change notification settings - Fork 23
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
Log errors and proceed when reindexing #172
base: master
Are you sure you want to change the base?
Conversation
(... which have been created by virtualenv .)
We have a ZODB which contains at least one object (after processing of 13000 objects) which can't be reindexed. Of course we do want the remaining 50000 objects to be reindexed, and we'd like to know *which one* causes the trouble. Thus, - we log the error, and - we count the errors. ZODB ConflictErrors are not handled that way (yet?) but re-raised.
- Added ImportError to bare except statement - removed unused variable e
PyLint complains about an unused variable, but it is wrong: That This is a little bit "special", but there is a good reason I use this syntax all the time: So, what do we do about this? |
In my Plone 4.3 setup, I got an AttributeError rather than an KeyError. With this change, the reindexing worked, and the single broken CatalogBrain was logged while the remaining 59644 have been reindexed.
Sorry for the noise. |
try: | ||
# this exception must be resubmitted: | ||
from ZODB.POSException import ConflictError | ||
except ImportError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we don't require it, better to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's best to add ZODB
to setup.py
catalog.catalog_object(obj, idxs=['object_provides'], update_metadata=False) | ||
except ConflictError: | ||
raise | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good idea; if you don't know what other exception can be raised here, better to remove this also or we can hide some other issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this operation be better atomic? The only improvement that could be made is to log the object that failed but raise the exception right away. If the upgrade runs without error, many users may think that everything went well when it didn't.
@tobiasherp does the upgrade step not stop when a ConflictErrors occurs but stop for when another error occurs? It is? |
try: | ||
# this exception must be resubmitted: | ||
from ZODB.POSException import ConflictError | ||
except ImportError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's best to add ZODB
to setup.py
catalog.catalog_object(obj, idxs=['object_provides'], update_metadata=False) | ||
except ConflictError: | ||
raise | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this operation be better atomic? The only improvement that could be made is to log the object that failed but raise the exception right away. If the upgrade runs without error, many users may think that everything went well when it didn't.
We have a ZODB which contains at least one object (after processing of 13000 objects) which can't be reindexed.
Of course we do want the remaining 50000 objects to be reindexed, and we'd like to know which one causes the trouble.
Thus,
ZODB ConflictErrors are not handled that way (yet?) but re-raised.