Concurrency Issue

Sep 27, 1999

Can anyone help with concurrency issues. Small network and only one person at a time can log into the database.
It was originally written in MS Access and converted to SQL 7.0 with a VB front end.

Thanks,

Rick

View 1 Replies


ADVERTISEMENT

Concurrency In Asp.net

Oct 25, 2006

Hi everybody,I need to understand how concurrency excatly
work in asp.net. For example, I'm confused what happens if two users at
the same time try to access the same record in a table or even the same
variable. Do ASP.NET handle this , I mean by locking one user and
letting the other to have access  OR it's up to the programmer to write
some code to lock shared resources such as database , objects and
variables?If it's up to the programmer to do this task, I appreciate if you can show me an example that clarifies that.Thank you

View 2 Replies View Related

Concurrency, Have I Got This More Or Less Right?

Jul 23, 2005

Following on from a thread I started about "concurrency" (real-time-ishsystem), I thought I would play about to see if I could easily adapt my datamodel to take account of potential multi-user write conflicts. So, I wouldappreciate you checking my logic/reasoning to see if this kind of thingwill work. Below I have a stored procedure that will simply delete a givenrecord from a given table. I have appended a "_Written" counter to thecolumns of the table. Every time the record is written, the counter isincremented. Clients store the current _Written count in their objects andpass this in to any write procedure executed.The procedure explicitly checks the _Written count within the transaction tosee if it agress with the written count passed in by the client. If it doesnot, the client throws an error. Note I am explicitly checking the_Written count precisely so I can determine exactly why this operation mightfail, rather than checking @@ROWCOUNT after an update.Thanks.RobinCREATE PROCEDURE dbo.proc_DS_Remove_DataSet@_In_ID INTEGER,@_In_Written INTEGERASDECLARE @Error INTEGERDECLARE @WRITTEN INTEGERBEGIN TRANSACTIONSET @Error = @@ERRORIF @Error = 0BEGINSELECT @WRITTEN = _Written FROM MyTable WHERE ID = @_In_IDSET @Error = @@ERRORIF @WRITTEN <> @_In_WrittenBEGINRAISERROR ('10', 16, 1)SET @Error = @@ERRORENDENDIF @Error = 0BEGINDELETE FROM MyTable WHERE ID = @_In_IDSET @Error = @@ERRORENDIF @Error = 0COMMIT TRANSACTIONELSEROLLBACK TRANSACTIONRETURN @Error

View 5 Replies View Related

Concurrency

May 27, 2007

Do single commands (or stored procedures) execute concurrently, or they are executed one by one. How do you perform a lock during the execution of a command (or stored procedure).

View 3 Replies View Related

Object Concurrency

Jun 20, 2006

I have a user object that is stored in the session for each user but what if an administrator updates a certain user and I want to reflect the update to the user if they are logged in?One possible way of solving this is:Each time the user goes to a page, check the user table and compare the timestamp. That would mean if 30 users refresh the page..the db would hit 30 times lol. I don't think that would scale very well.Any ideas on how to solve this?

View 5 Replies View Related

UPDATE Concurrency?

Aug 4, 2006

I have a table where I count how many emails of a given type are sent out each day. This incrementing is wrapped in a sproc that either inserts a new row, or updates the existing row. The column that counts the value is named Count of type INT.
Below is the sproc, seems like a straightforward thing. However, I'm seeing email counts higher than they should be when there's a high number of concurrent executions of the sproc. I'm pretty sure it's not a problem in the calling code, so I'm wondering about the UPDATE statement, since it updates a column based on the value of the column. I would think this should work since it's wrapped in a SERIALIZABLE transaction, anybody have further insight?
SQL Server 2005 by the way.
Sean
CREATE PROCEDURE [dbo].[IncrementEmailCounter](    @siteId SMALLINT,    @messageType VARCHAR(20),    @day SMALLDATETIME) ASBEGIN    SET NOCOUNT ON;
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE    BEGIN TRANSACTION
    IF (SELECT COUNT(*) FROM EmailCount WHERE SiteId = @siteId AND MessageType = @messageType AND [Day] = @day) = 0        INSERT INTO EmailCount (SiteId, MessageType, [Day], [Count]) VALUES (@siteId, @messageType, @day, 1)    ELSE        UPDATE EmailCount SET [Count] = [Count] + 1 WHERE SiteId = @siteId AND MessageType = @messageType AND [Day] = @day
    COMMIT TRANSACTION    SET TRANSACTION ISOLATION LEVEL READ COMMITTEDEND

