Skip to content
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 @@ -539,7 +539,13 @@ public List<TSDataType> getTsDataTypes() {
}

@Override
public int delete(long lowerBound, long upperBound) {
/*
* Must be synchronized with sort() on the same TVList instance: a query may sort
* this list in place (sort() is synchronized), and a concurrent delete would
* otherwise read the half-rebuilt indices and throw IndexOutOfBoundsException
* or delete wrong rows.
*/
public synchronized int delete(long lowerBound, long upperBound) {
int deletedNumber = 0;
for (int i = 0; i < dataTypes.size(); i++) {
deletedNumber += delete(lowerBound, upperBound, i).left;
Expand All @@ -550,12 +556,17 @@ public int delete(long lowerBound, long upperBound) {
/**
* Delete points in a specific column.
*
* <p>Must be synchronized with {@link #sort()} on the same TVList instance: a query may sort this
* list in place ({@code sort()} is synchronized), and a concurrent delete would otherwise read
* the half-rebuilt {@code indices} and throw IndexOutOfBoundsException or delete wrong rows.
*
* @param lowerBound deletion lower bound
* @param upperBound deletion upper bound
* @param columnIndex column index to be deleted
* @return Delete info pair. Left: deletedNumber int; right: ifDeleteColumn boolean
*/
public Pair<Integer, Boolean> delete(long lowerBound, long upperBound, int columnIndex) {
public synchronized Pair<Integer, Boolean> delete(
long lowerBound, long upperBound, int columnIndex) {
if (columnIndex >= values.size()) {
return new Pair<>(0, false);
}
Expand All @@ -577,7 +588,13 @@ public Pair<Integer, Boolean> delete(long lowerBound, long upperBound, int colum
return new Pair<>(deletedNumber, deleteColumn);
}

public void deleteColumn(int columnIndex) {
/*
* Must be synchronized with sort() on the same TVList instance: a query may sort
* this list in place (sort() is synchronized), and a concurrent delete would
* otherwise read the half-rebuilt indices and throw IndexOutOfBoundsException
* or delete wrong rows.
*/
public synchronized void deleteColumn(int columnIndex) {
if (bitMaps == null) {
List<List<BitMap>> localBitMaps = new ArrayList<>(dataTypes.size());
for (int j = 0; j < dataTypes.size(); j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,13 @@ public TVList clone(long version) {
return clone();
}

public int delete(long lowerBound, long upperBound) {
/*
* Must be synchronized with sort() on the same TVList instance: a query may sort
* this list in place (sort() is synchronized), and a concurrent delete would
* otherwise read the half-rebuilt indices and throw IndexOutOfBoundsException
* or delete wrong rows.
*/
public synchronized int delete(long lowerBound, long upperBound) {
int deletedNumber = 0;
long maxTime = Long.MIN_VALUE;
long minTime = Long.MAX_VALUE;
Expand Down
Loading