Source Code Cross Referenced for LogicalUndo.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » store » access » conglomerate » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.store.access.conglomerate 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.store.access.conglomerate.LogicalUndo
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.iapi.store.access.conglomerate;
023:
024:        import org.apache.derby.iapi.error.StandardException;
025:        import org.apache.derby.iapi.store.raw.LogicalUndoable;
026:        import org.apache.derby.iapi.store.raw.Page;
027:        import org.apache.derby.iapi.store.raw.Transaction;
028:
029:        import org.apache.derby.iapi.services.io.LimitObjectInput;
030:        import java.io.IOException;
031:
032:        /**
033:         A Logical undo is an undo operation that operates on a different page
034:         from the page that has the original change.  The reason one would
035:         need logical undo is when an uncommitted row move from one page to
036:         another in a nested internal transaction which is committed.  For
037:         example, an uncommitted insert on a btree may be moved by a later split
038:         operation to another page, the split operation will have committed.  If
039:         the insert needs to be rolled back, it can only be found at the new
040:         page where the split puts it and not at the original page where it is
041:         inserted. 
042:         <P>
043:         The logging and recovery system does not know how to do logical undo.
044:         Client of the logging system must provide it with a call back function
045:         so that during undo time (both runtime undo and recovery undo), the
046:         appropriate page and row can be found so that the logging system can
047:         apply the log's undo operation.
048:         <P>
049:         Any log operation that needs logical undo must implement this
050:         LogicalUndo interface, which serves the purpose of a callback function
051:         pointer.  This callback function findUndoInfo is called by log operation
052:         generateUndo and will be given all the information in the log operation.
053:         <P>
054:         FindUndo uses the information in the pageOp to find the correct page
055:         and record that needs to be rolled back, i.e., a latched page
056:         (undoPage) and the recordId (undoRID).  It returns the latched
057:         undoPage, and modifies the pageOp to contain the correct segmentId,
058:         containerId, pageNumber and recordId etc.  It also need to supply a
059:         releaseResource() method that the logging system can call to unlatch
060:         the page and release the container, etc, after the undo has been
061:         applied.
062:         <P>
063:         The logging system will use the information in the undoPackage to put
064:         together a Compensation operation which has the undoPage number
065:         and undoRID.  Logical Undo is only called during the generation of a
066:         CLR, never during recovery redo.
067:         <P>
068:         <B>Note: LogicalUndo is a call back function pointer that will be
069:         written out as part of the log operation, it should not contain any
070:         non-transient member fields </B>
071:         <P>
072:         Details.
073:         <P>
074:         LogicalUndo, and LogicalUndoable is the interface used by logical undo
075:         between the logging system in RawStore and Access.  A log operation
076:         that needs logical undo should implment LogicalUndoable intead of
077:         Undoable.  A LogicalUndoable log operation contains a LogicalUndo
078:         member field, which is a function pointer to an Access function that
079:         provides the logical undo logic of, say, traversing a btree.  
080:         <P>
081:         When called to generateUndo, that LogicalUndoable log operation will
082:         call LogicalUndo.findUndo instead of relying on the page number and
083:         recordId that is stored in it during the runtime roll forward
084:         operation.  <B>The logging system opens the container before it calls
085:         findUndo, therefore the container where the log operation is applied
086:         cannot between rollforward and rollback.</B>
087:         <P>
088:         In LogicalUndo.findUndo, it can use information stored in
089:         the LogicalUndoable, such as pageNumber, containerId, to come up with a
090:         template row.  It can then ask the LogicalUndoable log record
091:         to restore a row from the log record that fits the template.  Using
092:         this restored row, LogicalUndo can, e.g., restore the key to the btree
093:         and traverses the btree.  Once it finds the correct RecordHandle where
094:         the rollback should go, findUndo should call pageOp.resetRecord and
095:         return a latched page where the undo should go.
096:         <P>
097:         Upon the return of findUndo, the LogicalUndoable log operation should
098:         have information about the new RecordHandle and the page should be
099:         return latched.  A compensation operation is then generated with the
100:         new record location and undoMe is applied on the correct location.
101:         <P>
102:         The logging system will unlatch the undoPage when it is done with
103:         rollback and will close the container.
104:
105:         @see org.apache.derby.iapi.store.raw.LogicalUndoable
106:         @see org.apache.derby.iapi.store.raw.Undoable#generateUndo 
107:         */
108:
109:        public interface LogicalUndo {
110:
111:            /**
112:            	Find the page and record to undo.  If no logical undo is necessary,
113:            	i.e., row has not moved, then just return the latched page where undo
114:            	should go.  If the record has moved, it has a new recordId on the new
115:            	page, this routine needs to call pageOp.resetRecord with the new
116:            	RecordHandle so that the logging system can update the compensation
117:            	Operation with the new location.
118:
119:            	@param transaction the transaction doing the rollback
120:            	@param pageOp the page operation that supports logical undo.  This
121:            			LogicalUndo function pointer is a field of that pageOperation
122:            	@param in data stored in the log stream that contains the record data
123:            			necessary to restore the row.
124:
125:            	@exception StandardException Standard Cloudscape error policy
126:            	@exception IOException Method may read from InputStream		
127:             */
128:            public Page findUndo(Transaction transaction,
129:                    LogicalUndoable pageOp, LimitObjectInput in)
130:                    throws StandardException, IOException;
131:        }
ww_w___.__j___ava_2__s._c_om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.