View 3 Replies View Related

Database Concurrency

Feb 17, 2007

I'm wondering whether the following code would work if users are RAPIDLY registering (assumption) WITH the same username.public bool UsernamExists(string username)
{
string sql = "SELECT true FROM [users] WEHRE username = @username;";
return Convert.ToBoolean(comm.ExecuteScalar());
}

public bool Signup(User user)
{
bool usernameExists = UsernameExists(user.Username);
if( usernameExists ) return false;

//update or insert sql for user etc blah blah
} If two users try to signup AT THE VERY SAME TIME (DOWN TO THE NANOSECOND), would this technique work? Do I have to wrap it in a transaction, stored procedure??  Thanks. 

View 8 Replies View Related

Optimistic Concurrency Help

Jun 1, 2007

Hi,I'm trying to implement Optimistic Concurrency in asp 2 but so far it has caused me nothing but problems.First, when doing an UPDATE I tried to use the primary key & a timestamp field which I had in SQL Express.. VS 2005 generated the stored procedures fine however when it came to the actual updating I think there was a problem with the conversion of the timestamp field when it was being stored in a text box (in a FormView control). So.. as a result that failed. And also I checked sooo many places online and haven't been able to find any examples of code where a timestamp was used with success in asp2.Next, I got ride of the timestamp type (in SQL Express database) and used a datetime and then.. I just implemented Optimistic Concurrency by passing in ALL the values (ie all the original values) like is proposed http://www.asp.net/learn/dataaccess/tutorial21vb.aspx?tabid=63 . This... works however I really do not want to have to pass in ALL these values (ie original and new).Ideally I would like to be able to use the primary key & the datetime field to handle the Optimistic Concurrency checks where only the original values of both those fields are passed back into the stored procedure. Now.. I tried this as well, but I kept getting an error that suggests that (for some reason) the FormView or DataSource is passing ALL the values (original & new) into the dataset as opposed to only the original primary key & datetime fields & the new set of values.Can ANYONE offer any help? I really would like not to have to pass in all these values.Thanks in advance! 

View 6 Replies View Related

Concurrency Control

Apr 6, 2005

Hi! I'm building a web application with ASP.NET, and using MS SQL 2000 for my database server.
How should I do to guarantee the integrity of the data in spite of the concurrent access? Meaning... how can I make sure that more than 1 user can update 1 table at the same time, while no error will occur? Do I need to add some codes at my aspx file? Or do I need to do something to my database? Or do I not have to worry about it?
Thank you.

View 1 Replies View Related

SQL Server 6.5 SMP Concurrency

Feb 2, 1999

We have two processors on which sql server was installed.

SMP Concurrency opion is -1. and process priority is 0.

The computer is dedicated to Sql server.

with the same setup, has any body faces any problem....?

some times suddenly system hangs... sql sever takes 99% cpu usage ...

Shall I run the SQL Executive, SQL Performance Monitor with this setup...?

will it afect the system...?

[ this kind of setup - those you experienced.. ]

please reply immediately....

thanks

Wincy

View 1 Replies View Related

SMP Concurrency Configuration

Mar 31, 1999

Hello,
SQL Server6.5 is installed on a dual processor computer. So can I make use of dual processors by setting SMP concurrency to -1 or 2.

I tried setting these values but failed to do so. Server is running at setting 1 always, irrespective of configured value.

Any suggestion???

Srini

View 3 Replies View Related

Concurrency Issues

Sep 6, 2004

