Forum: Building VoltDB Applications

Post: A serious problem about VoltBulkLoader flush and drain

A serious problem about VoltBulkLoader flush and drain
simon0806
May 14, 2017
My test code is as folow, when I use flush in my case, I data cannot be flush to voltdb table, but when I use drain it works. I see the API doc, it's said that flush is async while drain is sync, so what's the problem of my code ? is it right to use flush like below ?
VoltBulkLoader loader = client.getNewBulkLoader("test", 100, false, null);
int i = 0;
String[] data = new String[10];
while(i < 10) {
data = String.valueOf(i);
i++;
}
for(String dt: data)
{
loader.insertRow(rwmd, dt);
loader.drain(); // work !
loader.flush(); // not work !!, can't get any data in volt table by "select * from test"
}