Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
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 @@ -34,9 +34,7 @@
import com.google.protobuf.Descriptors.DescriptorValidationException;
import com.google.protobuf.Timestamp;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;
import org.json.JSONArray;
Expand Down Expand Up @@ -777,13 +775,13 @@ public void testMultiThreadAppendNoSchemaUpdate() throws Exception {
final JSONArray jsonArr = new JSONArray();
jsonArr.put(foo);

final HashSet<Long> offset_sets = new HashSet<Long>();
final Collection<Long> offsetSets = Collections.synchronizedCollection(new HashSet<Long>());
int thread_nums = 5;
Thread[] thread_arr = new Thread[thread_nums];
for (int i = 0; i < thread_nums; i++) {
testBigQueryWrite.addResponse(
Storage.AppendRowsResponse.newBuilder().setOffset((long) i).build());
offset_sets.add((long) i);
offsetSets.add((long) i);
Thread t =
new Thread(
new Runnable() {
Expand All @@ -792,7 +790,7 @@ public void run() {
ApiFuture<AppendRowsResponse> appendFuture =
writer.append(jsonArr, -1, /* allowUnknownFields */ false);
AppendRowsResponse response = appendFuture.get();
offset_sets.remove(response.getOffset());
offsetSets.remove(response.getOffset());
} catch (Exception e) {
LOG.severe("Thread execution failed: " + e.getMessage());
}
Expand All @@ -805,7 +803,7 @@ public void run() {
for (int i = 0; i < thread_nums; i++) {
thread_arr[i].join();
}
assertTrue(offset_sets.size() == 0);
assertTrue(offsetSets.size() == 0);
for (int i = 0; i < thread_nums; i++) {
assertEquals(
1,
Expand Down Expand Up @@ -842,7 +840,7 @@ public void testMultiThreadAppendWithSchemaUpdate() throws Exception {
final JSONArray jsonArr = new JSONArray();
jsonArr.put(foo);

final HashSet<Long> offsetSets = new HashSet<Long>();
final Collection<Long> offsetSets = Collections.synchronizedCollection(new HashSet<Long>());
int numberThreads = 5;
Thread[] thread_arr = new Thread[numberThreads];
for (int i = 0; i < numberThreads; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
import com.google.protobuf.Descriptors.DescriptorValidationException;
import com.google.protobuf.Timestamp;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;
import org.json.JSONArray;
Expand Down Expand Up @@ -775,12 +773,12 @@ public void testMultiThreadAppendNoSchemaUpdate() throws Exception {
final JSONArray jsonArr = new JSONArray();
jsonArr.put(foo);

final HashSet<Long> offset_sets = new HashSet<Long>();
final Collection<Long> offsetSets = Collections.synchronizedCollection(new HashSet<Long>());
int thread_nums = 5;
Thread[] thread_arr = new Thread[thread_nums];
for (int i = 0; i < thread_nums; i++) {
testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().setOffset((long) i).build());
offset_sets.add((long) i);
offsetSets.add((long) i);
Thread t =
new Thread(
new Runnable() {
Expand All @@ -789,7 +787,7 @@ public void run() {
ApiFuture<AppendRowsResponse> appendFuture =
writer.append(jsonArr, -1, /* allowUnknownFields */ false);
AppendRowsResponse response = appendFuture.get();
offset_sets.remove(response.getOffset());
offsetSets.remove(response.getOffset());
} catch (Exception e) {
LOG.severe("Thread execution failed: " + e.getMessage());
}
Expand All @@ -802,7 +800,7 @@ public void run() {
for (int i = 0; i < thread_nums; i++) {
thread_arr[i].join();
}
assertTrue(offset_sets.size() == 0);
assertTrue(offsetSets.size() == 0);
for (int i = 0; i < thread_nums; i++) {
assertEquals(
1,
Expand Down Expand Up @@ -839,7 +837,7 @@ public void testMultiThreadAppendWithSchemaUpdate() throws Exception {
final JSONArray jsonArr = new JSONArray();
jsonArr.put(foo);

final HashSet<Long> offsetSets = new HashSet<Long>();
final Collection<Long> offsetSets = Collections.synchronizedCollection(new HashSet<Long>());
int numberThreads = 5;
Thread[] thread_arr = new Thread[numberThreads];
for (int i = 0; i < numberThreads; i++) {
Expand Down