summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java7
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java23
-rw-r--r--eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp4
-rw-r--r--fastlib/src/vespa/fastlib/testsuite/suite.h6
-rw-r--r--fastlib/src/vespa/fastlib/testsuite/test.cpp4
-rw-r--r--fastlib/src/vespa/fastlib/testsuite/test.h6
-rw-r--r--searchlib/src/tests/query/streaming_query_large_test.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h1
-rw-r--r--vespalib/src/tests/exception_classes/silenceuncaught_test.cpp8
-rw-r--r--vespalib/src/vespa/vespalib/stllike/allocator.h2
12 files changed, 64 insertions, 10 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index bcdb2618bda..490ab988048 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -684,8 +684,11 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
sessionsPerTenant.values().forEach(sessionList -> sessionList.forEach(s -> applicationIds.add(s.getApplicationId())));
Map<ApplicationId, Long> activeSessions = new HashMap<>();
- applicationIds.forEach(applicationId -> activeSessions.put(applicationId, getActiveSession(applicationId).getSessionId()));
-
+ applicationIds.forEach(applicationId -> {
+ RemoteSession activeSession = getActiveSession(applicationId);
+ if (activeSession != null)
+ activeSessions.put(applicationId, activeSession.getSessionId());
+ });
sessionsPerTenant.keySet().forEach(tenant -> tenant.getLocalSessionRepo().deleteExpiredSessions(activeSessions));
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java
index f9b851fe197..d276a59327d 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/LocalSessionRepo.java
@@ -120,7 +120,7 @@ public class LocalSessionRepo extends SessionRepo<LocalSession> {
return candidate.getStatus() == Session.Status.ACTIVATE;
}
- void deleteSession(LocalSession session) {
+ public void deleteSession(LocalSession session) {
long sessionId = session.getSessionId();
log.log(Level.FINE, "Deleting local session " + sessionId);
LocalSessionStateWatcher watcher = sessionStateWatchers.remove(sessionId);
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
index 4d0253cd3f8..e977284e06c 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
@@ -21,12 +21,14 @@ import com.yahoo.io.IOUtils;
import com.yahoo.jdisc.Metric;
import com.yahoo.test.ManualClock;
import com.yahoo.text.Utf8;
+import com.yahoo.transaction.NestedTransaction;
import com.yahoo.vespa.config.server.application.OrchestratorMock;
import com.yahoo.vespa.config.server.deploy.DeployTester;
import com.yahoo.vespa.config.server.http.InternalServerException;
import com.yahoo.vespa.config.server.http.SessionHandlerTest;
import com.yahoo.vespa.config.server.http.v2.PrepareResult;
import com.yahoo.vespa.config.server.session.LocalSession;
+import com.yahoo.vespa.config.server.session.LocalSessionRepo;
import com.yahoo.vespa.config.server.session.PrepareParams;
import com.yahoo.vespa.config.server.session.RemoteSession;
import com.yahoo.vespa.config.server.session.SilentDeployLogger;
@@ -331,18 +333,33 @@ public class ApplicationRepositoryTest {
assertNotEquals(activeSessionId, deployment3session);
// No change to active session id
assertEquals(activeSessionId, tester.tenant().getApplicationRepo().requireActiveSessionOf(tester.applicationId()));
- assertEquals(3, tester.tenant().getLocalSessionRepo().listSessions().size());
+ LocalSessionRepo localSessionRepo = tester.tenant().getLocalSessionRepo();
+ assertEquals(3, localSessionRepo.listSessions().size());
clock.advance(Duration.ofHours(1)); // longer than session lifetime
// All sessions except 3 should be removed after the call to deleteExpiredLocalSessions
tester.applicationRepository().deleteExpiredLocalSessions();
- Collection<LocalSession> sessions = tester.tenant().getLocalSessionRepo().listSessions();
+ Collection<LocalSession> sessions = localSessionRepo.listSessions();
assertEquals(1, sessions.size());
- assertEquals(3, new ArrayList<>(sessions).get(0).getSessionId());
+ ArrayList<LocalSession> localSessions = new ArrayList<>(sessions);
+ LocalSession localSession = localSessions.get(0);
+ assertEquals(3, localSession.getSessionId());
// There should be no expired remote sessions in the common case
assertEquals(0, tester.applicationRepository().deleteExpiredRemoteSessions(clock, Duration.ofSeconds(0)));
+
+ // Deploy, but do not activate
+ Optional<com.yahoo.config.provision.Deployment> deployment4 = tester.redeployFromLocalActive();
+ assertTrue(deployment4.isPresent());
+ deployment4.get().prepare(); // session 5 (not activated)
+
+ assertEquals(2, localSessionRepo.listSessions().size());
+ localSessionRepo.deleteSession(localSession);
+ assertEquals(1, localSessionRepo.listSessions().size());
+
+ // Check that trying to expire when there are no active sessions works
+ tester.applicationRepository().deleteExpiredLocalSessions();
}
@Test
diff --git a/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp b/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp
index cac8af2bdce..b0927fd7e90 100644
--- a/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp
+++ b/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp
@@ -22,6 +22,8 @@ using vespalib::make_string_short::fmt;
using Primary = DenseSimpleJoinFunction::Primary;
using Overlap = DenseSimpleJoinFunction::Overlap;
+namespace vespalib::tensor {
+
std::ostream &operator<<(std::ostream &os, Primary primary)
{
switch(primary) {
@@ -41,6 +43,8 @@ std::ostream &operator<<(std::ostream &os, Overlap overlap)
abort();
}
+}
+
const TensorEngine &prod_engine = DefaultTensorEngine::ref();
EvalFixture::ParamRepo make_params() {
diff --git a/fastlib/src/vespa/fastlib/testsuite/suite.h b/fastlib/src/vespa/fastlib/testsuite/suite.h
index 94e756387bf..ee8775518a2 100644
--- a/fastlib/src/vespa/fastlib/testsuite/suite.h
+++ b/fastlib/src/vespa/fastlib/testsuite/suite.h
@@ -68,6 +68,8 @@
#include <cassert>
+namespace fast::testsuite {
+
class TestSuiteError;
class Suite
@@ -258,3 +260,7 @@ void Suite::Reset()
m_tests[i]->Reset();
}
}
+
+}
+
+using fast::testsuite::Suite;
diff --git a/fastlib/src/vespa/fastlib/testsuite/test.cpp b/fastlib/src/vespa/fastlib/testsuite/test.cpp
index d7541d163e7..a29e5053c98 100644
--- a/fastlib/src/vespa/fastlib/testsuite/test.cpp
+++ b/fastlib/src/vespa/fastlib/testsuite/test.cpp
@@ -2,6 +2,8 @@
#include "test.h"
+namespace fast::testsuite {
+
Test::Test(std::ostream* osptr, const char*name) :
m_osptr(osptr),
name_(name),
@@ -135,3 +137,5 @@ long Test::Report(int padSpaces) const
}
return m_nFail;
}
+
+}
diff --git a/fastlib/src/vespa/fastlib/testsuite/test.h b/fastlib/src/vespa/fastlib/testsuite/test.h
index ea17e64dba2..96f38c1577b 100644
--- a/fastlib/src/vespa/fastlib/testsuite/test.h
+++ b/fastlib/src/vespa/fastlib/testsuite/test.h
@@ -73,6 +73,8 @@
do_equality_test((lhs), (rhs), #lhs, __FILE__, __LINE__)
#define _fail(str) do_fail((str), __FILE__, __LINE__)
+namespace fast::testsuite {
+
class Test
{
public:
@@ -143,3 +145,7 @@ bool Test::do_equality_test(const t1& lhs, const t2& rhs, const char* lbl,
}
return false;
}
+
+}
+
+using fast::testsuite::Test;
diff --git a/searchlib/src/tests/query/streaming_query_large_test.cpp b/searchlib/src/tests/query/streaming_query_large_test.cpp
index a76ec54098e..28401e9d685 100644
--- a/searchlib/src/tests/query/streaming_query_large_test.cpp
+++ b/searchlib/src/tests/query/streaming_query_large_test.cpp
@@ -10,6 +10,14 @@ using namespace search;
using namespace search::query;
using namespace search::streaming;
+#ifndef __SANITIZE_ADDRESS__
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+#define __SANITIZE_ADDRESS__
+#endif
+#endif
+#endif
+
namespace {
void setMaxStackSize(rlim_t maxStackSize)
diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp
index 135902116c0..033124e86bb 100644
--- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp
+++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.cpp
@@ -14,8 +14,7 @@ namespace search::features::fieldmatch {
ComputerSharedState::ComputerSharedState(const vespalib::string& propertyNamespace, const PhraseSplitterQueryEnv& splitter_query_env,
const FieldInfo& fieldInfo, const Params& params)
- : _splitter_query_env(splitter_query_env),
- _field_id(fieldInfo.id()),
+ : _field_id(fieldInfo.id()),
_params(params),
_use_cached_hits(true),
_query_terms(),
diff --git a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h
index 8de5914422d..e6b46f0add9 100644
--- a/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h
+++ b/searchlib/src/vespa/searchlib/features/fieldmatch/computer_shared_state.h
@@ -37,7 +37,6 @@ public:
private:
// per query
- const search::fef::PhraseSplitterQueryEnv& _splitter_query_env;
uint32_t _field_id;
Params _params;
bool _use_cached_hits;
diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
index a57dd917ce0..8d81d9e0821 100644
--- a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
+++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp
@@ -5,6 +5,14 @@
using namespace vespalib;
+#ifndef __SANITIZE_ADDRESS__
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+#define __SANITIZE_ADDRESS__
+#endif
+#endif
+#endif
+
TEST("that uncaught exception causes negative exitcode.") {
SlaveProc proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught");
proc.wait();
diff --git a/vespalib/src/vespa/vespalib/stllike/allocator.h b/vespalib/src/vespa/vespalib/stllike/allocator.h
index 3d8c2f03154..efe885f5c96 100644
--- a/vespalib/src/vespa/vespalib/stllike/allocator.h
+++ b/vespalib/src/vespa/vespalib/stllike/allocator.h
@@ -23,7 +23,7 @@ public:
void deallocate(T * p, std::size_t n) {
_allocator->free(p, n*sizeof(T));
}
- alloc::MemoryAllocator * allocator() const { return _allocator; }
+ const alloc::MemoryAllocator * allocator() const { return _allocator; }
private:
const alloc::MemoryAllocator * _allocator;
};