Java-client-lib-2.1.0 for influxdb-v2 .0.4 failed deleting measurement

I can’t remove measurement with java client v2 and can do it with client v1.
This measurement contains 1 year of daily candlesticks for ~10K stocks (~300M data).
My code


OkHttpClient.Builder builder = new OkHttpClient.Builder().readTimeout(45, TimeUnit.SECONDS)
.writeTimeout(45, TimeUnit.SECONDS).connectTimeout(45, TimeUnit.SECONDS);

public void dropMeasurement(String bucketName, String measurement, String org)
{
	DeleteApi deleteApi = influxDBClient.getDeleteApi();
	OffsetDateTime start = OffsetDateTime.now().minus(366, ChronoUnit.DAYS);
	OffsetDateTime stop = OffsetDateTime.now();
	DeletePredicateRequest pr = new DeletePredicateRequest();
	pr.start(start);
	pr.stop(stop);
	String prd = "\"_measurement\"=\"" + measurement + "\"";
	pr.predicate(prd);
	System.out.println("remove: " + prd);
	try
	{
		deleteApi.delete(pr, bucketName, org);
	} catch (InfluxException ie)
	{
		System.out.println("InfluxException => " + ie);
	}
	System.out.println("done");
}

output:
remove: “_measurement”=“historyday”

Apr 26, 2021 10:05:30 PM okhttp3.internal.platform.Platform log
INFO: ← HTTP FAILED: java.net.SocketTimeoutException: timeout
InfluxException => com.influxdb.exceptions.InfluxException: timeout
done

Client for influxdb-v1.8 does it, no problems.
Please give your thoughts.
Thank you
Mit

Hi @mitalpha,

the java.net.SocketTimeoutException: timeout exception is from a server side. Please try to increase timeout:

OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder()
        .readTimeout(1, TimeUnit.MINUTES)
        .writeTimeout(1, TimeUnit.MINUTES)
        .connectTimeout(1, TimeUnit.MINUTES);

InfluxDBClientOptions options = InfluxDBClientOptions
        .builder()
        .url("http://localhost:8086")
        .authenticateToken("my-token".toCharArray())
        .okHttpClient(okHttpClient)
        .build();

InfluxDBClient client = InfluxDBClientFactory.create(options);

Regards

Changed timeout value to 1800, result is the same.
OkHttpClient.Builder builder = new OkHttpClient.Builder().readTimeout(1800, TimeUnit.SECONDS).writeTimeout(1800, TimeUnit.SECONDS).connectTimeout(1800, TimeUnit.SECONDS);
For several candlesticks it works, but for large size of measurements doesn’t.
It seems like on server side thread pool is chocking…
With v.1.8 removing the same size of measurement takes ~15-20sec.
Thank you for response