Issue Details (XML | Word | Printable)

Key: DERBY-239
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Suresh Thalamati
Reporter: Suresh Thalamati
Votes: 4
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Derby

Need a online backup feature that does not block update operations when online backup is in progress.

Created: 27/Apr/05 02:44 AM   Updated: 01/Jul/09 12:34 AM
Return to search
Component/s: Store
Affects Version/s: 10.1.1.0
Fix Version/s: 10.2.1.6

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
Java Archive File Licensed for inclusion in ASF works obtest_customer.jar 2005-12-17 08:21 AM Suresh Thalamati 2 kB
HTML File Licensed for inclusion in ASF works onlinebackup.html 2005-10-07 02:24 AM Suresh Thalamati 28 kB
HTML File Licensed for inclusion in ASF works onlinebackup1.html 2005-12-01 11:24 AM Suresh Thalamati 33 kB
HTML File Licensed for inclusion in ASF works onlinebackup2.html 2006-02-01 08:46 AM Suresh Thalamati 35 kB
File Licensed for inclusion in ASF works onlinebackup_1.diff 2005-10-08 03:49 AM Suresh Thalamati 42 kB
File Licensed for inclusion in ASF works onlinebackup_2.diff 2005-11-01 03:54 AM Suresh Thalamati 0.5 kB
File Licensed for inclusion in ASF works onlinebackup_3.diff 2005-11-15 11:50 AM Suresh Thalamati 35 kB
File Licensed for inclusion in ASF works onlinebackup_4.diff 2005-12-01 05:04 PM Suresh Thalamati 62 kB
File Licensed for inclusion in ASF works onlinebackup_5.diff 2005-12-07 03:53 AM Suresh Thalamati 6 kB
File Licensed for inclusion in ASF works onlinebackup_6.diff 2005-12-16 07:02 PM Suresh Thalamati 33 kB
File Licensed for inclusion in ASF works onlinebackup_7.diff 2006-01-17 10:51 AM Suresh Thalamati 73 kB
File Licensed for inclusion in ASF works onlinebackup_8.diff 2006-01-29 08:03 AM Suresh Thalamati 51 kB
Issue Links:
Reference
 

Resolution Date: 01/Mar/06 04:54 AM

Sub-Tasks  All   Open   
No sub-tasks match this view.

 Description  « Hide
Currently Derby allows users to perfoms online backups using SYSCS_UTIL.SYSCS_BACKUP_DATABASE() procedure, but while the backup is in progress, update operations are temporarily blocked, but read operations can still proceed.

Blocking update operations can be real issue specifically in client server environments, because user requests will be blocked for a long time if a
backup is in the progress on the server.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #326824 Thu Oct 20 05:06:37 UTC 2005 mikem phase 1 work for DERBY-239, committed on behalf of: Suresh Thalamati

This patch adds some code necessary to support real-time online backup that
does not block writes when database backup is in progress. All the current functional tests
passed with these changes. It would be great if some can review and commit this patch.

This patch changes the way data segment and log is backed up without blocking
the writes.

Data Segment Backup:

o The containers to be backed up are found by scanning the files in seg0.

o Each container is backed up by reading all the pages through the page cache,
and then writing to the backup container. Pages are latched while
writing into the backup container.
o Not necessary to backup containers in any particular order , All updates
that happens after a container is backed will be redone using the
transaction log on restore.

MT cases:
1) Each page is latched when it is written to the backup to prevent partial
written pages sneaking into the backup.
2) Thread that is backing up the container will stop if another thread
requests removal of the container when container is being backed up.
3) Truncate of the container blocks if the container is being backed up.
4) Partially created containers will not be backed up. Container cache will
not return the container items until the creation is complete.
(No changes are not for this case , that is how it currently works).


Transaction Log Backup:

Transaction Log file backup in two phases:
1) First Check point info and the the log files are backed up before the
data segment.
2) After the data segment is backed up , all the log files
that are generated after tha backup started are also copied into the backup.

MT cases:
1) If there is a checkpoint in progress, backup will wait for the
checkpoint to complete before copying checkpoint control information
into the backup.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/ContainerHandle.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/CachedPage.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/ReadOnly.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseContainer.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/data/DataFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java

Repository Revision Date User Message
ASF #329934 Mon Oct 31 23:42:24 UTC 2005 mikem anther patch for DERBY-239, committed on behalf of: Suresh Thalamati.

Fix to the problem found by Oystein while reviewing the previous online
backup patch(online_backup1.diff).
Backup of a container code was doing a seek incorrectly on the file container
instead of the backup file.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java

Repository Revision Date User Message
ASF #345355 Thu Nov 17 22:59:38 UTC 2005 mikem DERBY-239, committing next phase checkin on behalf of Suresh Thalamati.

This patch adds code to support real-time online backup with unlogged
operations. A consistent backup can not be made if there are pending
transactions with unlogged operations or if unlogged operations
occur when backup is in progress. Because container files can be copied
to the backup before the transaction is committed and the data pages are
flushed as part of the commit. As there is no transaction log for unlogged
operations, while restoring from the backup database can not be restored to
a consistent state. To make a consistent online backup in this scenario, this patch:

1) blocks online backup until all the transactions with unlogged operation are
committed/aborted.
2) implicitly converts all unlogged operations to logged mode for the duration
of the online backup, if they are started when backup is in progress.

