aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-06-01 16:52:01 +0200
committerTor Egge <Tor.Egge@online.no>2021-06-01 16:52:01 +0200
commitca5bb8043a1e914a8cd2acc0930ef7338ff74282 (patch)
tree6200644f8a394b7f34da760b9e3650ef620c6868 /searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
parentdda71217f832eda60f88cc0b663d3e7b1021b1a1 (diff)
Reenable tensor attribute compaction test.
Diffstat (limited to 'searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp')
-rw-r--r--searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
index 9621b93fd37..b27c26d1139 100644
--- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
+++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp
@@ -572,12 +572,6 @@ Fixture::testSaveLoad()
void
Fixture::testCompaction()
{
- if ((_traits.use_dense_tensor_attribute && _denseTensors) ||
- ! _traits.use_dense_tensor_attribute)
- {
- LOG(info, "Skipping compaction test for tensor '%s' which is using free-lists", _cfg.tensorType().to_spec().c_str());
- return;
- }
ensureSpace(4);
TensorSpec empty_xy_tensor(sparseSpec);
TensorSpec simple_tensor = TensorSpec(sparseSpec)
@@ -596,11 +590,19 @@ Fixture::testCompaction()
set_tensor(2, fill_tensor);
search::attribute::Status oldStatus = getStatus();
search::attribute::Status newStatus = oldStatus;
- uint64_t iter = 0;
+ auto guard = _attr->makeReadGuard(false);
+ uint64_t iter = 2049;
uint64_t iterLimit = 100000;
for (; iter < iterLimit; ++iter) {
clearTensor(2);
set_tensor(2, fill_tensor);
+ if ((iter & (iter - 1)) == 0) {
+ // Temporarily drop read guard when iter crosses a power of 2.
+ guard.reset();
+ _attr->commit(true);
+ _attr->commit(true);
+ guard = _attr->makeReadGuard(false);
+ }
newStatus = getStatus();
if (newStatus.getUsed() < oldStatus.getUsed()) {
break;
@@ -609,7 +611,7 @@ Fixture::testCompaction()
}
EXPECT_GREATER(iterLimit, iter);
LOG(info,
- "iter = %" PRIu64 ", memory usage %" PRIu64 ", -> %" PRIu64,
+ "iter = %" PRIu64 ", memory usage %" PRIu64 " -> %" PRIu64,
iter, oldStatus.getUsed(), newStatus.getUsed());
TEST_DO(assertGetNoTensor(1));
TEST_DO(assertGetTensor(fill_tensor, 2));