55
голосов
6ответов
31266 просмотров

Atomic increment of a counter in django

I'm trying to atomically increment a simple counter in Django. My code looks like this: from models import Counter from django.db import transaction @transaction.commit_on_success def increment_counter(name): counter = Counter.objects.get_or_create(name = name)[0] counter.count += 1 ...

3
голосов
5ответов
2181 просмотров

How do you prevent database changes inside a Rails ActiveRecord before_create filter from getting rolled back when it returns false?

I've added a before_create filter to one of my Rails ActiveRecord models and inside that filter I'm doing some database updates. Sometimes I return false from the filter to prevent the creation of the target model, but that is causing all the other database changes I made (while inside the filt...

26
голосов
9ответов
6026 просмотров

When should I consider using a in memory database and what are the issue to look out for?

I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, non...

9
голосов
1ответов
2732 просмотров

NServiceBus and NHibernate - Message Handler and Transactions

From my understanding NServiceBus executes the Handle method of an IMessageHandler within a transaction, if an exception propagates out of this method, then NServiceBus will ensure the message is put back on the message queue (up X amount of times before error queue) etc.. so we have an atomic op...

1
голосов
1ответов
451 просмотров

Transactional File Access and Caching in JBoss AS 5

We need to locally store a cache on a File System through JBoss 5. The files we need to store are big (~50 Mbyte) and there are many consumer (through WS on JBoss) that read these files and one producer (JBoss Biz Logic) that creates the last one. Because there are concurrent read and write pro...

1
голосов
1ответов
474 просмотров

EJB3/DB2 Transactions not rolling back

I have a situation where I have a tree of Entities, and a Session Bean. The Session Bean simply persists or merges the entities, and the method in question is marked as @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW). Now in the case that a child entity fails to be persisted/merged...

0
голосов
2ответов
1061 просмотров

Preserve Autoincrement ID Within MySQL Transaction

I have two MySQL database tables that are meant to hold data for eshop orders. They're built as such (extremely simplified version): CREATE TABLE `orders` ( `id` int(11) NOT NULL auto_increment PRIMARY KEY (`id`) ); CREATE TABLE `order_items` ( `id` int(11) NOT NULL auto_increment, `orderI...

0
голосов
1ответов
530 просмотров

WAIT in Transaction - Firebird

Can we set the index active when another transaction is in progress. Will firebird wait till the other transaction completes its operation and the index will become inactive/active (this is for reindexing) after that ? Thank you. Regards, Sabu

1
голосов
2ответов
547 просмотров

Multithread-safe JDBC Save or Update

We have a JMS queue of job statuses, and two identical processes pulling from the queue to persist the statuses via JDBC. When a job status is pulled from the queue, the database is checked to see if there is already a row for the job. If so, the existing row is updated with new status. If not, a...

0
голосов
1ответов
50 просмотров

Any issues with join hints in a SQL Server 2000 view?

I have some ad-hoc reporting users hitting some SQL Server views. Occasionally the read locks taken by these users for particularly lengthy queries causes trouble elsewhere in the system. I am considering adding some strategic with(nolock) hints to the views but wanted to know if there are any ...

2
голосов
2ответов
190 просмотров

Can SubSonic's SimpleRepository enlist in a transaction for two different object types?

I've been exploring Sub Sonic 3's SimpleRepository and have been pretty happy with it but have a question regarding transactions. I am aware that using methods like 'AddMany' and 'DeleteMany' will automatically perform all of those operations within a single transaction, but was wondering if it's...

9
голосов
3ответов
7518 просмотров

confusion about transactions and msdtc

I have some basic confusion about how transactions and msdtc work together. I have a basic server/client winforms app. The app uses transactionscope to encapsulate several sql commands that are executed on the sql server. The app seemed to work fine when I enabled msdtc network access on the se...

1
голосов
1ответов
333 просмотров

NHibernate transactions randomly not rolled back

I have a suite of integration tests that run inside transactions. Sometimes it seems that NHibernate transactions are not being correctly rolled back. I can't work out what causes this. Here is a slightly simplified overview of the base class that these integration test fixtures run with: publi...

0
голосов
4ответов
2114 просмотров

PHP: SQL Prepared statement transaction not working correctly. It's inserting 1 SQL statement, not both

I'm finding that the PDO Transaction is only commiting 1 of my 2 SQL statement. For some reason, my PHP script is not inserting into my MySQL database 'homes' table BUT it does insert into the 'invoices' table - even though I'm using a PHP PDO database transaction. Code below: $conn_str = DB . ...

1
голосов
1ответов
1563 просмотров

.NET TransactionScope rollback order

Apparently (because the documentation doesn't say any word of this), in a .NET Transaction (using TransactionScope), the rollbacks are done in the same order as the commits would be, and in the same order as the registrations were done. Logically, rollback should be in reverse order: If an actio...

1
голосов
2ответов
468 просмотров

Autocommit vs. Single Transactions (Small Project vs. Big Project)

I am currently working on a very specialized PHP framework, which might have to handle large database transfers. For example: Take half of the whole user count; this should be every day's workspace for the framework. So, if my framework is required by big projects, is it recommend to use singl...

0
голосов
1ответов
563 просмотров

Atomicity of Data Adapter in ADO.NET

I am new to ADO.NET and learning it. I was wondering if Data Adapter in ADO.NET provides atomicity or ACID properties by itself when filling the Data Set and updating the Database, or do we have to use transaction explicitly to achieve this. Let's say: I want to fetch data from the Database th...

0
голосов
1ответов
580 просмотров

Extending a WCF Service Reference to a WSDL to implement IEnlistmentNotification

I have a WCF Service Reference to a WSDL file for a credit card processing web service (Cybersource). I'd like to somehow extend the generated service reference client to implement IEnlistmentNotification as to support transactional processing. I am familiar with implementing the IEnlistmentNot...

0
голосов
1ответов
563 просмотров

TransactionScope random error in debug mode

I get following error randomly when executing code from debug mode. Cannot access a disposed object. Object name: 'SqlDelegatedTransaction'. Error is being thrown after few commands have been executed instantly, not an timeout issue I have just one transaction, opened with using(var scope ...

1
голосов
2ответов
4883 просмотров

MySQL Deadlock Detection via PHP

What is the best-practice in dealing with MySQL Dead-Locks in PHP? Should I wrap all database calls in a try{}catch{} block and look for the DeadLock error code from the database? Do I then reissue the whole transaction again (I presume the one that failes rolled back)?

1
голосов
1ответов
406 просмотров

Common-practice in dealing with high-load tables in MySQL

I have a table in MySQL 5 (InnoDB) that is used as a daemon Processing Queue, thus it is being accessed very often. It is typical to have around 250 000 records inserted per day. When I select records to be processed, they are read using a FOR UPDATE query to eliminate race conditions (everything...

0
голосов
1ответов
191 просмотров

Microsoft SSIS 2005. Can't Use Transactions

I have set the package TransactionOption to Required and DataFlowTask's TransactionOption to Supported, but when I execute the package, I get an exception: [ADO NET Destination [82]] Error: The transaction has already been implicitly or explicitly committed or aborted Why does this happen...

2
голосов
3ответов
2733 просмотров

Transaction Processing Using PHP and MySQL

I'm trying to implement two-phase commit using PHP and MySQL, and coming up short. The main block I've found is that I'm unable to store the MySQL connection resource in a place where I can find it again for the second phase. Is it possible to serialize a database handle? Here's the case I'm tr...

6
голосов
1ответов
3045 просмотров

How do I keep an OleDbConnection from trying to enlist in a distributed transaction?

I am using OleDB to connect to an excel file using this connection string @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES""" But when I do this (which is inside a TransactionScope()) using (OleDbConnection conn = new OleDbConnection(connectionS...

3
голосов
3ответов
1213 просмотров

Transaction with two sql insert

I have two sql insert to do (say for examples in tables A and B), they are in a transaction because I want the database to remain consistent, that is, a tuple in A must have references in B. In the second insert I need the id that comes from the first, but I don't get this id until I make a comm...

1
голосов
4ответов
1051 просмотров

Ensuring unique numbers from a sql server database

I have an application that uses incident numbers (amongst other types of numbers). These numbers are stored in a table called "Number_Setup", which contains the current value of the counter. When the app generates a new incident, it number_setup table and gets the required number counter row ...

43
голосов
3ответов
31297 просмотров

What happens to an uncommitted transaction when the connection is closed?

Are they rolled back immediately? Are they rolled back after some period of time? Are they left in an uncommitted state? Is the behavior the same if connection pooling is used and the connections are simply reset?

0
голосов
1ответов
1367 просмотров

Where exactly is the JTA Transaction demarcation for CMT respected?

I'm trying to fully understand the JTA demarcation with CMT. The behavior I am experiencing is that only the first @TransactionAttribute of the method is respected on the EJB and subsequent method invocations of the same bean with different @TransactionAttribute annotations are not. Example: ...

0
голосов
2ответов
4507 просмотров

Enterprise Library Data Access Block Transaction Management Best Practice

What is the best practice for processing a batched series of CRUD operations in a single transaction with the Enterprise Library Data Access Block that it won't be esclated to a distributed transaction? Edit Full Source: public void BatchInsertEvents(IList<EventItem> events) { _dataAc...

3
голосов
2ответов
1878 просмотров

Why does creating a table with a foreign key constraint in one transaction block access to the referenced table in another?

In one transaction I am creating a table which references another table. In a second transaction, I run a SELECT-query against the referenced table but it is blocked by the first transaction. Why is that? Transaction A: BEGIN TRAN CREATE TABLE Child (id int NOT NULL, parentI...