Class JdbcBulkLoadProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.odbc.jdbc.JdbcCursor
-
- org.apache.ignite.internal.processors.odbc.jdbc.JdbcBulkLoadProcessor
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class JdbcBulkLoadProcessor extends JdbcCursor
JDBC wrapper aroundBulkLoadProcessorthat provides extra logic. Unlike other "single shot" request-reply commands, the COPY command the client-server interaction looks like this:Thin JDBC client Server | | |------- JdbcQueryExecuteRequest ------>| | with SQL copy command | | | |<---- JdbcBulkLoadAckResult -----------| | with BulkLoadAckClientParameters | | containing file name and batch size. | | | (open the file, | read portions and send them) | | | |------- JdbcBulkLoadBatchRequest #1 -->| | with a portion of input file. | | | |<--- JdbcQueryExecuteResult -----------| | with current update counter. | | | |------- JdbcBulkLoadBatchRequest #2--->| | with a portion of input file. | | | |<--- JdbcQueryExecuteResult -----------| | with current update counter. | | | |------- JdbcBulkLoadBatchRequest #3--->| | with the LAST portion of input file. | | | |<--- JdbcQueryExecuteResult -----------| | with the final update counter. | | | (close the file) | | |In case of input file reading error, a flag is carried to the server:JdbcBulkLoadBatchRequest.CMD_FINISHED_ERRORand the processing is aborted on the both sides.
-
-
Field Summary
Fields Modifier and Type Field Description protected longnextBatchIdxNext batch index (for a very simple check that all batches were delivered to us).
-
Constructor Summary
Constructors Constructor Description JdbcBulkLoadProcessor(BulkLoadProcessor processor, long reqId)Creates a JDBC-specific adapter for bulk load processor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying objects.voidonFail(Exception reason)Gets notified if current bulk load failed.voidprocessBatch(JdbcBulkLoadBatchRequest req)Completely processes a bulk load batch request.longupdateCnt()Provides update counter for sending in theJdbcBatchExecuteResult.-
Methods inherited from class org.apache.ignite.internal.processors.odbc.jdbc.JdbcCursor
cursorId, requestId
-
-
-
-
Constructor Detail
-
JdbcBulkLoadProcessor
public JdbcBulkLoadProcessor(BulkLoadProcessor processor, long reqId)
Creates a JDBC-specific adapter for bulk load processor.- Parameters:
processor- Bulk load processor from the core to delegate calls to.reqId- Id of the request that created given processor.
-
-
Method Detail
-
processBatch
public void processBatch(JdbcBulkLoadBatchRequest req) throws IgniteCheckedException
Completely processes a bulk load batch request. CallsBulkLoadProcessorwrapping around some JDBC-specific logic (commands, bulk load batch index checking).- Parameters:
req- The current request.- Throws:
IgniteCheckedException
-
close
public void close() throws IOExceptionCloses the underlying objects. Currently we don't handle normal termination vs. abort.- Throws:
IOException
-
onFail
public void onFail(Exception reason)
Gets notified if current bulk load failed.- Parameters:
reason- reason why it failed.
-
updateCnt
public long updateCnt()
Provides update counter for sending in theJdbcBatchExecuteResult.- Returns:
- The update counter for sending in
JdbcBatchExecuteResult.
-
-