This patch also adds a test to test the online backup in parallel with some DML,

> DDL and unlogged operations.
Files Changed
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackup.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/copyfiles.ant
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest1_app.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest1.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/st_1.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_1.sql
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/TransactionFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineBackupTest1.out
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java

Repository Revision Date User Message
ASF #354523 Tue Dec 06 19:47:31 UTC 2005 mikem DERBY-239, fixing onlinebackuptest1.

committing on behalf of Suresh Thalamati.

This pacth fixes store/onlineBackupTest1.java failure on non-windows envirorment. Problem was unlogged operations thread and insert thread are working on the same connection. Test was failing becuase insert thread was committing the unlogged operation that was suppose to block the backup.
This pacth modified the test , so that these threads works on different conenctions,
 

 Test passed on Windows XP and Linuix.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackup.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest1.java

Repository Revision Date User Message
ASF #354898 Wed Dec 07 23:22:01 UTC 2005 mikem committing onlinebackup_4.diff for DERBY-239.

committing on behalf of Suresh Thalamati.

This patch makes online backup call to wait/fail when unlogged operations like
create index are pending. It also fixes DERBY-523 bug my making the existing
log archive backup procedure to wait for the unlogged operation to complete.

-- Two new procedures are added to allow the users to make backup wait/fail
when unlogged operations are pending.
-- prevents users starting backup in an non-idle transactions to avoid backup
blocking forever if users starts backup in the same transaction as an
unlogged operation.
-- backup is not really transactional , to avoid any locking issues in the
futures; backup procedures ends the transaction by implicitly doing commit
when it is successful or rollback on any errors.

A new backup test is added to store suite to test the above scenarios.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/storetests/st_1.sql
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/FTFileUtil.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/database/Database.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/RAMAccessManager.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/copyfiles.ant
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/st_1.out
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties

Repository Revision Date User Message
ASF #357269 Sat Dec 17 01:52:03 UTC 2005 mikem DERBY-239, committing on behalf of Suresh Thalamati.

This patch adds code to support online backup when jar operations
are running parallel to the backup. Jar files are not logged, but the
system catalogs updates are logged when a jar file is added/replaced.
If the jar file operations are allowed during the backup, system catalog
(sys.sysfiles) table in the backup database can have a reference to a jar file
that does not exist in the backup database. And also backup can contain
partial written jar files. To make a consistent online backup, this patch:

1) Makes Backup operation wait/fail for all the jar operations activity in progress to complete.
2) Blocks jar file operations when a backup is in progress.

This patch also adds a new test to test the online backup
with jar operations.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/copyfiles.ant
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/obtest_customer.jar
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineBackupTest3.out
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java

Repository Revision Date User Message
ASF #370530 Thu Jan 19 16:32:08 UTC 2006 mikem DERBY-239, most recent patch committed on behalf of Suresh Thalamati

This patch addresses the issues raised by ·¹ystein in his review of previous
online backup patches 3-6.

- changed the backup procedures names with ONLINE to NOWAIT
- removed the transaction Idle restriction to run backup procedures.
- removed implicit commit/rollbacks.
- Added a new lesser impact restriction, which only disallows backup call only if
  there are unlogged operations executed in the same transaction before the backup.
  - Removed casting to RawTransaction.
  - fixed Names and Comments.
  - Enhanced the tests with addional test cases suggested by ·¹ystein.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/onlineBackupTest2.sql
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/catalog/SystemProcedures.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineBackupTest1.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/onlineBackupTest2.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/OnlineBackupTest3.out
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest1.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/AccessFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/SQLState.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/TransactionFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/XactFactory.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties

Repository Revision Date User Message
ASF #379620 Tue Feb 21 23:16:20 UTC 2006 mikem DERBY-304 submitted on behalf of Suresh Thalamati
Fix :

1) Do not allow backup path to be any derby database directory. A directory is
assumed to be a derby database directory if it has service.properties file in it.

2) copy files needed from the database home into the backup one by one
instead of recursive copy from the top directory.

3) while copying the directories under jar directory, copy each sub directory
separately without copying any subdirectories under them (There should not
be any unless if user has created explicitly or created backup at that location).

4) Log and Seg0 directory are NOT already copied recursively, this was changed as part of
online backup work (DERBY-239).
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/copyfiles.ant
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests.java
MODIFY /db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/storemore.runall
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/FileUtil.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/BackupPathTests.out
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java

Repository Revision Date User Message
ASF #384085 Wed Mar 08 01:25:35 UTC 2006 fuzzylogic DERBY-916: Document DERBY-239, online backup.

Committed for Jeff Levitt <derby@mylevita.com>
Files Changed
MODIFY /db/derby/docs/trunk/src/adminguide/cadminhubbkup75469.dita
MODIFY /db/derby/docs/trunk/src/adminguide/cadminhubbkup01.dita
MODIFY /db/derby/docs/trunk/src/adminguide/cadminrollforward.dita
MODIFY /db/derby/docs/trunk/src/adminguide/cadminhubbkup98797.dita
MODIFY /db/derby/docs/trunk/src/adminguide/cadminhubbkup63476.dita
MODIFY /db/derby/docs/trunk/src/ref/refderby.ditamap