Skip to content

Commit

Permalink
Revert "Run git gc periodically (#564)" (#615)
Browse files Browse the repository at this point in the history
Motivation:
We no longer need Git gc because we are going to provide a way to remove old commits.
#575

Modifications:
- Revert Git gc.

Result:
- This reverts commit e6caf26.
  • Loading branch information
minwoox authored Jul 6, 2021
1 parent 5108a8d commit c8fc35a
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 894 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,9 @@ public final class CentralDogmaBuilder {
private String sessionValidationSchedule = DEFAULT_SESSION_VALIDATION_SCHEDULE;
@Nullable
private Object authProviderProperties;

private int writeQuota;
private int timeWindowSeconds;

@Nullable
private RepositoryGarbageCollectionConfig repositoryGarbageCollection;

/**
* Creates a new builder with the specified data directory.
*/
Expand Down Expand Up @@ -524,18 +520,6 @@ public CentralDogmaBuilder writeQuotaPerRepository(int writeQuota, int timeWindo
return this;
}

/**
* Sets the minimum required number of commits newly added to run a garbage collection and the
* <a href="https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html">
* Quartz cron expression</a> when garbage collections is suppose to be triggered.
*/
public CentralDogmaBuilder repositoryGarbageCollection(int minNumNewCommits, String schedule) {
checkArgument(minNumNewCommits > 0, "minNumNewCommits: %s (expected: > 0)", minNumNewCommits);
requireNonNull(schedule, "schedule");
repositoryGarbageCollection = new RepositoryGarbageCollectionConfig(minNumNewCommits, schedule);
return this;
}

/**
* Returns a newly-created {@link CentralDogma} server.
*/
Expand Down Expand Up @@ -569,6 +553,6 @@ private CentralDogmaConfig buildConfig() {
maxRemovedRepositoryAgeMillis, gracefulShutdownTimeout,
webAppEnabled, webAppTitle, mirroringEnabled, numMirroringThreads,
maxNumFilesPerMirror, maxNumBytesPerMirror, replicationConfig,
null, accessLogFormat, authCfg, quotaConfig, repositoryGarbageCollection);
null, accessLogFormat, authCfg, quotaConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ public final class CentralDogmaConfig {
@Nullable
private final QuotaConfig writeQuotaPerRepository;

@Nullable
private final RepositoryGarbageCollectionConfig repositoryGarbageCollection;

CentralDogmaConfig(
@JsonProperty(value = "dataDir", required = true) File dataDir,
@JsonProperty(value = "ports", required = true)
Expand Down Expand Up @@ -168,9 +165,7 @@ public final class CentralDogmaConfig {
@JsonProperty("csrfTokenRequiredForThrift") @Nullable Boolean csrfTokenRequiredForThrift,
@JsonProperty("accessLogFormat") @Nullable String accessLogFormat,
@JsonProperty("authentication") @Nullable AuthConfig authConfig,
@JsonProperty("writeQuotaPerRepository") @Nullable QuotaConfig writeQuotaPerRepository,
@JsonProperty("repositoryGarbageCollection")
@Nullable RepositoryGarbageCollectionConfig repositoryGarbageCollection) {
@JsonProperty("writeQuotaPerRepository") @Nullable QuotaConfig writeQuotaPerRepository) {

this.dataDir = requireNonNull(dataDir, "dataDir");
this.ports = ImmutableList.copyOf(requireNonNull(ports, "ports"));
Expand Down Expand Up @@ -224,7 +219,6 @@ public final class CentralDogmaConfig {
ports.stream().anyMatch(ServerPort::hasProxyProtocol));

this.writeQuotaPerRepository = writeQuotaPerRepository;
this.repositoryGarbageCollection = repositoryGarbageCollection;
}

/**
Expand Down Expand Up @@ -462,16 +456,6 @@ public QuotaConfig writeQuotaPerRepository() {
return writeQuotaPerRepository;
}

/**
* Returns the {@link RepositoryGarbageCollectionConfig} for
* cleanuping unnecessary files and optimizing {@link Repository}s.
*/
@Nullable
@JsonProperty("repositoryGarbageCollection")
public RepositoryGarbageCollectionConfig repositoryGarbageCollection() {
return repositoryGarbageCollection;
}

@Override
public String toString() {
try {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ public <T> CompletableFuture<MergedEntry<T>> mergeFiles(Revision revision, Merge
return unwrap().mergeFiles(revision, query);
}

@Override
public Revision gc() throws Exception {
return unwrap().gc();
}

@Override
public Revision lastGcRevision() {
return unwrap().lastGcRevision();
}

@Override
public String toString() {
return Util.simpleTypeName(this) + '(' + unwrap() + ')';
Expand Down
Loading

0 comments on commit c8fc35a

Please sign in to comment.