You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kristian Waagan <kr...@oracle.com> on 2011/08/29 10:52:46 UTC

Minor-version upgrade and replication with sane builds

Hi,


While looking into a replication issue, I was stopped dead by an assert:
ERROR XJ001: Java exception: 'ASSERT FAILED Wrong LogInstant on log 
record (0,0) version real position (1,11510): 
org.apache.derby.shared.common.sanity.AssertFailure'. [1]

In this case I had created the database using 10.8.1.2 and then tried to 
test my patched code with head of the 10.8 branch.

Investigation revealed that:
  o things (appear to) work fine with a production build
  o the assert is triggered by minor-version upgrade logic, but the 
database is in a read-only state when booted the first time (for 
authentication [2])
  o a subsequent boot of the database without specifying startSlave=true 
resulted in a different error [3]

What is a little disturbing is that the insane code boots with no issue, 
whereas the sane code balks.

I don't know if this is a real problem, but I'm posting it here in case 
anyone else sees the same issue. The easy way of out this is to create 
the database and set up the replication pair using the same Derby 
version - I would think this is exactly what people do at least 99% of 
the time :)

There seems to be other issues related to the "multi-booting" approach:
  o DERBY-4299
  o DERBY-3896
Also, this assert appears to have been raised in a few cases where there 
is actual data corruption.


-- 
Kristian

[1] ============= begin nested exception, level (3) ===========
org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Wrong 
LogInstant on log record (0,0) version real position (1,11510)
         at 
org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
         at 
org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
         at 
org.apache.derby.impl.store.raw.log.Scan.getNextRecordBackward(Scan.java:403)
         at 
org.apache.derby.impl.store.raw.log.Scan.getNextRecord(Scan.java:204)
         at 
org.apache.derby.impl.store.raw.log.FileLogger.undo(FileLogger.java:939)
         at org.apache.derby.impl.store.raw.xact.Xact.abort(Xact.java:952)
         at 
org.apache.derby.impl.store.raw.xact.Xact.destroy(Xact.java:1108)
         at 
org.apache.derby.impl.store.access.RAMTransaction.destroy(RAMTransaction.java:2030)
         at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.boot(DataDictionaryImpl.java:902)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
         at 
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:531)
         at 
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:427)
         at 
org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:195)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
         at 
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1816)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1682)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1560)
         at 
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:979)
         at 
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:550)
         at 
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2697)
         at 
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:385)
         at 
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
         at 
org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:51)
         at 
org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:70)
         at 
org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:248)
         at 
org.apache.derby.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:144)
         at java.sql.DriverManager.getConnection(DriverManager.java:582)
         at java.sql.DriverManager.getConnection(DriverManager.java:154)
         at 
org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1503)
         at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1333)
         at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1118)
         at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:341)
         at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
         at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
         at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
         at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
         at org.apache.derby.tools.ij.main(ij.java:59)

[2] From EmbedConnection:
// We need to boot the slave database two times. The
// first boot will check authentication and
// authorization. The second boot will put the
// database in replication slave mode. SLAVE_PRE_MODE
// ensures that log records are not written to disk
// during the first boot. This is necessary because
// the second boot needs a log that is exactly equal
// to the log at the master.

[3] ERROR X0Y32: Statement 'getTablePrivileges' already exists in Schema 
'SYS'.