-
Notifications
You must be signed in to change notification settings - Fork 28
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
Bugfix/233 store as binary #234
Bugfix/233 store as binary #234
Conversation
…if that's the case it will be stored as binary
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.
thanks a lot for the fix. I was about to do the same but got disrupted than.
left 2 minor comments
@@ -77,6 +86,9 @@ public class HistoryUtil { | |||
protected static final String ATTR_START = "start"; | |||
protected static final String ATTR_END = "end"; | |||
private static final String NAME_INDEX = "oak:index"; | |||
// This size is limited by the LuceneDocumentMaker to be able to read the property and create the new index | |||
// The limit is 102400 but just to be in the safe side, is set to a bit lower number | |||
private static final int MAXIMUN_PROPERTY_SIZE = 100000; |
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.
typo: MAXIMUN_PROPERTY_SIZE -> MAXIMUM_PROPERTY_SIZE
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.
Fixed
@@ -358,7 +370,21 @@ private void saveExecutionResultInHistory(ExecutionResult result, String path, R | |||
values.put(ATTR_RUN_STATE, result.getState().name()); | |||
values.put(ATTR_PATH, result.getPath()); | |||
if (StringUtils.isNotBlank(result.getOutput())) { | |||
values.put(ATTR_RUN_OUTPUT, result.getOutput()); | |||
if (result.getOutput().getBytes(StandardCharsets.UTF_8).length < MAXIMUN_PROPERTY_SIZE) { |
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.
small change suggestion: store full data in seperate property in case it is too big. like that we don't need to check type of the property when reading.
if (result.getOutput().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PROPERTY_SIZE) {
values.put(ATTR_RUN_OUTPUT, "Output data too big, full data is stored as a binary in runOutputFull");
values.put(ATTR_RUN_OUTPUT_FULL, new ByteArrayInputStream(result.getOutput().getBytes(StandardCharsets.UTF_8)));
LOG.info("Script result is bigger than 100 000 bytes. Full data can be found as a binary in property runOutputFull for path " + path );
}
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.
Added the new property
I would appreciate if you could publish a minor version with the latest changes Thanks! |
just released it, thanks for your contributions @pcastelog ! |
Will solve #233