Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

How to automatically detect when an index gets corrupted?????

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to automatically detect when an index gets corrupted?????

    I have a table whose index gets corrupted frequently. Sometimes many times in a day.

    I need a way to detect when an index is corrpupt so that I can programatically fix the index.

    Any help would be GREATLY appreciated!!
    Gary S. Traub, Ph.D.


    #2
    Re: How to automatically detect when an index gets corrupted?????

    This is discussed somewhere in the forum, I was on the posts. I recall the test is to use LOOKUPx():

    id=1
    if lookupn("F",id,"ID","table1","Id") = id
    ?"no problem, continue".
    else
    'whatever you do to rebuild the index
    end if
    I remember I used this for a login situation. If the test failed, I logged them out and sent them to a screen telling them to login again. In the mean time, I rebuild the indexes. The indexes were not becoming corrupt due to any fault of Alpha. The other option is to move up to SQL.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: How to automatically detect when an index gets corrupted?????

      Hi Steve,

      Thanks for your reply, but I have searched the forum and have not found a solution. I know how to fix the index via update_prodcution_index, but I need a way to detect when the index gets corruoted. What is the best (or any) way to detect when an index gets corrupted.
      Gary S. Traub, Ph.D.

      Comment


        #4
        Re: How to automatically detect when an index gets corrupted?????

        I thought I answered that in the quoted part of my post.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: How to automatically detect when an index gets corrupted?????

          Originally posted by drgarytraub View Post
          Hi Steve,

          Thanks for your reply, but I have searched the forum and have not found a solution. I know how to fix the index via update_prodcution_index, but I need a way to detect when the index gets corruoted. What is the best (or any) way to detect when an index gets corrupted.
          Another way is to use a utility for a table.

          cp - tables - right click - utilities - Check Indexes

          or run a5_checkindexesdialog() in the interactive window.

          You should also look at Cal's index utility.
          Al Buchholz
          Bookwood Systems, LTD
          Weekly QReportBuilder Webinars Thursday 1 pm CST

          Occam's Razor - KISS
          Normalize till it hurts - De-normalize till it works.
          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
          When we triage a problem it is much easier to read sample systems than to read a mind.
          "Make it as simple as possible, but not simpler."
          Albert Einstein

          http://www.iadn.com/images/media/iadn_member.png

          Comment


            #6
            Re: How to automatically detect when an index gets corrupted?????

            Steve,

            I have tried that method and it does not work.



            Al,

            Those methods are of no use in this situation because they have to be run manually, and they take long to run.



            The first sign that I have that the indexes are corrupt is when one of my grids does not display correctly. When this happens, I run the update_production_index and it fixes the problem every time. So I need to be able to detect with xbasic for a conditon that exists when the grid looks funny so to speak. What I would like to do is to detect the condition that is causing the grid to look funny, and then automatically run update_production_index.

            Does this explain sufficently?
            Gary S. Traub, Ph.D.

            Comment


              #7
              Re: How to automatically detect when an index gets corrupted?????

              Originally posted by drgarytraub View Post
              Steve,

              I have tried that method and it does not work.



              Al,

              Those methods are of no use in this situation because they have to be run manually, and they take long to run.



              The first sign that I have that the indexes are corrupt is when one of my grids does not display correctly. When this happens, I run the update_production_index and it fixes the problem every time. So I need to be able to detect with xbasic for a conditon that exists when the grid looks funny so to speak. What I would like to do is to detect the condition that is causing the grid to look funny, and then automatically run update_production_index.

              Does this explain sufficently?
              Than Steve's model is what you want to work with. Use the id value to be the key to the index that the browse is retrieved by.
              Al Buchholz
              Bookwood Systems, LTD
              Weekly QReportBuilder Webinars Thursday 1 pm CST

              Occam's Razor - KISS
              Normalize till it hurts - De-normalize till it works.
              Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
              When we triage a problem it is much easier to read sample systems than to read a mind.
              "Make it as simple as possible, but not simpler."
              Albert Einstein

              http://www.iadn.com/images/media/iadn_member.png

              Comment


                #8
                Re: How to automatically detect when an index gets corrupted?????

                Don't know if this will help your situation but I purchased Cal's Index Rebuild Utility and have it set to run the first time the application is run every day.

                I haven't had a problem with indexes since doing this a couple of years ago.

                Comment


                  #9
                  Re: How to automatically detect when an index gets corrupted?????

                  Tim,

                  Thanks for the response but I need something that will detect the corruption ...


                  Steve and Al,

                  I tried the following code:

                  idnumber="0000000038"
                  if lookup("[pathalias.adb_path]\patients","patients->idnumber='"+idnumber+"'","fullname")="Smith, John"
                  ?"no problem, continue"
                  else
                  ?"INDEX APPEARS TO BE CORRUPTED"
                  'whatever you do to rebuild the index
                  end if

                  Does not do the job. Yesterday, I got the corrupted index, identified by the distirted grid as I described above, but the code indicated "No problem, continue"

                  What am I doing wrong?
                  Gary S. Traub, Ph.D.

                  Comment


                    #10
                    Re: How to automatically detect when an index gets corrupted?????

                    Is the patient table the table that the browse is based on?

                    Or is there a different child table?

                    A look at the set structure, linkages, and the form would help.

                    Also, did you run the check indexes utility to see what it said?
                    Al Buchholz
                    Bookwood Systems, LTD
                    Weekly QReportBuilder Webinars Thursday 1 pm CST

                    Occam's Razor - KISS
                    Normalize till it hurts - De-normalize till it works.
                    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                    When we triage a problem it is much easier to read sample systems than to read a mind.
                    "Make it as simple as possible, but not simpler."
                    Albert Einstein

                    http://www.iadn.com/images/media/iadn_member.png

                    Comment


                      #11
                      Re: How to automatically detect when an index gets corrupted?????

                      I went down memory lane and found my original code for this (2007). I remember now that Jerry helped me write it. This script tested the index on my web_users table, as the person logged in.

                      The first line gets the ID from the web_users table. The ID should be the same as the value in session.__protected__ulink, in this case. I think you can tell from the error messages what I am testing for. The part you care about is line 10-15 where it verifies that the ID in fact matches the session var.

                      Don't pay attention to the fact that this involved security framework. The script just asks, is the value I get from my table the value I know it should be. If not, index is corrupt.

                      return = table.external_record_content_get("[PathAlias.ADB_Path]\web_users","id","","id="+session.__protected__ulink)
                      if line_count(return) = 0
                      t_error = .t.
                      error_msg = "NO USER RECORD"
                      end if
                      if line_count(return) > 1
                      t_error = .t.
                      error_msg = "MULTIPLE USER RECORDS"
                      end if
                      dim chkid as c
                      chkid = alltrim(return)
                      if chkid <> session.__protected__ulink
                      t_error = .t.
                      error_msg = "ULINK MISMATCH"
                      end if
                      if t_error = .f.
                      'do whatever here if no error
                      else
                      'ATTEMPT REINDEX OF USER TABLE
                      dim tbl as p
                      tbl=table.open("[PathAlias.ADB_Path]\web_users")
                      idx = tbl.update_production_index()
                      tbl.close()
                      end if
                      Steve Wood
                      See my profile on IADN

                      Comment


                        #12
                        Re: How to automatically detect when an index gets corrupted?????

                        I know I had a routine in place once on a large application that could detect corrupt indexes, it was (if I recall correctly) based on a standard Alpha function. However, if you are experiencing this a lot (like many times a day as you said) this approach will probably NOT help (it did not help me) since when the corruption occurs, it is very likely that your users detect it faster then your build in routine (which apparently has to run on some sort of timer and thus works with intervals), no matter what routine it is. In my case, it did not fit my needs although it did work in terms of functionality sec.
                        When you are not ready to keep rebuilding indexes on a daily basis, the only thing that actually WORKS is porting your application to SQL, although that has "a price tag" (probably much work) of its own.

                        Comment


                          #13
                          Re: How to automatically detect when an index gets corrupted?????

                          Al,

                          The grid is based opn a view of appointments and then patients is the child. it is the patients table indexes that gets corrupted. Can't check index that way because when it occurs it is most imperative that it be fixed. Takes just 5 seconds or so to fix. The issue is detecting the condition so the fix can be done automatically,


                          Steve,

                          Thanks lots for that code. I will try it out.


                          Marcel,

                          Thanks for your thoughts as well.
                          Gary S. Traub, Ph.D.

                          Comment


                            #14
                            Re: How to automatically detect when an index gets corrupted?????

                            Triage is always important.

                            When it's a timely issue, then make a copy of the table, support tables, and index - then reindex the original and analyze the copy at your own pace.

                            the copy is fairly quick.
                            Al Buchholz
                            Bookwood Systems, LTD
                            Weekly QReportBuilder Webinars Thursday 1 pm CST

                            Occam's Razor - KISS
                            Normalize till it hurts - De-normalize till it works.
                            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                            When we triage a problem it is much easier to read sample systems than to read a mind.
                            "Make it as simple as possible, but not simpler."
                            Albert Einstein

                            http://www.iadn.com/images/media/iadn_member.png

                            Comment


                              #15
                              Re: How to automatically detect when an index gets corrupted?????

                              Analyzing a copy to try and find the index problem can't hurt. And maybe leads to results as well. Although in all the years we have been working with the earlier mentioned large database, we have never been able to find the culprit of the index problems, no matter how hard we tried and with how many (well qualified!) developers on it. It seemed some type of "ghost problem" at times. We always suspected the large number of users to be a factor but never found any evidence for that thought. Mostly the index failure would reside in the same group of 5 (heavily used!) tables.

                              Indexing is not always 100 percent a pain. Many times we used the re-indexing time (20 minutes to half an hour) to implement other emergency fixes in the live database. The re-indexing gave us a window of opportunity which we used to the best option.

                              Point with re-indexing is, that you need every user out of the system. And as the number of users grows, you will find that you will always have users in the system that are actually not behind their pc anymore. They simply leave themselves in the system and walk away from their desk for some reason. And yes, we DID actually forbid this, it was mandatory that when you left your desk you logged out of the system. Some simply didn't, incidentally even some users seemed to be still logged in although their systems were not even ON at that time. All of this becomes a problem as you need all users out before you can re-index, and thus everybody is waiting on a few users who did not logged out as was procedure. And you can't walk around logging everyone out yourself. We tackled THAT sub-problem by logging EVERY user out remotely in a system that would put a message on each screen to warn them that they had 5 minutes to log out. Who didn't by that time simply was thrown out of Alpha. You really need to see to it that if you can't find the cause for the index problems, that you minimize the time that gets lost by it as best as you can.

                              Comment

                              Working...
                              X