|
18 | 18 |
|
19 | 19 | import com.google.api.core.InternalApi; |
20 | 20 | import com.google.cloud.bigtable.hbase.BigtableBufferedMutator; |
| 21 | +import com.google.cloud.bigtable.hbase.BigtableHBaseVersion; |
21 | 22 | import com.google.cloud.bigtable.hbase.BigtableRegionLocator; |
22 | 23 | import com.google.cloud.bigtable.hbase.adapters.Adapters; |
23 | 24 | import com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter; |
|
30 | 31 | import java.io.Closeable; |
31 | 32 | import java.io.IOException; |
32 | 33 | import java.util.HashSet; |
| 34 | +import java.util.Map; |
33 | 35 | import java.util.Set; |
34 | 36 | import java.util.concurrent.CopyOnWriteArraySet; |
35 | 37 | import java.util.concurrent.ExecutorService; |
36 | 38 | import java.util.concurrent.TimeUnit; |
| 39 | +import java.util.concurrent.atomic.AtomicBoolean; |
37 | 40 | import org.apache.hadoop.conf.Configuration; |
38 | 41 | import org.apache.hadoop.hbase.ServerName; |
39 | 42 | import org.apache.hadoop.hbase.TableName; |
@@ -114,11 +117,43 @@ protected AbstractBigtableConnection( |
114 | 117 | throw ioe; |
115 | 118 | } |
116 | 119 |
|
| 120 | + logStartup(LOG, conf, settings); |
| 121 | + |
117 | 122 | this.batchPool = pool; |
118 | 123 | this.closed = false; |
119 | 124 | this.bigtableApi = BigtableApi.create(settings); |
120 | 125 | } |
121 | 126 |
|
| 127 | + private static final AtomicBoolean firstConnection = new AtomicBoolean(); |
| 128 | + |
| 129 | + private void logStartup(Logger logger, Configuration userConfig, BigtableHBaseSettings settings) { |
| 130 | + if (firstConnection.compareAndSet(false, true)) { |
| 131 | + String jarPath; |
| 132 | + try { |
| 133 | + jarPath = getClass().getProtectionDomain().getCodeSource().getLocation().toString(); |
| 134 | + } catch (RuntimeException e) { |
| 135 | + jarPath = "<unknown>"; |
| 136 | + } |
| 137 | + |
| 138 | + logger.info( |
| 139 | + "Using bigtable-hbase client from jar %s. Version: %s", |
| 140 | + jarPath, BigtableHBaseVersion.getVersion()); |
| 141 | + } |
| 142 | + // Dump user configuration |
| 143 | + if (logger.getLog().isDebugEnabled()) { |
| 144 | + MoreObjects.ToStringHelper configHelper = MoreObjects.toStringHelper("BigtableConfiguration"); |
| 145 | + |
| 146 | + for (Map.Entry<String, String> entry : userConfig) { |
| 147 | + if (!entry.getKey().startsWith("google.bigtable")) { |
| 148 | + continue; |
| 149 | + } |
| 150 | + configHelper.add(entry.getKey(), entry.getValue()); |
| 151 | + } |
| 152 | + logger.debug("User Configuration: " + configHelper); |
| 153 | + logger.debug("Effective settings: " + settings.toDebugString()); |
| 154 | + } |
| 155 | + } |
| 156 | + |
122 | 157 | /** {@inheritDoc} */ |
123 | 158 | @Override |
124 | 159 | public Configuration getConfiguration() { |
|
0 commit comments