Is there any way to get the sample below working so that both "threads" are guaranteed to get unique and incrementing values?

I'm suspecting the answer is no. You can use transactions on completely database oriented operations that read/write to a database and complete. But there aren't complete synchronization controls for operations like below that try to return a value to an outside process.


IF OBJECT_ID('SimpleTable') IS NOT NULL
DROP TABLE SimpleTable

CREATE TABLE SimpleTable (
A INTEGER
)
INSERT INTO SimpleTable (A) VALUES (1)

-- Run in one window
DECLARE @value INTEGER

BEGIN TRANSACTION
SELECT TOP 1 @value = A FROM SimpleTable
WAITFOR DELAY '00:00:05'
UPDATE SimpleTable SET A = @value + 1
COMMIT TRANSACTION

SELECT @value
SELECT A FROM SimpleTable

-- Run in a second window
DECLARE @value INTEGER

BEGIN TRANSACTION
SELECT TOP 1 @value = A FROM SimpleTable
UPDATE SimpleTable SET A = @value + 1
COMMIT TRANSACTION

SELECT @value
SELECT A FROM SimpleTable

View 7 Replies View Related

Concurrency Question

Oct 5, 2006

Suppose process A is updating record #1 in table T.

By default, can other processes read record #1 while the updating is in progress ??

If the answer is Yes, then which value can they see - the old one or the new one ?

Thank you in advance.

View 1 Replies View Related

Question About Concurrency

Aug 16, 2006

Did I understand correctly the Pesimistic access:
When we choose pessimistic access
-we lock all the rows of the table. right.
-other users still can access the table if they specify read only mode meaning if their intention is to only read the data and not modify it. am I right

Thanks for your help.

View 1 Replies View Related

Cursors And Concurrency

Sep 21, 2006

In a previous post, the theme of cursors and concurrency was touched as a secondary subject. I have a specific question about it as the primary one:

if we have
--------
create proc myProc
as
declare cursor for
select * from mytable
go
----------
if two or more clients(webpages for example)
execute myProc concurrently will the cursor be safe ? or would I have to make special arrangements, there are a couple of procs (that use cursors)that somebody else did and would not like to modify but we want to make the procs web available,

thank you

View 2 Replies View Related

Concurrency In Transaction

Aug 4, 2005

hi gurusthe scenarioFrontend - MS Access (not yet decided whether MDB or ADP)Backend - MS SQL Serverit is a conversion from MS Access backend to MS SQL Server Backend.Planning to create stored procedures for all the Inserts, Updates,Deletes and Business Rules / Validations wherever it is possible.the problemi am running in concurrency problem. the same classic scenario of twousers retrieving the same row (record) from the same table. it allowsboth the user to update the record, that is, the user who updates lasthas his changes saved though he retrieved that particular recordsecond.what i need is that the user who retrieved the record second shouldn'tbe able to update or delete the record when it is already retrieved byany other user.would appreciate if someone pointed me in the right direction to solvethe above problem, i know it is related to isolation property but amnot surethanx in advanceregardsbala

View 2 Replies View Related

Possible Concurrency Issues.

Apr 6, 2006

Hi,
I was wondering if it is possible to call a stored procedure from sql server 2005 (call it sp_1) that calls an assembly which takes a message, wraps it in soap and calls a webservice and waits for a reply from that webservice (the stored procedure is clr not t-sql). This WebService needs to then call sp_1 to perform some other tasks. Is this possible or does sp_1 need to have finished what it was doing before it can be called again.

I have been trying to do this and have received a number of errors one of which looks like;

'The context connection is already in use.'

Sorry if I haven't worded it very well, I will try to clear up any questions if you need me to.

Thanks
N

View 1 Replies View Related

Managing Concurrency

May 15, 2007

I want to centralize my previous standalone application. Previous application was using VB.NET and Access XP. Now I want to keep a centralized database (SQL Server 2005) and VB.NET 2005. At this point of time thousands of concurrent users will connect to the database at the same time.

