@Override public void start() { String clusterFile = configService.getProperty(CONFIG_CLUSTER_FILE); if (clusterFile.length() == 0) { ownDatabase = null; } else { ownDatabase = fdbService.getFDB().open(clusterFile); } byte[] prefix; try { prefix = configService.getProperty(CONFIG_PREFIX).getBytes("ISO-8859-1"); } catch (UnsupportedEncodingException ex) { throw new AkibanInternalException("Error encoding prefix", ex); } dataSubspace = new Subspace(tupleFrom(METRIC_KEY), prefix); confSubspace = new Subspace(tupleFrom(METRIC_CONF_KEY), prefix); confChangesSubspace = new Subspace(tupleFrom(METRIC_CONF_CHANGES_KEY), prefix); // NOTE: Java does not expose a nanosecond wallclock timer, like POSIX // CLOCK_REALTIME, only one like CLOCK_MONOTONIC. (Among other things, 64 bits is // only 292 years.) There is a tradeoff between using synchronized clocks in a // multi-node environment and using clocks that NTP doesn't change so that // small-scale deltas are always accurate. fdbserver metrics choose the former. timebase = System.currentTimeMillis() * 1000000 - System.nanoTime(); // TODO: Consider recomputing this periodically. See also ServerSchemaTablesServiceImpl. address = "127.0.0.1"; try { address = InetAddress.getLocalHost().getHostAddress(); } catch (IOException ex) { // Ignore } address = address + ":" + configService.getProperty("fdbsql.postgres.port"); flushInterval = Long.parseLong(configService.getProperty(CONFIG_FLUSH_INTERVAL)); backgroundThread = new Thread() { @Override public void run() { backgroundThread(); } }; loadConf(); running = true; backgroundThread.start(); sqlLayerRunningMetric = addBooleanMetric(SQL_LAYER_RUNNING_NAME); sqlLayerRunningMetric.set(true); }
protected Database getDatabase() { if (ownDatabase != null) return ownDatabase; else return fdbService.getDatabase(); }