java.lang.Object
com.gpudb.BulkInserter<T>
Type Parameters:
T - the type of object being insertedAll Implemented Interfaces:
Object that manages the insertion into GPUdb of large numbers of records in bulk, with automatic batch management and support for multi-head ingest.
BulkInserter instances are thread safe and may be used from any number of threads simultaneously. Use the insert(Object) and insert(List) methods to queue records for insertion, and the flush() method to ensure that all queued records have been inserted.Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis class facilitates customizing the behavior of automatic flush inBulkInserterThe default value of the ‘flushInterval’ is set to a negative value to indicate that the automatic flush feature is not needed.static final classAn exception that occurred during the insertion of records into GPUdb.static final classDeprecated, for removal: This API element is subject to removal in a future version.Constructor Summary
ConstructorsConstructorDescriptionBulkInserter(GPUdb gpudb, String tableName, int batchSize) Creates a JSONBulkInserterwith the specified parameters.Creates a JSONBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers) Creates a JSONBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) Creates a JSONBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) Creates a JSONBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) Creates a JSONBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize) Creates aBulkInserterwith the specified parameters.Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) Creates aBulkInserterwith the specified parameters.BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) Creates aBulkInserterwith the specified parameters.Method Summary
Modifier and TypeMethodDescriptionvoidclose()ClosesBulkInserterresources: Performs a final flush of any data yet to be ingested Terminates the timed flush mechanism, if needed Terminates the ingest executor service
This method will be called automatically if theBulkInserterclass is used in a try-with-resources block.voidflush()Ensures that any queued records are inserted into GPUdb.intGets the batch size (the number of records to insert into GPUdb at a time).longGets the number of records inserted into GPUdb.longGets the number of records updated (instead of inserted) in GPUdb due to primary key conflicts.Gets the list of errors received since the last call to getErrors().getGPUdb()Gets the GPUdb instance into which records will be inserted.Retrieves options governing JSON ingest.intGets the number of times inserts into GPUdb will be retried in the event of an error.Gets the optional parameters that will be passed to GPUdb while inserting.intDeprecated, for removal: This API element is subject to removal in a future version.Gets the name of the table into which records will be inserted.Retrieves options governing the timed flush ingest scheme.Gets the list of warnings received since the last call to getWarnings().voidQueues a list of records for insertion into GPUdb.voidQueues a record for insertion into GPUdb.booleanvoidsetJsonOptions(GPUdbBase.JsonOptions jsonOptions) This method could be used to setGPUdbBase.JsonOptionsin case the user wants to modify the defaults.voidsetMaxRetries(int value) Sets the number of times inserts into GPUdb will be retried in the event of an error.voidsetRetryCount(int value) Deprecated, for removal: This API element is subject to removal in a future version.voidsetTimedFlushOptions(BulkInserter.FlushOptions flushOptions) This method could potentially result in two different scenarios It could start a timed flush thread if it was not already active when the BulkInserter was created.
Constructor Details
BulkInserter
Creates a JSONBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.
It will also use default settings for theGPUdb.insertRecords(String, List, Map)call. Details can be found atInsertRecordsRequest.Options.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workerThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options) throws GPUdbException Creates a JSONBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers) throws GPUdbException Creates a JSONBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) throws GPUdbException Creates a JSONBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates a JSONBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates a JSONBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intobatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
Creates aBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.
It will also use default settings for theGPUdb.insertRecords(String, List, Map)call. Details can be found atInsertRecordsRequest.Options.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workerThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options) throws GPUdbException Creates aBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, Type type, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotype- theTypeof records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize) throws GPUdbException Creates aBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.
It will also use default settings for theGPUdb.insertRecords(String, List, Map)call. Details can be found atInsertRecordsRequest.Options.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workerThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options) throws GPUdbException Creates aBulkInserterwith the specified parameters.
This constructor will attempt to automatically configure multi-head ingest, if available.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.Throws:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:BulkInserter
public BulkInserter(GPUdb gpudb, String tableName, TypeObjectMap<T> typeObjectMap, int batchSize, Map<String, String> options, WorkerList workers, BulkInserter.FlushOptions flushOptions, GPUdbBase.JsonOptions jsonOptions) throws GPUdbException Creates aBulkInserterwith the specified parameters.Parameters:gpudb- theGPUdbinstance to insert records intotableName- name of the table to insert records intotypeObjectMap- theTypeObjectMapfor the type of records being insertedbatchSize- the number of records to insert into GPUdb at a time (records will queue until this number is reached); for multi-head ingest, this value is per workeroptions- optional parameters to pass to GPUdb while inserting (nullfor no parameters)
This is the same set of options as accepted by theGPUdb.insertRecords(String, List, Map)call.
The details can be found atInsertRecordsRequest.Options.workers- worker list for multi-head ingest; use an empty worker list (new WorkerList()) to disable multi-headflushOptions-BulkInserter.FlushOptionsto use for timed flush operationjsonOptions-GPUdbBase.JsonOptionsto use for JSON ingestThrows:GPUdbException- if a configuration error occursIllegalArgumentException- if an invalid parameter is specifiedSee Also:
Method Details
getTimedFlushOptions
Retrieves options governing the timed flush ingest scheme.Returns:the timed flush options as aBulkInserter.FlushOptionsinstancegetJsonOptions
Retrieves options governing JSON ingest.Returns:the JSON ingest options as aGPUdbBase.JsonOptionsinstancesetTimedFlushOptions
This method could potentially result in two different scenarios- It could start a timed flush thread if it was not already active when the BulkInserter was created.
- If the timed flush thread was already active then setting this to a new value will first terminate the existing thread; set the options to the new value and finally restart a new thread with the options passed in. This case could result in a delay since the thread needs to be cleaned up and restarted.
Parameters:flushOptions-BulkInserter.FlushOptionsto use for timed flush operationThrows:GPUdbException- in case an invalid timeout values is set in theflushOptionsparameter.setJsonOptions
This method could be used to setGPUdbBase.JsonOptionsin case the user wants to modify the defaults.close
ClosesBulkInserterresources:- Performs a final flush of any data yet to be ingested
- Terminates the timed flush mechanism, if needed
- Terminates the ingest executor service
This method will be called automatically if theBulkInserterclass is used in a try-with-resources block. If not used that way it is mandatory to call this method to initiate a smooth cleanup of the underlying resources.try( BulkInserter inserter = new BulkInserter(…) )
or
// Do something with the BulkInserter instance
// inserter.some_method
// Here the close method of the BulkInserter class will be called
// automatically
BulkInserter inserter = new BulkInserter<>(…)
// Invoke some methods on the inserter
//Explicitly call close() method
inserter.close();
Specified by:closein interfaceAutoCloseableThrows:BulkInserter.InsertException- - While doing the final flushgetBatchSize
public int getBatchSize()Gets the batch size (the number of records to insert into GPUdb at a time). For multi-head ingest this value is per worker.Returns:the batch sizeisMultiHeadEnabled
public boolean isMultiHeadEnabled()getMaxRetries
public int getMaxRetries()Gets the number of times inserts into GPUdb will be retried in the event of an error. After this many retries,BulkInserter.InsertExceptionwill be thrown.Returns:the number of retriesSee Also:setMaxRetries
public void setMaxRetries(int value) Sets the number of times inserts into GPUdb will be retried in the event of an error. After this many retries,BulkInserter.InsertExceptionwill be thrown.Parameters:value- the number of retriesThrows:IllegalArgumentException- ifvalueis less than zeroSee Also:getRetryCount
Deprecated, for removal: This API element is subject to removal in a future version.Gets the number of times inserts into GPUdb will be retried in the event of an error. After this many retries,BulkInserter.InsertExceptionwill be thrown.Returns:the number of retriesSee Also:setRetryCount
Deprecated, for removal: This API element is subject to removal in a future version.Sets the number of times inserts into GPUdb will be retried in the event of an error. After this many retries,BulkInserter.InsertExceptionwill be thrown.Parameters:value- the number of retriesThrows:IllegalArgumentException- ifvalueis less than zeroSee Also:getCountInserted
public long getCountInserted()Gets the number of records inserted into GPUdb. Excludes records that are currently queued but not yet inserted and records not inserted due to primary key conflicts.Returns:the number of records insertedgetCountUpdated
public long getCountUpdated()Gets the number of records updated (instead of inserted) in GPUdb due to primary key conflicts.Returns:the number of records updatedgetErrors
Gets the list of errors received since the last call to getErrors().Returns:list of InsertException objectsgetWarnings
Gets the list of warnings received since the last call to getWarnings().Returns:list of InsertException objectsflush
Ensures that any queued records are inserted into GPUdb. If an error occurs while inserting the records from any queue, the records will no longer be in that queue nor in GPUdb; catchBulkInserter.InsertExceptionto get the list of records that were being inserted if needed (for example, to retry). Other queues may also still contain unflushed records if this occurs.Throws:BulkInserter.InsertException- if an error occurs while insertinginsert
Queues a record for insertion into GPUdb. If the queue reaches thebatch size, all records in the queue will be inserted into GPUdb before the method returns. If an error occurs while inserting the records, the records will no longer be in the queue nor in GPUdb; catchBulkInserter.InsertExceptionto get the list of records that were being inserted if needed (for example, to retry). Note: This version ofinsert(Object)will result in sequential batch inserts in a background thread. Useinsert(List)to allow multiple queues to reach their batch size and parallelize all of those batch inserts at once.Parameters:record- the record to insertThrows:GPUdbException- if an error occurs while calculating shard/primary keysBulkInserter.InsertException- if an error occurs while insertinginsert
Queues a list of records for insertion into GPUdb. If any queue reaches thebatch size, all queues that have reached thebatch sizewill have their records inserted into the database before the method returns. If an error occurs while inserting the records, they will no longer be in that queue or the database; catchBulkInserter.InsertExceptionto get the list of records that were being inserted (including any from the queue in question and any remaining in the list not yet queued) if needed (for example, to retry). Note that depending on the number of records, multiple calls to the database may occur. Note: This version ofinsert(List)will result in parallelizing the batch inserts in background threads.Parameters:records- the records to insertThrows:BulkInserter.InsertException- if an error occurs while inserting
com.gpudb.WorkerList.