Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't close long-lived RowSets in Downsampler BucketState #5478

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -9,6 +9,8 @@
import io.deephaven.engine.rowset.RowSetFactory;
import io.deephaven.engine.rowset.impl.RowSetUtils;
import io.deephaven.engine.rowset.chunkattributes.OrderedRowKeys;
import io.deephaven.internal.log.LoggerFactory;
import io.deephaven.io.logger.Logger;
import io.deephaven.util.QueryConstants;
import io.deephaven.chunk.Chunk;
import io.deephaven.chunk.LongChunk;
Expand All @@ -26,6 +28,8 @@
* its own offset in those arrays.
*/
public class BucketState {
private static final Logger log = LoggerFactory.getLogger(BucketState.class);

private final WritableRowSet rowSet = RowSetFactory.empty();

private RowSet cachedRowSet;
Expand Down Expand Up @@ -310,22 +314,16 @@ public void validate(final boolean usePrev, final DownsampleChunkContext context
values[columnIndex].validate(offset, keyChunk.get(indexInChunk), valueChunks[columnIndex],
indexInChunk, trackNulls ? nulls[columnIndex] : null);
} catch (final RuntimeException e) {
System.out.println(rowSet);
final String msg =
"Bad data! indexInChunk=" + indexInChunk + ", col=" + columnIndex + ", usePrev="
+ usePrev + ", offset=" + offset + ", rowSet=" + keyChunk.get(indexInChunk);
+ usePrev + ", offset=" + offset + ", indexInChunk="
+ keyChunk.get(indexInChunk);
log.error().append(msg).append(", rowSet=").append(rowSet).endl();
throw new IllegalStateException(msg, e);
}
}
}
}
Assert.eqTrue(makeRowSet().subsetOf(rowSet), "makeRowSet().subsetOf(rowSet)");
}

public void close() {
rcaudy marked this conversation as resolved.
Show resolved Hide resolved
if (cachedRowSet != null) {
cachedRowSet.close();
}
rowSet.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,6 @@ private DownsamplerListener(
allYColumnIndexes = IntStream.range(0, key.yColumnNames.length).toArray();
}

@Override
protected void destroy() {
super.destroy();
states.values().forEach(BucketState::close);
}

@Override
public void onUpdate(final TableUpdate upstream) {
try (final DownsampleChunkContext context =
Expand Down Expand Up @@ -684,7 +678,6 @@ private void performRescans(final DownsampleChunkContext context) {
// if it has no keys at all, remove it so we quit checking it
iterator.remove();
releasePosition(bucket.getOffset());
bucket.close();
} else {
bucket.rescanIfNeeded(context);
}
Expand Down
Loading