Skip to content

Conversation

@Aniket392
Copy link
Collaborator

  • Updated replicationConfiguration constructor to take updated paramaters
  • Updated LogConfiguration to LogSink and its method
  • Removed API for adding collection as per new APIs
  • Changed the logic to update collectionconfig and update replconfig

.setDirectory(directory);
if (maxRotateCount > 1) {
config.setMaxRotateCount(maxRotateCount);
builder.setMaxKeptFiles(maxRotateCount-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to be maxRotateCount + 1.

maxKeptFiles = maxRotateCount + 1.

CC: @velicuvlad

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated maxKeptFiles = maxRotateCount + 1

public int getMaxRotateCount(Args args) {
return Database.log.getFile().getConfig().getMaxRotateCount();
FileLogSink sink = LogSinks.get().getFile();
return sink != null ? sink.getMaxKeptFiles() - 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct.

.setMaxFileSize(currentSink.getMaxFileSize())
.setMaxKeptFiles(currentSink.getMaxKeptFiles())
.setPlainText(currentSink.isPlainText())
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

There is public Builder(@nonnull FileLogSink sink) that you can use here instead of re-setting everything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the FileLogSink Builder with builder of logSink parameter


if (currentSink == null) return null;

FileLogSink newSink = new FileLogSink.Builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

There is public Builder(@nonnull FileLogSink sink) that you can use here instead of re-setting everything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the FileLogSink Builder with builder of logSink parameter


if (currentSink == null) return null;

FileLogSink newSink = new FileLogSink.Builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

There is public Builder(@nonnull FileLogSink sink) that you can use here instead of re-setting everything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the FileLogSink Builder with builder of logSink parameter

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.getChannels();
CollectionConfiguration collectionConfiguration = args.get("configuration");
return collectionConfiguration.getChannels();
Copy link
Contributor

Choose a reason for hiding this comment

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

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.collections.get(0).getChannels();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated as
replicatorConfiguration.getCollections().stream().findFirst().map(CollectionConfiguration::getChannels).orElse(null);

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.getDatabase();
CollectionConfiguration collectionConfiguration = args.get("configuration");
return collectionConfiguration.getCollection().getDatabase();
Copy link
Contributor

Choose a reason for hiding this comment

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

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.collections.get(0).getCollection().getDatabase();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated as
replicatorConfiguration.getCollections().stream().findFirst().map(it -> it.getCollection().getDatabase()).orElse(null);

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.getDocumentIDs();
CollectionConfiguration collectionConfigurationConfiguration = args.get("configuration");
return collectionConfigurationConfiguration.getDocumentIDs();
Copy link
Contributor

Choose a reason for hiding this comment

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

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.collections.get(0).getDocumentIDs();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated as
replicatorConfiguration.getCollections().stream().findFirst().map(CollectionConfiguration::getDocumentIDs).orElse(null)

}

public void setChannels(Args args) {
ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure that it should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both setChannels and setDocument are needed to change or remove as discussed in #156 (comment)

CollectionConfiguration collectionConfigurationConfiguration = args.get("configuration");
List<String> documentIds = args.get("documentIds");
replicatorConfiguration.setDocumentIDs(documentIds);
collectionConfigurationConfiguration.setDocumentIDs(documentIds);
Copy link
Contributor

Choose a reason for hiding this comment

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

ReplicatorConfiguration replicatorConfiguration = args.get("configuration");
return replicatorConfiguration.collections.get(0).setDocumentIDs(documentIds);

Need to confirm that replicatorConfiguration.collections doesn't return a copy otherwise this will not work. I couldn't think about the alternative though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both setChannels and setDocument are needed to change or remove as discussed in #156 (comment)

@Aniket392 Aniket392 requested a review from pasin September 25, 2025 07:39
Copy link
Contributor

@pasin pasin left a comment

Choose a reason for hiding this comment

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

Look good to me.

Need @sanjivanipatrax @barkha06 to review about removing setting document ids / channels filter and addCollections endpoints as those will not be available anymore.

@Aniket392 Aniket392 merged commit dd3ace8 into 3.3.x Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants