Package org.apache.accumulo.core.client
Class BatchWriterConfig
java.lang.Object
org.apache.accumulo.core.client.BatchWriterConfig
- All Implemented Interfaces:
org.apache.hadoop.io.Writable
This object holds configuration settings used to instantiate a
BatchWriter
- Since:
- 1.5.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
long
getMaxLatency
(TimeUnit timeUnit) long
int
long
getTimeout
(TimeUnit timeUnit) int
hashCode()
void
readFields
(DataInput in) setDurability
(Durability durability) Change the durability for the BatchWriter session.setMaxLatency
(long maxLatency, TimeUnit timeUnit) Sets the maximum amount of time to hold the data in memory before flushing it to servers.
For no maximum, set to zero, orLong.MAX_VALUE
withTimeUnit.MILLISECONDS
.setMaxMemory
(long maxMemory) Sets the maximum memory to batch before writing.setMaxWriteThreads
(int maxWriteThreads) Sets the maximum number of threads to use for writing data to the tablet servers.setTimeout
(long timeout, TimeUnit timeUnit) Sets the maximum amount of time an unresponsive server will be re-tried.toString()
void
write
(DataOutput out)
-
Constructor Details
-
BatchWriterConfig
public BatchWriterConfig()
-
-
Method Details
-
setMaxMemory
Sets the maximum memory to batch before writing. The smaller this value, the more frequently theBatchWriter
will write.
If set to a value smaller than a single mutation, then it willBatchWriter.flush()
after each added mutation. Must be non-negative.Default: 50M
- Parameters:
maxMemory
- max size in bytes- Returns:
this
to allow chaining of set methods- Throws:
IllegalArgumentException
- ifmaxMemory
is less than 0
-
setMaxLatency
Sets the maximum amount of time to hold the data in memory before flushing it to servers.
For no maximum, set to zero, orLong.MAX_VALUE
withTimeUnit.MILLISECONDS
.TimeUnit.MICROSECONDS
orTimeUnit.NANOSECONDS
will be truncated to the nearestTimeUnit.MILLISECONDS
.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of oneTimeUnit.MILLISECONDS
will be used.Default: 120 seconds
- Parameters:
maxLatency
- the maximum latency, in the unit specified by the value oftimeUnit
timeUnit
- determines howmaxLatency
will be interpreted- Returns:
this
to allow chaining of set methods- Throws:
IllegalArgumentException
- ifmaxLatency
is less than 0
-
setTimeout
Sets the maximum amount of time an unresponsive server will be re-tried. When this timeout is exceeded, theBatchWriter
should throw an exception.
For no timeout, set to zero, orLong.MAX_VALUE
withTimeUnit.MILLISECONDS
.TimeUnit.MICROSECONDS
orTimeUnit.NANOSECONDS
will be truncated to the nearestTimeUnit.MILLISECONDS
.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of oneTimeUnit.MILLISECONDS
will be used.Default:
Long.MAX_VALUE
(no timeout)- Parameters:
timeout
- the timeout, in the unit specified by the value oftimeUnit
timeUnit
- determines howtimeout
will be interpreted- Returns:
this
to allow chaining of set methods- Throws:
IllegalArgumentException
- iftimeout
is less than 0
-
setMaxWriteThreads
Sets the maximum number of threads to use for writing data to the tablet servers.Default: 3
- Parameters:
maxWriteThreads
- the maximum threads to use- Returns:
this
to allow chaining of set methods- Throws:
IllegalArgumentException
- ifmaxWriteThreads
is non-positive
-
getMaxMemory
public long getMaxMemory() -
getMaxLatency
-
getTimeout
-
getMaxWriteThreads
public int getMaxWriteThreads() -
getDurability
- Returns:
- the durability to be used by the BatchWriter
- Since:
- 1.7.0
-
setDurability
Change the durability for the BatchWriter session. The default durability is "default" which is the table's durability setting. If the durability is set to something other than the default, it will override the durability setting of the table.- Parameters:
durability
- the Durability to be used by the BatchWriter- Since:
- 1.7.0
-
write
- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Throws:
IOException
-
readFields
- Specified by:
readFields
in interfaceorg.apache.hadoop.io.Writable
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-