In my application, when a ticket is being issued to a tourist, an SQL query finds the max(ticketno) for the current month from the main table and reserves this number for the current ticket. When the operator has finished entering information and clicks SAVE button, the record is saved to the main table with this ticket no. Previously there was no issue since the database was standalone.

I want to know how to block the new ticket no so that other concurrent users are not using the same number for saving a record. How to better tune the database for thousands of concurrent users at the same time? I also want that the other user must not get an error message when he attempts to save a record. It should be automatically handled by the database.

View 8 Replies View Related

Concurrency Control

Mar 5, 2008

I created an ETL Process which loads four different types of files into different tables in parallel. There is no issue with this parallelism as the sources and destinations are distinct. But I have a common log table where I log the status and timings of each load for any file type. When ever I start a new file load, I create an entry in this log table with the FileTypeID and LoadInProcess as 1 (this will be set to 0 for all other records of the same file type). At different stages of the load, I will pull the active LoadID of the current file type and update the same record with the timings and results. My code looks like this -





Code Snippet
SELECT

@LoadLogKey = LoadLogKey
FROM

SystemLoadLog (NOLOCK)
WHERE

FileTypeID = 1 and LoadInProcess = 1


IF @LoadLogKey is NULL

RAISERROR('Unable to retrive LoadLogKey for the current load!')

***Process1 Query
***Process2 Query
***Process3 Query

UPDATE

SystemLoadLog
SET

Process1Result = x,
Process2Result = y,
Process3Result =z
WHERE

LoadLogKey = @LoadLogKey






The first SELECT query is giving problems as different processes are using the same table to log the results and timings. The source files I load are too small that the data load finished in 1 or 2 seconds most of the time and within this timespan, I update the log atleast 10 times. So, if four different file types are loading, the hits to the SystemLoadLog can be as bad as 20 to 30 times in 1 second.

Can anyone let me know how to handle this?

Thanks in Advance!!!
Harish

View 3 Replies View Related

Concurrency With SQLExpress

Dec 4, 2006

Hi:
Need some advice. Here is the scenario:

There are 17 Client PC connected to a Server with SQLExpress 2005.

17 Client will do verification of identity before sending data to display at server
in first in first out basis using Datagridview ( the earliest data received will be

display first) and stored for review at later stages.

What should I do? I plan to use VB2005 after trying the EXpress.The Tasks are simple:

Data send --> Server Diplay and Stored---> Someone at Server will Acknowledge by

Button--> Messages will be sent to inform Client data received.

I could have 17 different Table (But with same fields!) and displaying the Data send
by reading all 17 tables and display it with Datagriedview. But this definately will

be slower than Just read from 1 table!

I'm concerned about Concurrency as there is chances that May be more than 1 user

might trying to update the Database at the same occasion. Can someone provide me a

Tips and advice?

Note: I had came across something call CurrencyManager which is related to

Concurrency, Not quite sure about what is this

Thanks

View 1 Replies View Related

How To Enable Optimistic Concurrency

Jul 25, 2006

I have a number of SqlDataSource objects in my application, which don't have Optimistic Concurrency option enabled. The SDS objects use custom Sql statements so I can no longer select the Advance button to enable Concurrent Concurrency.
How can I enable this option? Is there a designt ime property, and even a run time property that can be set?
The only method we have so far is to create a new SDS, with Optimistic Concurrency switched on, then copy and paste my custom Sql into it and rebind my components..
Any help on this matter is appreciated.
Regards,
Steven
 
 

View 2 Replies View Related

What Is The Best Solution For Concurrency Issue

Feb 21, 2007

Hi

i'm dealing with Concurrency Issue in SQL Server 2005,

let me explain me what i want to do

I have a table

UserInfromation

ID (PK - Int autogenerated )

Name ( Varchar(20) )

Age ( int )

LastModifiedDateTime

User 'A' inserts a record in UserInformation Table

1 John 20 12/12/2005 15:30 PM

i have written Stored Procedure which Get's the records from UserInformation Table

again i have one more stored Procedure which updates the UserInformation already entered in UserInfromation Table

