zhaijack commented on issue #414: Test failure in UpdateLedgerOpTest
URL: https://github.com/apache/bookkeeper/issues/414#issuecomment-321153010
 
 
   The problem is that the configuration in baseConf not get the wanted value 
after `new ServerConfiguration(baseConf)`.
   In the test, we setAllowLoopback(true), and thought it always true, but 
seems acturally not. 
   ```
   public UpdateLedgerOpTest() {
       super(3);
       baseConf.setAllowLoopback(true);  < === here set true
       baseConf.setGcWaitTime(100000);
   }
   \
   testManyLedgers() 
   \
   BookieSocketAddress curBookieId = Bookie.getBookieAddress(baseConf);
   \
   if (addr.getSocketAddress().getAddress().isLoopbackAddress()
       && !conf.getAllowLoopback()) {  < === getAllowLoopback get false, but we 
want it to be true.
       throw new UnknownHostException("Trying to listen on loopback address, "
               + addr + " but this is forbidden by default "
               + "(see ServerConfiguration#getAllowLoopback())");
   }
   ```
   Add some log to trace and debug, Here is the place that the value in 
baseConf turns into unwanted at here:
   ``` 
   protected ServerConfiguration newServerConfiguration(int port, String 
zkServers, File journalDir, File[] ledgerDirs) {
       ServerConfiguration conf = new ServerConfiguration(baseConf);  < ===  
       conf.setBookiePort(port);
       conf.setZkServers(zkServers);
       LOG.info("baseConf: getAllowLoopBack: {} ", 
baseConf.getAllowLoopback()); < == print true
       conf.setAllowLoopback(true);  < == after this call, baseConf value also 
changed.
       LOG.info("baseConf: getAllowLoopBack: {} ", 
baseConf.getAllowLoopback()); < == print false
       LOG.info("newConf: getAllowLoopBack: {} ", conf.getAllowLoopback());
       conf.setJournalDirName(journalDir.getPath());
   
       String[] ledgerDirNames = new String[ledgerDirs.length];
       for (int i=0; i<ledgerDirs.length; i++) {
           ledgerDirNames[i] = ledgerDirs[i].getPath();
       }
       conf.setLedgerDirNames(ledgerDirNames);
       return conf;
   }
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to