/** * Little helper to set the table byte array. If it's different than the last * table we reset the byte array. Otherwise we just use the existing array. * @param table The table we're operating against */ private void setTable(final String table) { if (!lastTable.equals(table)) { lastTable = table; BigtableTableName tableName = options .getInstanceName() .toTableName(table); lastTableBytes = tableName .toString() .getBytes(); synchronized(this) { if (bulkMutation != null) { try { bulkMutation.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } } bulkMutation = session.createBulkMutation(tableName); } } }
/** * No credentials - used for unit testing. * * @return a {@link com.google.cloud.bigtable.config.CredentialOptions} object. */ public static CredentialOptions nullCredential() { LOG.info("Enabling the use of null credentials. This should not be used in production."); return new CredentialOptions(CredentialType.None); }
public long getWriteBufferSize() { return this.options.getBulkOptions().getMaxMemory(); }
static SerializableFunction<BigtableOptions.Builder, BigtableOptions.Builder> enableBulkApiConfigurator( final @Nullable SerializableFunction<BigtableOptions.Builder, BigtableOptions.Builder> userConfigurator) { return optionsBuilder -> { if (userConfigurator != null) { optionsBuilder = userConfigurator.apply(optionsBuilder); } return optionsBuilder.setBulkOptions( optionsBuilder.build().getBulkOptions().toBuilder().setUseBulkApi(true).build()); }; }
private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = CallOptionsConfig.builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }
/** {@inheritDoc} */ @Override public void compactRegion(byte[] bytes, byte[] bytes2) throws IOException { LOG.info("compactRegion is a no-op"); }
public static HttpTransportFactory getHttpTransportFactory() { if (httpTransportFactory == null) { httpTransportFactory = new DefaultHttpTransportFactory(); } return httpTransportFactory; }
/** * <p>jsonCredentials.</p> * * @param jsonInputStream a {@link java.io.InputStream} object. * @return a {@link com.google.cloud.bigtable.config.CredentialOptions} object. */ public static CredentialOptions jsonCredentials(InputStream jsonInputStream) { return new JsonCredentialsOptions(jsonInputStream); }
private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = CallOptionsConfig.builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }
/** {@inheritDoc} */ @Override public void move(byte[] encodedRegionName, byte[] destServerName) throws HBaseIOException, MasterNotRunningException, ZooKeeperConnectionException { LOG.info("move is a no-op"); }
/** {@inheritDoc} */ @Override public void assign(byte[] regionName) throws MasterNotRunningException, ZooKeeperConnectionException, IOException { LOG.info("assign is a no-op"); }
/** {@inheritDoc} */ @Override public void splitRegion(byte[] bytes, byte[] bytes2) throws IOException { LOG.info("split is a no-op"); }
/** {@inheritDoc} */ @Override public void majorCompactRegion(byte[] bytes) throws IOException { LOG.info("majorCompactRegion is a no-op"); }
/** {@inheritDoc} */ @Override public void majorCompactRegion(byte[] bytes, byte[] bytes2) throws IOException { LOG.info("majorCompactRegion is a no-op"); }
/** {@inheritDoc} */ @Override public void flushRegion(byte[] bytes) throws IOException { LOG.info("flushRegion is a no-op"); }
/** {@inheritDoc} */ @Override public void compact(TableName tableName, byte[] bytes) throws IOException { LOG.info("compact is a no-op"); }
/** {@inheritDoc} */ @Override public void majorCompact(TableName tableName, byte[] bytes) throws IOException { LOG.info("majorCompact is a no-op"); }
/** {@inheritDoc} */ @Override public void unassign(byte[] regionName, boolean force) throws MasterNotRunningException, ZooKeeperConnectionException, IOException { LOG.info("unassign is a no-op"); }
/** {@inheritDoc} */ @Override public void mergeRegions(byte[] encodedNameOfRegionA, byte[] encodedNameOfRegionB, boolean forcible) throws IOException { LOG.info("mergeRegions is a no-op"); }
/** {@inheritDoc} */ @Override public void splitRegion(byte[] bytes) throws IOException { LOG.info("splitRegion is a no-op"); }