if User 'A' runs the Get StoredProcedure on his machine and binds the Dataset ( result ) to GridView at 10:00 AM

A User 'B' runs the Get Stored Procedure on his machine and binds the DataSet ( Result ) to GridView at 10:01 AM

both users are looking at the same same data which was entered by User 'A'

now User 'A' Updates the Record (i.e)

1 John 20 12/12/2005 15:30 PM

to

1 Kemp 50 12/12/2005 10:05 PM

at 12/12/2005 10:05 PM



but the User 'B' is still looking at the data which contains

1 John 20 12/12/2005 15:30 PM

which means the data is invalid,

so my question is how User 'B' is goin to get the notification that the data which he is currently seeing is old one and someone else has modified the data

To solve this problem i have a LastModifiedDateTime Column in UserInformation table which keeps the record of when this data( row ) was modified

what i do is when i get the data from my get stored procedure i get all the columns from the Table and when i modify the selected record i pass the required information in Input Parameter ie. ID ,UserName ,Age , LastModifiedDateTime ( this is the datetime which was saved when the particular record was modified ) , now i'm using the LastModifiedDateTime value and comparing it with the same ID's record.

e.g.

while Running the Get Stored Procedure i'm getting

1 John 20 12/12/2005 15:30 PM

when i'm executing Update Procedure i'm passing values as

1 Kemp 50 12/12/2005 15:30 PM

in my update Stored Procedure i'm comparing the Passed date 12/12/2005 15:30 PM with the current value in the same Id's i.e. ID = 1 LastModifiedDateTime Column if the date which is passed by the user as input parameter is different then the passed ID's LastModifiedDateTime columns value then the stored Procedure will raise and error that the "Data has been changed , request user to Refresh the Data"

my Question is , Is there any other way that i can implement concurrency issue in SQL Server 2005 . Please let me know



Thanks,

SpidyNet

View 2 Replies View Related

Optomistic Concurrency Trouble.

Jan 16, 2006

Hi - I am using the following: (.NET 2.0, Oracle 10g, VWD 2005 Express)  Here is the problem I am having:I am using Optomistic Concurrency to ensure the validity of my data.  Unfortunately, on an update, the data is never being updated and the conflict detection is always occurring.  I've finally found the source of the problem I believe.I think that the SqlDataSource control is doing the following (in the case of nulls):where fielda='' and fieldb='' and fieldc=''and it should be doing:where fielda is null and fieldb is null and fieldc is nullThe reason I believe this is the problem is because I tested by doing a select statement.  I have yet to figure out how to efficiently debug the SqlDataSourceControl with Oracle.  Using XE (web interface) to monitor the SQL statements being sent to the Oracle server, does not yeild the expected results.  Statements look like this (where fielda = :fielda and fieldb = :fieldb and fieldc = :fieldc), where I would have thought it would look like (where fielda='possible value' and fieldb = 'possible value' and fieldc = 'possible value')Please help!

View 11 Replies View Related

Concurrency And Timestamp Or Datetime

Mar 20, 2006

Hi everyone!I've read a lot of document about optimistic concurrency and different implementations which made me decide to chose the timestamp/datetime approuch to validate if another user has editet the record.I'm saying timestamp OR datetime because I dont really care which one to use but I can't make any of them work as expected.Here is my setup:I'm using a DataSet (autogenerated by Visual Studio 2005) with 4 stored procedures to select, update, delete and insert records.I'm using a GridView to show these values but when using a timestamp in the database the parameter type in my ObjectDataSource is an Object which ofcause ins't right and I can't change it to Byte[].If I instead use a Datetime I believe that the date formatting is done somehow (even though i make the field ReadOnly in the GridView) - I can see the date is shown as: "01-01-1900 00:01:07" but the actually SQL that is executed is: 'Jan  1 1900 12:01:07:000AM' why this differense?So my question is which one should I use and how - the datetime/timestamp dosn't have to be shown - I would actually prefer that the datetime/timestamp was somehow hidden from the presentationlayer and only present in the data access layer but still would be transfered to and from the database when doing updates etc.Best of all I could use a working example.Thanks in advance :-)

