Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

ABR 18: More ETEs #5911

Merged
merged 32 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
164d860
completeBackup ete
gsheasby Feb 14, 2022
a673645
Add restore methods to BackupAndRestoreResource
gsheasby Feb 14, 2022
d9cc93f
basic restore tests
gsheasby Feb 14, 2022
d1ba2e6
wiring
gsheasby Feb 15, 2022
0493647
addTodo patiently
gsheasby Feb 15, 2022
1ba7fa7
only register backup and restore resource if runtime config exists
gsheasby Feb 15, 2022
0da4925
ignorance is bliss
gsheasby Feb 15, 2022
e4b85cf
check timelock is disabled/reenabled
gsheasby Feb 15, 2022
6a1f76b
try commenting addTodo
gsheasby Feb 15, 2022
462eb4a
fix token
gsheasby Feb 15, 2022
0177cdb
[temp] alert when shutting down pooling
gsheasby Feb 15, 2022
b2a26aa
refactors
gsheasby Feb 15, 2022
0e1c6c1
fix exception assert
gsheasby Feb 15, 2022
3875630
fine, be that way
gsheasby Feb 17, 2022
63cc107
fix test setup
gsheasby Feb 17, 2022
4b17080
fix test interdependence
gsheasby Feb 17, 2022
1d813ee
fix assert
gsheasby Feb 17, 2022
72bc02b
optimism
gsheasby Feb 17, 2022
98239d9
close kvs for prod only
gsheasby Feb 17, 2022
2b2da18
internal
gsheasby Feb 17, 2022
84febf6
Make TimestampManagementService work for disabled namespaces
gsheasby Feb 17, 2022
72231c2
fix ete setup
gsheasby Feb 17, 2022
62a0bf2
CassRepairHelper: use KvsRunner
gsheasby Feb 17, 2022
9f2a68b
consistency
gsheasby Feb 17, 2022
726c960
remove debug code
gsheasby Feb 17, 2022
ecfa876
check
gsheasby Feb 17, 2022
7dbd4e6
Add generated changelog entries
svc-changelog Feb 17, 2022
c26ac47
Autorelease 0.546.0-rc1
gsheasby Feb 21, 2022
61edb8b
getIgnoringDisabled should not add to cache
gsheasby Feb 21, 2022
0aca074
more fixes
gsheasby Feb 21, 2022
3167013
Add generated changelog entries
svc-changelog Feb 21, 2022
98f11df
avoid race condition
gsheasby Feb 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.palantir.logsafe.logger.SafeLoggerFactory;
import com.palantir.paxos.Client;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
Expand Down Expand Up @@ -79,7 +80,7 @@ public TimeLockServices get(String namespace) {
}

public TimeLockServices getIgnoringDisabled(String namespace) {
return services.computeIfAbsent(namespace, ns -> createNewClient(ns, true));
return Optional.ofNullable(services.get(namespace)).orElseGet(() -> createNewClient(namespace, true));
Copy link
Contributor

Choose a reason for hiding this comment

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

This solves the correctness issue, but it potentially creates a client on every call and closes any of them. One way to fix it is just to have a separate ConcurrentMap for the ignoring services and not reuse the existing normal services.
Alternatively, and maybe better, we can keep the previous behaviour where an explicit disable still kills the existing service (because it does all the locks etc cleanup for us) and let the ignoring version create a new one but make sure that a get does a precondition check to verify it's not disabled after calling services.computeIfAbsent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah interesting - yeah, that would work. So we'd create a new service the first time we call getIgnoringDisabled, then future get calls with throw until the service is re-enabled.

}

public Set<Client> getActiveClients() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ public void cannotCreateServiceForDisabledNamespace() {
assertThatThrownBy(() -> namespaces.get(CLIENT_A)).isInstanceOf(SafeIllegalArgumentException.class);
}

@Test
public void canGetIgnoringDisabledWithoutFillingCache() {
when(disabledNamespaces.isEnabled(Namespace.of(CLIENT_A))).thenReturn(false);

TimeLockServices servicesIgnoringDisabled = namespaces.getIgnoringDisabled(CLIENT_A);
assertThat(servicesIgnoringDisabled).isEqualTo(servicesA);

assertThatThrownBy(() -> namespaces.get(CLIENT_A)).isInstanceOf(SafeIllegalArgumentException.class);
}

@Test
public void doesNotCreateNewClientsAfterMaximumNumberHasBeenReached() {
createMaximumNumberOfClients();
Expand Down