diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/PartitionAwareSourceTable.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/PartitionAwareSourceTable.java index 44132aa1a49..9d9d6f87526 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/PartitionAwareSourceTable.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/PartitionAwareSourceTable.java @@ -205,7 +205,6 @@ protected final Table redefine(TableDefinition newDefinitionExternal, TableDefin reference, null, viewColumns, null); } - private static final String LOCATION_KEY_COLUMN_NAME = "__PartitionAwareSourceTable_TableLocationKey__"; private static final String TRACKED_KEY_COLUMN_NAME = "__PartitionAwareSourceTable_TrackedTableLocationKey__"; private static ColumnSource makePartitionSource(@NotNull final ColumnDefinition columnDefinition, @@ -236,15 +235,13 @@ protected final Collection filterLocationKeys( // TODO (https://github.com/deephaven/deephaven-core/issues/867): Refactor around a ticking partition table final List partitionTableColumnNames = Stream.concat( partitioningColumnDefinitions.keySet().stream(), - Stream.of(LOCATION_KEY_COLUMN_NAME, TRACKED_KEY_COLUMN_NAME)).collect(Collectors.toList()); + Stream.of(TRACKED_KEY_COLUMN_NAME)).collect(Collectors.toList()); final List> partitionTableColumnSources = new ArrayList<>(partitioningColumnDefinitions.size() + 1); for (final ColumnDefinition columnDefinition : partitioningColumnDefinitions.values()) { partitionTableColumnSources.add(makePartitionSource(columnDefinition, immutableTableLocationKeys)); } - // Add the tracked and immutable keys to the table - partitionTableColumnSources.add(ArrayBackedColumnSource.getMemoryColumnSource(immutableTableLocationKeys, - ImmutableTableLocationKey.class, null)); + // Add the tracked keys to the table partitionTableColumnSources.add(ArrayBackedColumnSource.getMemoryColumnSource(foundLocationKeys, TrackedTableLocationKey.class, null)); @@ -255,7 +252,7 @@ protected final Collection filterLocationKeys( return foundLocationKeys; } - // Return the filtered tracked location keys + // Return the filtered keys final Iterable iterable = () -> filteredColumnPartitionTable.columnIterator(TRACKED_KEY_COLUMN_NAME); return StreamSupport.stream(iterable.spliterator(), false).collect(Collectors.toList()); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/SourceTable.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/SourceTable.java index b41ccaeba49..fa74ccce349 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/SourceTable.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/SourceTable.java @@ -163,12 +163,7 @@ private void maybeAddLocations(@NotNull final Collection { - // Unconditionally manage all locations added to the column source manager - final TableLocation tableLocation = locationProvider.getTableLocation(lk.getKey()); - columnSourceManager.manage(tableLocation); - columnSourceManager.addLocation(tableLocation); - }); + .forEach(lk -> columnSourceManager.addLocation(locationProvider.getTableLocation(lk.getKey()))); } private TrackedTableLocationKey[] maybeRemoveLocations( diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableLocationProvider.java index 45b337e136c..4dc7f444636 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableLocationProvider.java @@ -125,6 +125,7 @@ protected void destroy() { AbstractTableLocationProvider.this.destroy(); } }; + // TODO: understand why this seems to be needed LivenessScopeStack.peek().manage(livenessNode); } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java index 2d9229422be..e7c1bde1284 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java @@ -26,7 +26,7 @@ public final class SingleTableLocationProvider implements TableLocationProvider public SingleTableLocationProvider(@NotNull final TableLocation tableLocation) { this.tableLocation = tableLocation; trackedTableLocationKey = new TrackedTableLocationKey(tableLocation.getKey(), ttlk -> { - // no-op + // TODO: I don't think we need to do anything here, but need to think more about it }); } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/regioned/RegionedColumnSourceManager.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/regioned/RegionedColumnSourceManager.java index a39291e322d..b22eeff9786 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/regioned/RegionedColumnSourceManager.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sources/regioned/RegionedColumnSourceManager.java @@ -230,6 +230,8 @@ public synchronized void addLocation(@NotNull final TableLocation tableLocation) if (log.isDebugEnabled()) { log.debug().append("LOCATION_ADDED:").append(tableLocation.toString()).endl(); } + // Hold on to this table location. + manage(tableLocation); emptyTableLocations.add(new EmptyTableLocationEntry(tableLocation)); } else { // Duplicate location - not allowed