Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD435D07E for ; Thu, 16 Aug 2012 16:39:38 +0000 (UTC) Received: (qmail 3226 invoked by uid 500); 16 Aug 2012 16:39:38 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 3150 invoked by uid 500); 16 Aug 2012 16:39:38 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 3018 invoked by uid 99); 16 Aug 2012 16:39:38 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2012 16:39:38 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 0B6DD2C5BE4 for ; Thu, 16 Aug 2012 16:39:38 +0000 (UTC) Date: Fri, 17 Aug 2012 03:39:38 +1100 (NCT) From: "Myrna van Lunteren (JIRA)" To: derby-dev@db.apache.org Message-ID: <1515307744.19485.1345135178047.JavaMail.jiratomcat@arcas> In-Reply-To: <516318041.4628.1337186942291.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (DERBY-5766) BaseDataFileFactory.boot() should log the exception that causes it to boot the database read only MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-5766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436080#comment-13436080 ] Myrna van Lunteren commented on DERBY-5766: ------------------------------------------- Kathey, what exactly did you want a review on? I don't see a patch for this issue - did you make one? > BaseDataFileFactory.boot() should log the exception that causes it to boot the database read only > -------------------------------------------------------------------------------------------------- > > Key: DERBY-5766 > URL: https://issues.apache.org/jira/browse/DERBY-5766 > Project: Derby > Issue Type: Bug > Components: Store > Affects Versions: 10.9.1.0 > Reporter: Kathey Marsden > Assignee: Kathey Marsden > > In BaseDataFileFactory.boot() there is code that tries to write to the lock file. If it cannot, and gets an IOException it assumes the database is read only. I think that we should log that the database is booting read only and why and if it is not specifically a permission error log the exception stack trace. > > fileLockOnDB = fileLock.getRandomAccessFile( "rw"); > fileLock.limitAccessToOwner(); > // write it out for future reference > fileLockOnDB.writeUTF(myUUID.toString()); > fileLockOnDB.sync(); > fileLockOnDB.seek(0); > // check the UUID > UUID checkUUID = uuidFactory.recreateUUID(fileLockOnDB.readUTF()); > if (!checkUUID.equals(myUUID)) > { > throw StandardException.newException( > SQLState.DATA_MULTIPLE_JBMS_ON_DB, databaseDirectory); > } > } > catch (IOException ioe) > { > // probably a read only db, don't do anything more > readOnly = true; > try > { > if (fileLockOnDB != null) > fileLockOnDB.close(); > } > catch (IOException ioe2) > { /* did the best I could */ } > fileLockOnDB = null; > return; > } > I think this code can be exercised by creating a database and exiting without shutdown. Then change permission on the db.lck and dbex.lck files. It occurs often in the field when multiple users with incompatible permissions/umasks access the derby database. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira