楼主: biti_rainy

关于回滚段使用的一点讨论

[复制链接]
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
31#
 楼主| 发表于 2002-4-26 17:13 | 只看该作者

噢2

最初由 guanlp 发布
[B]当指针到达rollback segment尾部后,就会继续前进到rollback segment头部,因为它是个环。如果第一个extent 有活动事务,那么就会从尾部扩展一个extent. [/B]


按照上面观点,似乎与parrotao的意见不一致,如果第一个extent 有活动事务,那么就会从尾部扩展一个extent,那如果头指针与尾指针之间(假设这时尾指针就是第一个extent)有不少空闲空间,则无法使用了。

1:假设共10个extent并编号,尾指针在5号位置,头在10号位置,但7、8号extent已经空闲,这时新的事务来的时候头向1号移动,依次到4号,这个时候5仍然没有释放,那这个时候:

这时:头指针越过5号而利用7、8号直到没有空间在10号和1号间扩展extents?还是不用7、8号而直接扩展新空间……


2:假设共10个extent并编号,尾指针在1号位置,头在10号位置,但7、8号extent已经空闲,这时新的事务来的时候由于第一个extent有事务:

这时:回滚段扩展,指针依次指向11、12、13、14号(在10和1之间)?还是先依次移动到7、8号利用完毕如果不够再移动,然后扩展11号?

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
32#
 楼主| 发表于 2002-4-27 08:24 | 只看该作者

这样的话

那咱们的意见上至少是统一了,呵呵

我个人认为理论上应该是这样的
这也是发挥环状空间管理的好处

只是对于扩展空间的回收实在费劲

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
33#
 楼主| 发表于 2002-4-27 12:38 | 只看该作者

从这里可以看出,oracle不会跳过“尾”而使用环中间的空闲空间的

3. For a running transaction, if the current extent is full, it will look at the next extent (if the current one is the last in the ring, the next extent will be the first one.). If the next one is available, it will use it. Otherwise, it will allocate a new one.

就是说oracle不会越过一个正被使用的extents而去使用下下一个extents
不是么?
我说了,我猜测oracle这么做的意图
应该是让一个事务所使用的空间连续而不离散

当发生相临的下一个extents被使用的时候则扩展
至于新开辟的空间,就位于环的当前extents和next之间(next正被使用)
环和实际的段头段尾没有关系


所以:
. Oracle will check 1 ,2 ,3, 4, 5, 6 and find 7 is available and use it.

这句话是不正确的,当检查到5正被使用的时候,立即扩展新空间

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
34#
 楼主| 发表于 2002-4-27 13:30 | 只看该作者

请翻译这句话,并理解为什么会这么做

3. For a running transaction, if the current extent is full, it will look at the next extent (if the current one is the last in the ring, the next extent will be the first one.). If the next one is available, it will use it. Otherwise, it will allocate a new one.

对于一个正运行的事务,如果当前区间满了,踏将寻找下一个(如果当前区间是回滚段形成的环的物理段尾,则下一个区间就是物理段头)。如果下一个区间可用,就使用该区间,否则,它就重新扩展分配一个新的区间。

我认为最后一句是关键。对于oracle来说,allocate a new one我认为是扩展而不是继续往下查找空闲空间。

如果是继续往下找,应该类似表达为  look for the next one

更重要的,如果是继续往下找,真的是一点好处都没有,oracle为何不把空闲区间直接挂在freelist列表中和数据文件一样的处理,这样环状结构一点好处都没有反而多了循环查找的过程,oracle的开发者不至于这么“傻”的,一定有他的理由。我以为理由就是这样可以避免碎片和保证事务数据的连续存储

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
35#
 楼主| 发表于 2002-4-28 14:51 | 只看该作者

hehe

楼上的说的算法是找回滚段而不是找extents

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
36#
 楼主| 发表于 2002-5-3 22:31 | 只看该作者

you are right

指针头和尾之间扩展

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
37#
 楼主| 发表于 2002-5-11 08:18 | 只看该作者

楼上说的

如果能这么做,当然是好
但是:
关键要系统允许IMPORT、EXPORT , 24*7怎办,数据的及时性和一致性问题怎么解决?(始终有不间断事务)
如果大事务很大,回滚段又多又大,准备多少空间?大不了给100G?
cursor 参数对于产品数据库来说,大些比较好,对于开发中的,小些容易暴露出系统的不足

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
38#
发表于 2002-5-8 22:02 | 只看该作者

~~

什么时候回滚段offline???

使用道具 举报

回复
论坛徽章:
0
39#
发表于 2002-4-26 09:15 | 只看该作者
我认为1的情况是不存在的。因为一个回退段可以允许多个事务使用。回退段会给其他事务分配空闲的块。即使一个extent 也可以包括多个事务信息。

使用道具 举报

回复
论坛徽章:
0
40#
发表于 2002-4-26 14:24 | 只看该作者
biti_rainy:
   希望继续讨论。
   下面是我从OCP培训教材中找到的。

Using Extents
Transactions use extents of a rollback segment in a sequential, circular fashion,
moving from one to the next after the current extent is full. A transaction writes an
entry to its current location in the rollback segment and advances the current pointer
by the size of the entry.
More than one transaction can write to the same extent of a rollback segment;
however, each rollback segment block contains information from one and only one
transaction.

Example
In the example in the slide, two transactions have been assigned to a rollback segment,
which has four extents.
1 When the transactions commence, they begin writing to Extent 3 of the rollback
segment.
2 As the two transactions generate more rollback information, they continue to write
into Extent 3.
3 When Extent 3 is full, the transactions write to the next extent in the ring, which is
Extent 4. When transactions start writing to a new extent as in this step, it is called
a wrap.
4 When the last extent for the rollback segment (Extent 4) is full, the transactions
can use the first in the ring (Extent 1) if it is free or inactive. An extent is only free
or inactive if there are currently no active transactions using the extent—that is, all
transactions that wrote to the extent have completed.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表