[ 
https://issues.apache.org/jira/browse/AMQ-7067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16643377#comment-16643377
 ] 

Jamie goodyear commented on AMQ-7067:
-------------------------------------

The following test case can be inserted into the AMQ7067Test file:
 [https://gist.github.com/jgoodyear/f3c716aec99c066894047ed996cdcdc9]

Its a non-completing test, it just allows us to setup the scenario, load up a 
lot of db page files, than let compaction occur.

In my IDEA environment i can watch the data folder populate:
{code:java}
icbts-2:activemq-unit-tests icbts$ ls target/data/kahadb/
db-1.log        db-115.log      db-131.log      db-148.log      db-164.log      
db-180.log      db-197.log      db-212.log      db-229.log      db-245.log      
db-261.log      db-278.log      db-4.log        db-56.log       db-72.log       
db-89.log
db-10.log       db-116.log      db-132.log      db-149.log      db-165.log      
db-181.log      db-198.log      db-213.log      db-23.log       db-246.log      
db-262.log      db-279.log      db-40.log       db-57.log       db-73.log       
db-9.log
db-100.log      db-117.log      db-133.log      db-15.log       db-166.log      
db-182.log      db-199.log      db-214.log      db-230.log      db-247.log      
db-263.log      db-28.log       db-41.log       db-58.log       db-74.log       
db-90.log
db-101.log      db-118.log      db-134.log      db-150.log      db-167.log      
db-183.log      db-2.log        db-215.log      db-231.log      db-248.log      
db-264.log      db-280.log      db-42.log       db-59.log       db-75.log       
db-91.log
db-102.log      db-119.log      db-135.log      db-151.log      db-168.log      
db-184.log      db-20.log       db-216.log      db-232.log      db-249.log      
db-265.log      db-281.log      db-43.log       db-6.log        db-76.log       
db-92.log
db-103.log      db-12.log       db-136.log      db-152.log      db-169.log      
db-185.log      db-200.log      db-217.log      db-233.log      db-25.log       
db-266.log      db-282.log      db-44.log       db-60.log       db-77.log       
db-93.log
db-104.log      db-120.log      db-137.log      db-153.log      db-17.log       
db-186.log      db-201.log      db-218.log      db-234.log      db-250.log      
db-267.log      db-29.log       db-45.log       db-61.log       db-78.log       
db-94.log
db-105.log      db-121.log      db-138.log      db-154.log      db-170.log      
db-187.log      db-202.log      db-219.log      db-235.log      db-251.log      
db-268.log      db-3.log        db-46.log       db-62.log       db-79.log       
db-95.log
db-106.log      db-122.log      db-139.log      db-155.log      db-171.log      
db-188.log      db-203.log      db-22.log       db-236.log      db-252.log      
db-269.log      db-30.log       db-47.log       db-63.log       db-8.log        
db-96.log
db-107.log      db-123.log      db-14.log       db-156.log      db-172.log      
db-189.log      db-204.log      db-220.log      db-237.log      db-253.log      
db-27.log       db-31.log       db-48.log       db-64.log       db-80.log       
db-97.log
db-108.log      db-124.log      db-140.log      db-157.log      db-173.log      
db-19.log       db-205.log      db-221.log      db-238.log      db-254.log      
db-270.log      db-32.log       db-49.log       db-65.log       db-81.log       
db-98.log
db-109.log      db-125.log      db-141.log      db-158.log      db-174.log      
db-190.log      db-206.log      db-222.log      db-239.log      db-255.log      
db-271.log      db-33.log       db-5.log        db-66.log       db-82.log       
db-99.log
db-11.log       db-126.log      db-142.log      db-159.log      db-175.log      
db-191.log      db-207.log      db-223.log      db-24.log       db-256.log      
db-272.log      db-34.log       db-50.log       db-67.log       db-83.log       
db.data
db-110.log      db-127.log      db-143.log      db-16.log       db-176.log      
db-192.log      db-208.log      db-224.log      db-240.log      db-257.log      
db-273.log      db-35.log       db-51.log       db-68.log       db-84.log       
db.redo
db-111.log      db-128.log      db-144.log      db-160.log      db-177.log      
db-193.log      db-209.log      db-225.log      db-241.log      db-258.log      
db-274.log      db-36.log       db-52.log       db-69.log       db-85.log       
lock
db-112.log      db-129.log      db-145.log      db-161.log      db-178.log      
db-194.log      db-21.log       db-226.log      db-242.log      db-259.log      
db-275.log      db-37.log       db-53.log       db-7.log        db-86.log
db-113.log      db-13.log       db-146.log      db-162.log      db-179.log      
db-195.log      db-210.log      db-227.log      db-243.log      db-26.log       
db-276.log      db-38.log       db-54.log       db-70.log       db-87.log
db-114.log      db-130.log      db-147.log      db-163.log      db-18.log       
db-196.log      db-211.log      db-228.log      db-244.log      db-260.log      
db-277.log      db-39.log       db-55.log       db-71.log       db-88.log
{code}
Than reduce to the below after GC:
{code:java}
icbts-2:activemq-unit-tests icbts$ ls target/data/kahadb/
db-318.log      db.data         db.redo         lock
{code}

> KahaDB Recovery can experience a dangling transaction when prepare and commit 
> occur on different data files.
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-7067
>                 URL: https://issues.apache.org/jira/browse/AMQ-7067
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: KahaDB, XA
>    Affects Versions: 5.15.6
>            Reporter: Jamie goodyear
>            Assignee: Gary Tully
>            Priority: Critical
>             Fix For: 5.16.0, 5.15.7
>
>         Attachments: amq7067test.patch
>
>
> KahaDB Recovery can experience a dangling transaction when prepare and commit 
> occur on different data files.
> Scenario:
> A XA Transaction is started, message is prepared and sent into Broker.
> We then send into broker enough messages to file page file (100 message with 
> 512 * 1024 characters in message payload). This forces a new data file to be 
> created.
> Commit the XA transaction. Commit will land on the new data file.
> Restart the Broker.
> Upon restart a KahaDB recovery is executed.
> The prepare in PageFile 1 is not matched to Commit on PageFile 2, as such, it 
> will appear in recovered message state.
> Looking deeper into this scenario, it appears that the commit message is 
> GC'd, hence the prepare & commit can not be matched.
> The MessageDatabase only checks the following for GC:
> {color:#808080}// Don't GC files referenced by in-progress 
> tx{color}{color:#cc7832}if {color}(inProgressTxRange[{color:#6897bb}0{color}] 
> != {color:#cc7832}null{color}) {
>  {color:#cc7832}for {color}({color:#cc7832}int 
> {color}pendingTx=inProgressTxRange[{color:#6897bb}0{color}].getDataFileId(){color:#cc7832};
>  {color}pendingTx <= 
> inProgressTxRange[{color:#6897bb}1{color}].getDataFileId(){color:#cc7832}; 
> {color}pendingTx++) {
>  gcCandidateSet.remove(pendingTx){color:#cc7832};{color} }
>  }
> We need to become aware of where the prepare & commits occur in pagefiles 
> with respect to GCing files.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to