View 2 Replies View Related

Msde And Optimistic Concurrency

Apr 2, 2006

hello allI am working with the visual studio web express using MSDE as sql server.Every thing is working fine with database except when working with optimistic concurrency.So if I have a GridView or FormView binded to a SqlDataSource that is configured to perform the concurrency, these controls can't perform the update to the database.From debugging, I found that the SqlDataSource Old Value Paramters always null after postback.Is this a bug in the WebExpress, or do I need to use the SqlExpress Edittion?Thanks in advance, and keep the good effort.Hesham

View 1 Replies View Related

Concurrency Violation Error!

May 16, 2006

Hiim keep getting  the following errorConcurrency violation: the UpdateCommand affected 0 recordsI dunno whats wrong, im the only person using the database and program at the moment.Anyone know what im doing wrong?thanks 

View 1 Replies View Related

Multi-user Concurrency

May 30, 2006

Does anyone have links to various strategies for handling multi-user concurrency issues when updating data in SQL Server (2000 or 2005), either in the database (stored procedures) or via code.
I've seen a couple such as:
Check individual user updated columns to see if the database columns have changed and if not apply the updated columns (either individual updates or constructing a dynamic SQL statement).
Check all the fields for any change and if no change, update all the fields.
Check a version field for change and if no change, update all the fields.
What I haven't seen is complete solutions such as for the first one, ensuring the record is locked and can't be changed while checking for concurrency and ultimately updating the data.  For the second one, how to raise an error if there was a problem, or for the third one how to ensure the record is locked between the version check and the update.
Even pieces of solutions are welcome (locking records, testing for change, etc).  Just want to compare and contrast various methods as I create an infrastructure for 2005.
 
Thanks,
LarryC

View 2 Replies View Related

SQL Server Concurrency Issues

Jun 15, 2001

We recently had an issue with SQL Server's performance. We have a server with multiple databases that are accessed by several different applications. When a query was issued to one table on a database (40 million rows), it brought the entire server to its knees. This impacted the other application accessing the database.

The query issued was on a varchar column using a like in the where clause. An index did exists on the table but because of the like clause it didn't want to use the index and proceeded to do a table scan. I understand that tablescans are going to have to happen no matter what sometimes, but why did it hurt the entire server's performance. Any ideas? I'm open to all suggestions. I might be the one doing something wrong and appreciate any advise.

TIA,

AJ

View 4 Replies View Related

Access Front-end - Concurrency

Oct 4, 2006

When I build an MS Access front-end for an SQL Server backend, how does it take care of data integrity and concurrency , if it is only a front-end ?
Is Access smart enough to do the job ?

Thanks.

View 1 Replies View Related

Please Help With Concurrency Locking - Hangs

May 1, 2008

I have several osql processes running piped sql transactions, each of these transactions call pretty much the same update statements with joins to table(s) (table2 in this case) that, though large, are pretty much created by each process so they are not shared - the destination table has about 2.5M rows:

UPDATE t1 SET
t1.a= t2.a,
t1.b = t2.b
t1.c = 'U'
FROM table1 t1 WITH (ROWLOCK)
INNER JOIN table2 t2 WITH (NOLOCK) ON
(t2.d = t1.d AND
t2.e = t1.e AND
t2.f = t1.f AND
t2.g = t1.g)

Initially I couldn't get the processes to run concurrently, but after creating an index on fields d, e, f, g and using the NOLOCK and ROWLOCK hints, the processes will run for a while and then hang on the UPDATE - it took me a while to trace it & invariably the system stops processing (no errors!) when the above and similar UPDATE's to the same 'table1' are attempted. The UPDATE's are embedded in transactions with each having a TRY and CATCH clause for error handling - the weird thing is the processes hang without error...

