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

SOLR-15986: CommitUpdateCommand and SplitIndexCommand can write user commit metadata. #608

Closed
wants to merge 2 commits into from

Conversation

bruno-roustant
Copy link
Contributor

@bruno-roustant bruno-roustant commented Feb 8, 2022

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this populated? Or maybe you are thinking this is just an internal feature for plugin writers?

@@ -54,6 +57,7 @@ public String toString() {
+",expungeDeletes="+expungeDeletes
+",softCommit="+softCommit
+",prepareCommit="+prepareCommit
+",commitData="+commitData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead please only do this if there is some data. This will be rare. I think this toString gets printed in logs and it's already rather verbose given some of these settings are more rare. If you are feeling slightly ambitious, maybe only add the "true" & non-null items but not others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add only if commitData is not null.

commitData.put(COMMIT_TIME_MSEC_KEY, String.valueOf(System.currentTimeMillis()));
commitData.put(COMMIT_COMMAND_VERSION, String.valueOf(commitCommandVersion));
iw.setLiveCommitData(commitData.entrySet());
public static void setCommitData(IndexWriter iw, long commitCommandVersion, Map<String, String> commitData) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps building the whole map should actually go into CommitUpdateCommand? -- getCommitMetadata() and separately have getCustomCommitMetadata to differentiate the user provided add-on stuff from that provided by Solr itself? Just an idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep the building here as we always want to add this Solr-internal data. As I see it, CommitUpdateCommand is the user command, it could be error-prone to have these internal params in CommitUpdateCommand.

@@ -176,14 +176,18 @@ private SolrIndexWriter(SolrCore core, String name, String path, Directory direc
}
}

public static void setCommitData(IndexWriter iw, long commitCommandVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears this is now unused (sorta) I'd just remove it. It's too internal to worry about back-compat.
I see one remaining caller; did you deliberately choose for that to not call the new version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call from DirectUpdateHandler2.closeWriter() can provide a null param.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call from SolrIndexSplitter.doSplit() could set the commit metadata from the split command itself because it commits. I'll update this PR to also allow the (plugin writer) user to set commit metadata in the split command.

@bruno-roustant
Copy link
Contributor Author

Yes I'm thinking of it just as an internal feature.

@bruno-roustant bruno-roustant changed the title SOLR-15986: CommitUpdateCommand writes user commit metadata. SOLR-15986: CommitUpdateCommand and SplitIndexCommand can write user commit metadata. Mar 1, 2022
@bruno-roustant bruno-roustant deleted the commitdata branch June 15, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants