Skip to content

Commit

Permalink
Set json sync push to be ordered
Browse files Browse the repository at this point in the history
  • Loading branch information
maallen committed Aug 10, 2023
1 parent c62a953 commit 5f73f33
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
name = "third_party_sync_file_checksum",
indexes = {
@Index(
name = "UK__THIRD_PARTY_FILE_CHECKSUM__REPOSITORY_ID__FILE_NAME",
columnList = "repository_id, file_name",
name = "I__THIRD_PARTY__CHECKSUM__REPOSITORY_ID__FILE_NAME__LOCALE_ID",
columnList = "repository_id, locale_id, file_name",
unique = true),
})
public class ThirdPartyFileChecksum implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,16 +912,17 @@ private Stream<List<TextUnitDTO>> partitionSingulars(
String localeTag,
String skipTextUnitsWithPattern,
String skipAssetsWithPathPattern) {
return partitionedStream(
TextUnitSearcherParameters parameters =
baseParams(
repositoryId,
localeTag,
skipTextUnitsWithPattern,
skipAssetsWithPathPattern,
true,
true,
null),
textUnitSearcher::search);
null);
parameters.setOrdered(true);
return partitionedStream(parameters, textUnitSearcher::search);
}

private Stream<List<TextUnitDTO>> partitionSingulars(
Expand All @@ -930,7 +931,7 @@ private Stream<List<TextUnitDTO>> partitionSingulars(
String skipTextUnitsWithPattern,
String skipAssetsWithPathPattern,
String includeTextUnitWithPattern) {
return partitionedStream(
TextUnitSearcherParameters parameters =
baseParams(
repositoryId,
localeTag,
Expand All @@ -939,25 +940,27 @@ private Stream<List<TextUnitDTO>> partitionSingulars(
true,
true,
null,
includeTextUnitWithPattern),
textUnitSearcher::search);
includeTextUnitWithPattern);
parameters.setOrdered(true);
return partitionedStream(parameters, textUnitSearcher::search);
}

private Stream<List<TextUnitDTO>> partitionPlurals(
Long repositoryId,
String localeTag,
String skipTextUnitsWithPattern,
String skipAssetsWithPathPattern) {
return partitionedStream(
TextUnitSearcherParameters parameters =
baseParams(
repositoryId,
localeTag,
skipTextUnitsWithPattern,
skipAssetsWithPathPattern,
false,
false,
"%"),
textUnitSearcher::search);
"%");
parameters.setOrdered(true);
return partitionedStream(parameters, textUnitSearcher::search);
}

private Stream<List<TextUnitDTO>> partitionPlurals(
Expand All @@ -980,7 +983,7 @@ private Stream<List<TextUnitDTO>> partitionPlurals(
.collect(Collectors.toList()));
}

return partitionedStream(
TextUnitSearcherParameters parameters =
baseParams(
repositoryId,
localeTag,
Expand All @@ -989,8 +992,11 @@ private Stream<List<TextUnitDTO>> partitionPlurals(
false,
false,
"%",
includeTextUnitsWithPattern),
searchFunction);
includeTextUnitsWithPattern);

parameters.setOrdered(true);

return partitionedStream(parameters, searchFunction);
}

private Stream<List<TextUnitDTO>> partitionedStream(
Expand Down Expand Up @@ -1056,7 +1062,6 @@ private TextUnitSearcherParameters baseParams(
result.setPluralFormsExcluded(pluralFormsExcluded);
result.setSkipTextUnitWithPattern(skipTextUnitsWithPattern);
result.setSkipAssetPathWithPattern(skipAssetsWithPathPattern);
result.setOrdered(true);
if (!Strings.isNullOrEmpty(pluralFormOther)) {
result.setPluralFormOther(pluralFormOther);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ PageFetcherOffsetAndLimitSplitIterator<TextUnitDTO> getSourceTextUnitIterator(
parameters.setOffset(offset);
parameters.setLimit(limit);
parameters.setPluralFormsFiltered(true);
parameters.setOrdered(true);
List<TextUnitDTO> search = textUnitSearcher.search(parameters);
return search;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
create table third_party_sync_file_checksum (repository_id bigint not null, locale_id bigint not null, checksum char(32) not null, file_name varchar(255) not null);
alter table third_party_sync_file_checksum add constraint FK__THIRD_PARTY_CHECKSUM__REPO__ID foreign key (repository_id) references repository (id);
alter table third_party_sync_file_checksum add constraint FK__THIRD_PARTY_CHECKSUM__LOCALE__ID foreign key (locale_id) references locale (id);
alter table third_party_sync_file_checksum add constraint FK__THIRD_PARTY_CHECKSUM__LOCALE__ID foreign key (locale_id) references locale (id);
create index I__THIRD_PARTY__CHECKSUM__REPOSITORY_ID__FILE_NAME__LOCALE_ID on third_party_sync_file_checksum(repository_id, locale_id, file_name)

0 comments on commit 5f73f33

Please sign in to comment.