I really need help cuz I've been banging my head against a wall on this! Since a lot of rows are affected I imagine the ROWLOCK's are being ignored and pagelocks are occurring affecting other processes and their updates; I'm not getting a deadlock or a lock timeout (though I set that absurdly high--will reduce it an try again now).

I could really use help on even approaching this another way - I know since 'table2' has a lot a rows a single UPDATE is probably not a good idea so i might break that up into single UPDATE's - help on iterating through 'table2' and updating 'table1' one row at a time would be appreciated - and any other thoughts, comments, solutions, etc...

Many Thanks!

-p

View 4 Replies View Related

Custom Sequence And Concurrency

May 25, 2008

Hi

I need to generate a custom sequence the sequence logic is based on a datepart and a 6 digit unique number.

The existing solution uses a table where it stores the last generated sequence and when a new sequence is to be generated the table row is locked so nobody gets to update it until work is done and then the locked row is incremented by one.

I have serious doubts about the scalability of that approach is my guess right ?

I am thinking of using a identity column but the problem is everyday the sequence should start from 0000001.

so for example today it should start from
080525000001
and tomorrow onwards it should start from
080526000001 etc..

I have coded a stored proc which depends upon a helper table and generates that and if it is a new day then it truncates that table so the identity column is reset.

is there a way to call the stored proc like this

insert into my_tables
SELECT stored_proc,other_values ...........


regards
Hrishy

View 7 Replies View Related

Concurrency (recap And Idea).....

Jul 23, 2005

With respect to my (now not so recent) thread on Concurrency, I would liketo run my idea past you gurus to see if its a runner. First, a brief recap:I have a single user system (one user, one copy of the software, one copy ofMSDE, one machine) that I wish to convert into a multi-user/single databasenetworked system. The problem I had was that a lot of information isfetched from the database and cached in the client program (the programimplements a tree structure, similar to a file system, and each of the nodesin the system has properties). The concurrency issue revolved around havingmultiple users updating these properties and possibly able to modify thetree structure and there being no way to notify the other clients that theyneed to refresh their data structures. Consider the system to be similar toVSS to look at (and in VSS, people can make modifications to the treestructure also!).Ok, one of the suggestions was time stamping each record. So, when one usermodifies the record, a second user can detect whether their timestamp isdifferent and thus whether or not their update is invalid (and also whetheror not the client program needs to refresh the properties of the givennode). How about instead of a timestamp I simply use a reference counter.ie. an integer that increments every time the record is modified (sameprinciple). I don't need to know when it was changed, just that the tworeference counters are different between when I fetched and when I amupdating the record.Secondly, I think I have to distinguish between a change in properties and achange in structure. For example, User A doesn't need to know about achange in properties for a node he is not currently looking at. However,that same user will want to be told about any change to the overall treestructure. So, I was thinking that any operations involving modificationsto the tree structure should set a "structure changed" flag in the database(increment a counter). After any operation is performed, the clientcompares its "changed" flag to the database value to see if it needs toreload the tree structure.Do you think this is workable?Thanks.Robin

View 2 Replies View Related

Rowlock V. Optimistic Concurrency

Feb 8, 2008

Hi,Sql-Server 2000, 2005.A report fetches a lot of rows using the "WITH (ROWLOCK)" syntax (thesql is generated on the fly by a tool and not easily changeable).SELECT col1, col2 FROM mytab WITH (ROWLOCK) WHERE ...."The select-clause runs for several minutes.Another user fetches one of those rows and tries to update it. Theresult is a lock timeout.I suppose that the long running select-clause has put a shared lock onthe rows and the updater (exclusive-lock) will have to wait for thelong-running select and so the lock timeout is expiring.Are all those rows "shared locked" until all are fetched?Would there be any change if the "WITH (ROWLOCK)" is removed, isn'talthough "shared lock" the default behaviour?The "WITH (NOLOCK)" would probably help?What about the definition of optimistic concurrency, shouldn't allselect-clauses contain "WITH (NOLOCK)" to allow an optimisticconcurrency scenario?Regards Roger.PS. Probably some misunderstanding from me here, but this should bethe right place to get it right.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved